Re: Added a JSON-LD example

The example indeed looks good when the appropriate @context is
provided. I assume you don't want to add an @context to the example
because we don't provide the namespace prefixes in each turtle example
either.

The only potential problem I see is for those that are using JSON-LD
(e.g. in APIs) but don't know RDF and could apply a seemingly
plausible @context which can lead to unexpected results. The fact that
someone asked how SHACL looks in JSON-LD tells me they either haven't
looked at the SHACL RDF vocabulary or don't know RDF. But the
resulting RDF in JSON-LD can vary a lot based on the @context. So it
might be safer to add an appropriate @context to this example.

For example the RDF in this possibly appropriate @context
http://tinyurl.com/jrgj6t3
is quite different from the one represented by the not so appropriate
@context  http://tinyurl.com/hazbtyy.

Kind regards,
Pano

On Tue, Feb 7, 2017 at 7:27 AM, Holger Knublauch <holger@topquadrant.com> wrote:
> I was asked via a private email whether we could provide some example of how
> SHACL could look in JSON-LD. So I have added the following snippet to the
> SHACL Example in section 1.4. I have tested that it can be parsed, assuming
> a suitable @context exists.
>
> Does anyone see problems with this addition?
>
> Thanks
> Holger
>
>
> {
>     "@id" : "ex:PersonShape",
>     "@type" : "NodeShape",
>     "targetClass" : "ex:Person",
>     "property" : [
>         {
>             "path" : "ex:ssn",
>             "maxCount" : 1,
>             "datatype" : "xsd:string" ,
>             "pattern" : "^\\d{3}-\\d{2}-\\d{4}$"
>         },
>         {
>             "path" : "ex:child",
>             "class" : "ex:Person",
>             "nodeKind" : "sh:IRI"
>         },
>         {
>             "comment" : "A person's parents are represented via ex:child
> used in the inverse direction." ,
>             "path" : { "inversePath" : "ex:child" },
>             "name" : "parent",
>             "maxCount" : 2
>         }
>     ],
>     "closed" : true,
>     "ignoredProperties" : [ "rdf:type" ]
> }
>

Received on Wednesday, 8 February 2017 08:57:44 UTC