Dear all, I'm trying to export the result of a CONSTRUCT in JSON format, but the output seems unexpected. I'm using Fuseki 1.0.2 I've come up with a simple example to try and explain my problem.
Here's the test set: CREATE GRAPH <http://test/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.org/> INSERT DATA { GRAPH <http://test/> { <ex:i1> ex:items [ ex:item "item 1"; ex:item "item 2"; ex:subitems [ ex:item "subitem 1"; ex:item "subitem 2"; ] ]. } } Here's the CONSTRUCT query : PREFIX ex: <http://example.org/> CONSTRUCT { ?i ex:items ?items. ?items ex:item ?item. ?items ex:subitems ?subitems. ?subitems ex:item ?subitem. } WHERE { GRAPH <http://test/> { ?i ex:items ?items. ?items ex:item ?item. OPTIONAL { ?items ex:subitems ?subitems. ?subitems ex:item ?subitem. } } } When running it in Fuseki's web interface and asking for plain text, here's the answer: <ex:i1> ex:items [ ex:item "item 1" , "item 2" ; ex:subitems [ ex:item "subitem 1" , "subitem 2" ] ] . The response looks fine to me, except the extra "ex:item" in the list of subitems but since it's a made up example, I didn't take time to investigate (maybe it's a bu, since the XML output doesnt include this item?). I've also tried to ask for XML as an oututput and the result correspond, except the extra ex:item is not present: <rdf:Description rdf:about="ex:i1"> <ex:items rdf:parseType="Resource"> <ex:item>item 1</ex:item> <ex:subitems rdf:parseType="Resource"> <ex:item>subitem 1</ex:item> <ex:item>subitem 2</ex:item> </ex:subitems> <ex:item>item 2</ex:item> </ex:items> </rdf:Description> Now, when asking for JSON, the result is not structured the same way: instead of receiving a tree-like structure such as the previous one, the subitems are in separate entities instead of being nested. Plus, the names of the blank nodes, often called "b0" "b1" and so on, have funny names. The output is below, since it takes a lot of space. Is the result I get the intended output? Can I do something to have nested structures that look like the the XML ouput? Best regards, Julien Nauroy JSON output: { "_:-6abd5fb1:144791bd785:fcc" : { "http://example.org/item" : [ { "type" : "literal" , "value" : "item 1" } , { "type" : "literal" , "value" : "item 2" } ] , "http://example.org/subitems" : [ { "type" : "bnode" , "value" : "_:-6abd5fb1:144791bd785:fcd" } ] } , "ex:i1" : { "http://example.org/items" : [ { "type" : "bnode" , "value" : "_:-6abd5fb1:144791bd785:fcc" } ] } , "_:-6abd5fb1:144791bd785:fcd" : { "http://example.org/item" : [ { "type" : "literal" , "value" : "subitem 1" } , { "type" : "literal" , "value" : "subitem 2" } ] } }
