-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Labels
Description
From what I gather from the JSON-LD 1.1 specs, there is no problem providing its own @context to a @nested node. Yet, if the parent @context has a conflicting property name, it gets completely ignored in favor of the root vocab:
from pyld import jsonld
import json
JSON = """ {
"@context": {
"dublinCore": {
"@id": "http://foo.bar/dc",
"@context": {
"title": "http://purl.org/dc/terms/title"
}
},
"title": "http://foo.bar/title"
},
"@id": "http://foo.bar/obj/test",
"title": "test",
"dublinCore": {
"title": "Chapter 1: Jonathan Harker's Journal"
}
}"""
doc = json.loads(JSON)
nquads = jsonld.to_rdf(doc, options={'format': 'application/n-quads'})
print(nquads)prints
<http://foo.bar/obj/test> <http://foo.bar/dc> _:b0 .
<http://foo.bar/obj/test> <http://foo.bar/title> "test" .
_:b0 <http://purl.org/dc/terms/title> "Chapter 1: Jonathan Harker's Journal" .
But nested does not care about the vocab
from pyld import jsonld
import json
JSON = """ {
"@context": {
"dublinCore": {
"@id": "@nest",
"@context": {
"title": "http://purl.org/dc/terms/title"
}
},
"title": "http://foo.bar/title"
},
"@id": "http://foo.bar/obj/test",
"title": "test",
"dublinCore": {
"title": "Chapter 1: Jonathan Harker's Journal"
}
}"""
doc = json.loads(JSON)
nquads = jsonld.to_rdf(doc, options={'format': 'application/n-quads'})
print(nquads)and prints
<http://foo.bar/obj/test> <http://foo.bar/title> "Chapter 1: Jonathan Harker's Journal" .
<http://foo.bar/obj/test> <http://foo.bar/title> "test" .
which seems wrong according to the JSON-LD 1.1 specs ?
[Edit: I edited to make the example as light as possible]