- From: Peter F. Patel-Schneider <pfpschneider@gmail.com>
- Date: Thu, 24 Mar 2016 07:20:32 -0700
- To: Simon Steyskal <simon.steyskal@wu.ac.at>
- Cc: RDF Data Shapes Working Group <public-data-shapes-wg@w3.org>
I'm not sure that "working" means. My implementation handles paths so it is
working with them.
If you mean a SHACL shape that uses paths, here is a shape for at least three
grandchildren
threegc a sh:Shape ;
sh:propValues ( ( ex:child ex:child ) [ a sh:Shape ; sh:minCount 3 ] ) .
I do not believe that the current core SHACL can do this at all.
peter
On 03/23/2016 11:19 PM, Simon Steyskal wrote:
> Hi!
>
>> I had thought that implementing paths for SHACL would be hard, with lots of
>> changes required. It turned out to be not nearly as hard as I expected in my
>> implementation.
>
> I'm very happy to hear that!
>
> Could you provide a minimal working example using paths?
>
> regards,
> simon
>
> ---
> DDipl.-Ing. Simon Steyskal
> Institute for Information Business, WU Vienna
>
> www: http://www.steyskal.info/ twitter: @simonsteys
>
> Am 2016-03-23 17:00, schrieb Peter F. Patel-Schneider:
>> I had thought that implementing paths for SHACL would be hard, with lots of
>> changes required. It turned out to be not nearly as hard as I expected in my
>> implementation.
>>
>> The core of the implementation of paths is a function that converts a path
>> (however the syntax is defined) into a string that can be used as a SPARQL
>> path. Then instead of using an IRI as the predicate in triple patterns just
>> use the result of this function. I ended up with nine places where this was
>> needed, two each in sh:equals, sh:notEquals, sh:lessThan, and
>> sh:lessThanOrEquals and one in sh:propValues.
>>
>> There is a little bit more that has to be done if a path is used elsewhere.
>>
>> My conversion function ended up being roughly
>>
>> def parttoSPARQL(g,part) :
>> result = ("^"+g.value(part,SH.inverse).n3()) \
>> if (part,SH.inverse,None) in g else part.n3()
>> return result
>>
>> def pathtoSPARQL(g,value) :
>> if (value,RDF.rest,None) in g :
>> path = [ parttoSPARQL(g,part) for part in listElements(g,value) ]
>> return Literal("/".join(path))
>> else : return parttoSPARQL(g,value)
>>
>>
>> peter
Received on Thursday, 24 March 2016 14:21:02 UTC