- From: Peter Ansell <ansell.peter@gmail.com>
- Date: Wed, 23 Jul 2014 09:28:03 +1000
- To: Andy Seaborne <andy@apache.org>
- Cc: Linked JSON <public-linked-json@w3.org>, "public-rdf-comments@w3.org" <public-rdf-comments@w3.org>
On 22 July 2014 19:21, Andy Seaborne <andy@apache.org> wrote: > We are encountering an issue when converting RDF Datasets to JSON-LD. > > The problem is with blank nodes that are shared between graphs and lists. > > In TriG (yes, this is a synthetic reduced test case that captures a smaller > example that might appear for real): > > --------------------- > # Bnode references across graph and lists > PREFIX : <http://www.example.com/> > PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> > > :G { > # Written in short form it would be: > # :z :q ("cell-A" "cell-B") > # but we want to share the tail ("cell-B") > > :z :q _:z0 . > > _:z0 rdf:first "cell-A" . > _:z0 rdf:rest _:z1 . > > _:z1 rdf:first "cell-B" . > _:z1 rdf:rest rdf:nil . > } > > :G1 { > # This references the tail ("cell-B") > :x :p _:z1 . > } > --------------------- > > The triple in :G1 references into the list in :G. > > But as we understand the conversion algorithm, section 4 only considers each > graph in turn and so does not see the cross graph sharing. > > Is this a correct reading of the spec text? > > Part 4 of the conversion algorithm has > "For each name and graph object in graph map: " > > so 4.3.3.* walks back up the list in one graph only. > > (Conversion generated by jsonld-java : it does not matter if compaction is > applied or not): > --------------- > { > "@graph" : [ { > "@graph" : [ { > "@id" : ":z", > ":q" : { > "@list" : [ "cell-A", "cell-B" ] > } > } ], > "@id" : ":G" > }, { > "@graph" : [ { > "@id" : ":x", > ":p" : { > "@id" : "_:b1" > } > } ], > "@id" : ":G1" > } ], > "@context" : { > "@base" : "http://www.example.com/", > "" : "http://www.example.com/", > "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > } > } > --------------- > > There is no _:b1 in :G to refer to because the algorith generated @list and > its implicit bNodes don't have labels. > This is a different dataset with no shared bNode. > > If it is all the same graph (s/:G1/:G/), the RDF dataset structure is > correctly serialized. > > Andy > Just to add a reference from RDF-1.1 that may be relevant: "Blank nodes can be shared between graphs in an RDF dataset." http://www.w3.org/TR/rdf11-concepts/#section-dataset The RDF dataset to JSON-LD algorithm doesn't seem to allow for that right now. Cheers, Peter
Received on Tuesday, 22 July 2014 23:28:32 UTC