Re: @list of @lists usecase: SHACL

Thanks Roman!

In short -- not in JSON-LD 1.0, but we're working on it for 1.1

This is one of the issues that the JSON-LD WG has on its plate to work on.
The list of lists construction is complex, but has a lot of use cases such
as SHACL (as you point out) and also GeoJSON-LD.
The issue: https://github.com/w3c/json-ld-syntax/issues/7

This is a good one to note, as GeoJSON-LD could equally be solved by just
embedding GeoJSON as a single non-semantic value, as per this issue:
https://github.com/w3c/json-ld-syntax/issues/4

Rob


On Mon, Jul 9, 2018 at 11:43 AM, Roman Evstifeev <someuniquename@gmail.com>
wrote:

> ---------- Forwarded message ----------
> From: Roman Evstifeev <someuniquename@gmail.com>
> Date: 9 July 2018 at 21:38
> Subject: @list of @lists usecase: SHACL
> To: public-linked-json-request@w3.org
>
>
> Hello list,
>
> I have recently bumped into an issue with support of nested lists in
> json-ld.
>
> In short, lists of lists are common in SHACL[1] property paths, one
> example already included in the spec appendix shacl-shacl [2], which
> is self-recursive SHACL rules to validate other SHACL graphs. When I
> tried to convert its ttl to json-ld with Rdflib-jsonld [3], i got an
> invalid JSON-LD document:
>
> ### shsh.ttl snippet ###
>
> _:PathPath
>     sh:alternativePath (
>         ( [ sh:zeroOrMorePath rdf:rest ] rdf:first )
>         ...
>     ) .
>
> ###
>
> ### produced shsh.jsonld snippet ###
>
> {
>       "@id": "_:b1",
>       "sh:alternativePath": {
>         "@list": [
>           {
>             "@list": [
>               {
>                 "@id": "_:b2"
>               },
>               {
>                 "@id": "rdf:first"
>               }
>             ]
>           }
>         ]
>       }
>     },
>
> ###
>
> JSON-LD above is invalid because of nested @list declaration,
> processors pyld and playground choke at this input, complaining that
> it is not supported.
>
> Nested lists are easily crafted in SHACL, as sh:alternativePath (
> path1 path2 ) where path1 or path2 is also a list. I think such
> constucts would be quite common in the wild, and quite disappointing
> that JSON-LD has issues with it.
>
> So is there any way to properly support SHACL spec using JSON-LD? My
> goal is to be able to serialize my webserver shapes as JSON-LD and
> serve to clients via http.
>
> [1] Shapes and constraint language spec https://www.w3.org/TR/shacl/
> [2] SHACL Shapes to Validate Shapes Graphs
> https://www.w3.org/TR/shacl/#shacl-shacl
> [3] Rdflib-jsonld https://github.com/RDFLib/rdflib-jsonld
>
>


-- 
Rob Sanderson
Semantic Architect
The Getty Trust
Los Angeles, CA 90049

Received on Monday, 9 July 2018 20:12:32 UTC