-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
context must be a map #151
Comments
The JSON-LD processor makes a request like:
it gets back a response that includes a link:
That is followed to the context document located at
Hence, the properties are expanded with the namespace This is exactly why we needed clarification on the "https" vs "http" namespace issue in #52. I agree that sticking with
|
Thanks for the nice expansion... Going further you can look at the context file pulled down and look for http
looking for http (or https via substring match) we get
yet.. in the example https://tinyurl.com/y99kj7d7 things correctly expand to their https namespace, not http. Any insight into why this is the case? This seems like it should not occur is the above context is pulled. Seems like application logic coming into play perhaps? |
This is the challenge of namespace ambiguity introduced by the "s". Despite progression towards a duality of schema.org concepts under Writing:
tells the JSON-LD processor that the entire context definition for the document is exactly the map that is the value of the It's important to note that remote contexts are retrieved by a JSON-LD processor by following the spec for Remote Document and Context Retrieval. Basically, requests are made, following 303 redirects and using a Anyway, the outcome of all this is that specifying a context of This of course does have much broader implications, since in specifying the context of [edit: added note on default context] |
It is as I figured.... I appreciate the confirmation though. Sigh. From a developer POV, this little "s" really cause a lot of "hit" (sorry. there is a missing "s" in that "hit") ;) |
It's a widespread challenge, e.g. RDFLib/rdflib#1120 |
its the cost of conflating the location of the resolver to dereference an identifier with the identifier. |
Note that this issue will vaporize when schema.org v 12 comes out in March. See: https://github.com/schemaorg/schemaorg/blob/main/data/releases/12.0/schemaorgcontext.jsonld |
@datadavev you made my day!!!!!!! |
Big relief for me too - there's a whole bunch of normalization code and gymnastics that can go away. Huzzah! |
Hi, could someone confirm if these two @context definitions are different or equivalent now? I'm seeing both forms in the ESIP recommendations examples, and I want to know if there is a "more correct" version:
vs.
|
The first is valid for JSON-LD 1.0 If you are working at this point forward, you should be using the map, the second one. |
We probably should update all of our examples to use the recommended form. |
@datadavev I get your point.. that is only true in the context (no pun intended) that you view the document as a JSON-LD 1.1 document in both cases, correct? I need to revisit now why I had processing errors in 1.1 mode with the previous approach when, as you point out, it seems a valid 1.1 pattern for remote context. (though that seems very poorly worded in the docs.. since all the contexts are typically web resolved in principle) oddly there is
which seems at odds with the remote context reference https://www.w3.org/TR/json-ld11/#example-5-referencing-a-json-ld-context Have you had the previous (un-mapped version) fail in a forced 1.1 process? I have. |
@datadavev Is it just me or the docs say... "a context MUST be a map, except when it's not a map and then it is a remote context, though you can use @import for a remote context too, to make the context a map.... oh .. and any context you provide that isn't relative, is pulled remotely based on the IRI you provide" (this seems even more fun to read if you do it in an English accent) ;) that seems less than wonderful :) |
it is messy, and further complicated by the opacity of what can go on behind the scenes when retrieving a remote context 1. If the value of In this case:
the contents of the document retrieved by following the rules for JSON-LD retrieval becomes the context. That URL resolves to the JSON-LD:
That JSON-LD is processed like:
and so expands like:
On the other hand, if the value of
The context is exactly as written, and the document expands to:
Footnotes
|
Your post above really needs to go into the docs and It's more clear the JSON-LD docs IMHO. I do follow what you are saying and based on that I think I have a bug report to make up for a JSON-LD lib I use. :) |
Just to clarify all of this, I think our recommendations have shifted but we have not updated our documentation. Now that schema.org has clarified that the true namespace is
{
"@context": {
"@vocab": "http://schema.org/"
},
"@type": "Dataset",
"author": {
"@type": "Person",
"name": "Jane Goodall"
}
}
{
"@context": "http://schema.org/",
"@type": "Dataset",
"author": {
"@type": "Person",
"name": "Jane Goodall"
}
} OR {
"@context": "https://schema.org/",
"@type": "Dataset",
"author": {
"@type": "Person",
"name": "Jane Goodall"
}
}
{
"@context": {
"@vocab": "https://schema.org/"
},
"@type": "Dataset",
"author": {
"@type": "Person",
"name": "Jane Goodall"
}
} If this is right, we need to updated all docs, guidelines, examples, and shacl rules. |
Started branch feature_151_context_namespace for fixing the namespace context consistency issues. More changes needed before we have a consistent set of guides. |
(1) has the effect of setting the default vocabulary. (2) has the effect of including the context statements defined in the referenced context document. Effectively (1) replaces the document https://schema.org/docs/jsonldcontext.jsonld with the document:
Hence, the general recommendation would be (2). |
@mbjones in your recent post it says "schema.org has clarified that the true namespace is http://schema.org", but in the examples |
For reference, the |
the @vocab there is http://schema.org/, there's my answer. Thanks! |
Thanks for the clarifications, and yes, I should have said |
So, if the preference is for option 2, in our full example, how do we define the additional namespaces we need? Right now, on the branch I have the "@context": {
"@vocab": "http://schema.org/",
"prov": "http://www.w3.org/ns/prov#",
"provone": "http://purl.dataone.org/provone/2015/01/15/ontology#",
"spdx": "http://spdx.org/rdf/terms#"
} Should the guidance be that we recommend option 2, except for when people need to define additional namespace prefixes? |
[edit: use https for schema.org retrieval] |
So to be clear the schema.org FAQ at https://schema.org/docs/faq.html#19 is now wrong? Schema.org is saying to use http? Also the developer section at https://schema.org/docs/developers.html shows there are multiple context files for the various namespace approaches. Yet our recommendation is to stick with the old http pattern? |
I think the FAQ is a bit misleading. The namespace is However, just to confuse things more, there are http and https variants of the vocabulary! |
That's what I mean.. the multiple vocab elements. I understand all of this. and I appreciate that currently the https file call returns http namespaced file (which I don't agree with) :) this just worries me... it's a kicking the can down the road event IMHO. agree to disagree I guess |
Adding to the confusion, some libraries, e.g. RDFLib internally define constants for common namespaces, and it is using |
The libraries are going to be a pain.. major pain.. you can't curl negotiate at https://schema.org for the context. |
Right, there's a different set of rules beyond simple content negotiation1 for finding the context - need to look at the response link header:
This is also something that is poorly implemented in the major libs (pyld and rdflib at least). I use a patched version of pyld to get around this issue and honor the json-ld processing rules in the spec. Footnotes |
right.. curl -v https://schema.org
...
link: </docs/jsonldcontext.jsonld>; rel="alternate"; type="application/ld+json"
... and I get it.. (literal and figurative) ;) As you point out though the issues with the python libraries (same as in the Go libraries by the way).. I'm not trying to change any minds. It sounds like it is already a done deal. I just have to resolve how to connect the other groups I work who are https focused now with SOS which will be http focused. |
I don't think it's a done deal if @fils and @datadavev aren't on board -- you two have more practical experience with this than anyone I know. I am just trying to clean up our recs and be consistent. And I don;'t have a strong opinion myself -- I agree the future is https, but thought SO had decided to stick with http in their context doc. If there is a straightforward way for us to recommend https where most libs and the shacl processor, etc would recognize the terms as SO properly, then that has advantages. But given that https://schema.org/ returns a JSON-LD context with the http namespace, it seems like they are still using http. Please, propose what you think we should do, and how providers and consumers should handle it. |
You are correct there.. their default is to return the http namesapce even though they are rather indecisive elsewhere in their documentation. The result of that unfortunately is they seed confusion and delay (cue Thomas the Tank Engine) in the library developers and elsewhere. :) |
Science-on-schema.org is about recommendations for application of
Where:
Implementors should be aware that this may change in the future (i.e. "http" -> "https") and that existing implementations may internally use " Footnotes |
+1 on Recommending namespace normalization. Dealing with the two namespaces has been an ongoing challenge with metadata integration in EarthCube GeoCodes, requiring messy SPARQL queries. |
OK, summarizing... going with Dave's examples, I'll write up a plan to recommend using the {
"@context": [
"https://schema.org/",
{
"prov": "http://www.w3.org/ns/prov#",
"provone": "http://purl.dataone.org/provone/2015/01/15/ontology#",
"spdx": "http://spdx.org/rdf/terms#"
}
],
"@type": "Dataset",
"name": "Test data",
"prov:wasDerivedFrom": {
"@id": "https://doi.org/10.xxxx/Dataset-1"
}
} |
Work on branch feature_151_context_namespace:
|
Feature 151 context namespace. Note that, while this PR is being merged to develop now to keep things clean because of the extent of changes, comments are still welcome on issue #151 . If no changes are deemed necessary, this PR will be released with v 1.3.
Checked that shapes all validate with the namespace changes on our example files, and merged PR #199. This issue will remain open for commentary for a bit longer, but the planned changes are now merged into |
Reviewed at meeting on 7 Feb 2022 -- agreed it was complete, but reopen this issue if discrepancies are found. |
So I have been running into this with @smrgeoinfo and I saw it in the example by @datadavev
Using Dave's example of
If you place this in the JSON-LD playground link you will see it expands to http, not https
modify the context to a map as
It will expand correctly with https as at https://tinyurl.com/y99kj7d7
reference https://www.w3.org/TR/json-ld/#context-definitions
specifically:
It would appear that we need to make sure examples and recommendations (at least if we want JSON-LD 1.1, which I suspect this is part of) must be maps.
I've been running into this issue in some of my development work....
Comments and observations welcome..
The text was updated successfully, but these errors were encountered: