Fwd: @list of @lists usecase: SHACL

---------- 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

Received on Monday, 9 July 2018 18:43:39 UTC