On Tue, 2017-05-09 at 18:32 +0000, Dimov, Stefan wrote:
> I’m also interested in having nested JSON results …
> S.
> 
> On 5/8/17, 11:06 PM, "Laura Morales" <[email protected]> wrote:
> 
>     > I may have time to test if the change in this pull request [1] could 
> create such response. Feel free to comment there should you have any 
> suggestion, or if you could help testing it.
>         I'd love to help testing this feature, although I haven't used Java 
> in years so I'm not 100% sure what's the best way to test this. I guess I'll 
> simply recompile the whole package and submit queries.
>     
>     Btw, I just realized that using "<person-1>" in my example (previous 
> email) might have been a bit misleading. What I was trying to show was the 
> results of a query to "retrieve people, the books they've read, and for each 
> book title/author/characters".
>     Roughly speaking my idea is that of traversing the graph starting from 
> some node, and return some properties for selected nodes along the way. If 
> this makes sense. This doesn't seem to be possible right now, at least not 
> with Jena/SPARQL since all results are flattened into a plain list. I hope 
> something can be done for this, because it would be extremely cool and 
> extremely useful as well :)
>     

I'm not sure I completely understand the use case that this approach is
trying to address. But at best, it looks like a nonstandard,
application-specific shortcut to produce something like a table with
subrows.

Yes, if you want JSON it's simpler than JSON-LD and richer than the JSON
sparql-results serialization. But I think you will find with non-trivial
datasets you will miss the RDFness (or graphiness, if you will) of
JSON-LD. The main problem is there is no notion of object identity and
referencing, so you will have duplicate objects throughout the dataset.
If the only reason you want nested JSON is for easier display, that's
OK, but then I wonder why you would want to use RDF at all.

A semantic-oriented approach to this problem awaits standardization of a
general-purpose graph transformation language, to do for RDF graphs what
XSLT does for XML. The RDF Shapes movement (SHACL [1], ShEx [2]) might
be a step in this direction.

Regards,
--Paul

[1] https://www.w3.org/TR/shacl/
[2] https://www.w3.org/2001/sw/wiki/ShEx


Reply via email to