science-on-schema.org: context must be a map
So I have been running into this with @smrgeoinfo and I saw it in the example by @datadavev
Using Dave’s example of
{
"@context":"https://schema.org/",
"@type":"Dataset",
"name":"test",
"description": "This is a description of the test. Here's some more words to make it long enough."
}
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
{
"@context": {
"@vocab": "https://schema.org/"
},
"@type": "Dataset",
"name": "test",
"description": "This is a description of the test. Here's some more words to make it long enough."
}
It will expand correctly with https as at https://tinyurl.com/y99kj7d7
reference https://www.w3.org/TR/json-ld/#context-definitions
specifically:
A context definition MUST be a map whose keys MUST be either terms,
compact IRIs, IRIs, or one of the keywords @base,
@import, @language, @propagate, @protected, @type, @version, or @vocab.
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…
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 41 (4 by maintainers)
Commits related to this issue
- Update examples to load context from https. See issue #151. — committed to ESIPFed/science-on-schema.org by mbjones 2 years ago
- Update Getting Started with a new section on specifying the context. See issue #151. — committed to ESIPFed/science-on-schema.org by mbjones 2 years ago
- Update context statements to be consistent with issue #151. — committed to ESIPFed/science-on-schema.org by mbjones 2 years ago
- Make all `context` blocks consistent with #151. — committed to ESIPFed/science-on-schema.org by mbjones 2 years ago
- Merge pull request #199 from ESIPFed/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 exten... — committed to ESIPFed/science-on-schema.org by mbjones 2 years ago
Science-on-schema.org is about recommendations for application of
schema.org
to this domain, and so my impression is this group should not be overriding the specification. Hence, the recommendation here should be to use the namespace as published, which would behttp://schema.org/
. Options for specifying the context then include:Where:
schema.org
and including other namespaces. Note that other remote contexts may also be specified in the list.schema.org
context, but makeshttp://schema.org/
the default namespace for the document.Implementors should be aware that this may change in the future (i.e. “http” -> “https”) and that existing implementations may internally use “
https://schema.org/
” as the namespace (e.g. RDFLib). Hence consumers should probably be applying namespace normalization to schema.org content to ensure consistent interpretation in an RDF processing environment.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
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. 😃
We probably should update all of our examples to use the recommended form.
@bonnland
The first is valid for JSON-LD 1.0
The second for JSON-LD 1.1
If you are working at this point forward, you should be using the map, the second one.