- From: Holger Knublauch <holger@topquadrant.com>
- Date: Wed, 8 Feb 2017 21:00:13 +1000
- To: "public-data-shapes-wg@w3.org" <public-data-shapes-wg@w3.org>
You are right that the given JSON-LD snippet is not complete and may
theoretically be misunderstood. So as a minimum we would need to put an
extra warning above this.
Thinking a bit further than this particular snippet, many people who
experiment with JSON-LD have told me that they dislike the "default
rendering" produced by standard exporters. And I agree with them. My
hope here was to be able to demonstrate that JSON-LD can produce a very
readable syntax, and that this syntax may even be processed by tools
that are not necessarily native RDF tools. I would therefore not like to
include a full @context, as this somehow defeats the readability goal.
The ideal solution would be if someone (e.g. this WG) would produce a
de-facto default @context for SHACL. If we had this, we could simply
link to that from the example. Is anybody in the WG sufficiently
experienced with JSON-LD to do a proper job for that? The vocab itself
is now hopefully quite stable so this may be a very worthwhile
initiative to help with SHACL's adoption.
Holger
On 8/02/2017 18:56, Pano Maria wrote:
> 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 11:00:55 UTC