Closed Javingka closed 3 years ago
In RDF, the identifier of a blank node conveys no meaning, and the JSON-LD algorithms normatively rename blank nodes, to prevent collisions. The semantics are the same, in-spite of the renaming of the blank node identifiers.
You'll find that blank node identifiers are renamed as part of the Flattening algorithm.
Hi! Just leaving here a way I found to actually keep the Graphs Names when parsing to for example N-Quads.
I took off the claim
property from within the @context
and leave the graph definition on the JSON root level, as a blank node _:b0
holding an object with two properties @id
and @graph
, like this:
{
"@context": {
"@version": 1.1,
"generatedAt": {
"@id": "http://www.w3.org/ns/prov#generatedAtTime",
"@type": "http://www.w3.org/2001/XMLSchema#date"
},
"Person": "http://xmlns.com/foaf/0.1/Person",
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"generatedAt": "2012-04-09",
"_:b0":{
"@id": "https://w3id.org/credentials#claim",
"@graph":[
{
"@id": "http://manu.sporny.org/about#manu",
"@type": "Person",
"name": "Manu Sporny",
"knows": "http://greggkellogg.net/foaf#me"
}, {
"@id": "http://greggkellogg.net/foaf#me",
"@type": "Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/about#manu"
}
]
}
}
doing so I got it right, nquad parse result:
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <https://w3id.org/credentials#claim> .
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "http://manu.sporny.org/about#manu" <https://w3id.org/credentials#claim> .
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" <https://w3id.org/credentials#claim> .
<http://manu.sporny.org/about#manu> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <https://w3id.org/credentials#claim> .
<http://manu.sporny.org/about#manu> <http://xmlns.com/foaf/0.1/knows> "http://greggkellogg.net/foaf#me" <https://w3id.org/credentials#claim> .
<http://manu.sporny.org/about#manu> <http://xmlns.com/foaf/0.1/name> "Manu Sporny" <https://w3id.org/credentials#claim> .
_:b0 <http://www.w3.org/ns/prov#generatedAtTime> "2012-04-09"^^<http://www.w3.org/2001/XMLSchema#date> .
FYI @pchampin @gkellogg
It is simply re-generating the same blank node identifiers. Blank node identifiers are issued in sequence, starting from "_:b0", based on the sorted order from flatting. If you create a document using the same ordering, it will be reproduced.
Hi guys, here is the thing:
If you take the following JSON-LD from the Documentation
Paste it into the Playground and parse it into the N-Quads, what I do expect to see is the NamedGraph actually named to
_:claim
the way the Doc explains, but instead you see anonymous graphs :b1 and :b2 like this:Is that right and I'm lost about something, or it is a parsing bug?
Thanks.