Re: shapes-ISSUE-41 (property paths (sh:path?)): Using property paths to refer to values/types? [SHACL Spec]

On 4/7/2015 18:27, RDF Data Shapes Working Group Issue Tracker wrote:
> shapes-ISSUE-41 (property paths (sh:path?)): Using property paths to refer to values/types? [SHACL Spec]
>
> http://www.w3.org/2014/data-shapes/track/issues/41
>
> Raised by: Simon Steyskal
> On product: SHACL Spec
>
> Hi!
>
> Do we (want to) support property paths for referring to other values/types?
>
> Consider e.g. a concept ex:Track with two properties ex:kmLeft and ex:kmRight and I want to state, that ex:kmLeft must have a value > than the value of ex:kmRight. How could I achieve that in SHACL?
>
> ex:Track a rdfs:Class;
>    sh:property [
>      sh:predicate ex:kmLeft;
>      sh:minExclusive (path to ex:kmRight's value);
>    ] .
>
> Probably, I could use a sh:Function to retrieve the respective ex:kmRight value? ->
>
> ex:Track a rdfs:Class;
>    sh:property [
>      sh:predicate ex:kmLeft;
>      sh:minExclusive ex:kmRightValue;
>    ] .
>
> ex:kmRightValue a sh:Function;
>    sh:returnType xsd:integer;
>    sh:argument [
>      sh:predicate sh:arg1 ;
>      sh:valueType ex:Track;
>    ];
>    sh:sparql """
>      SELECT (?value AS ?result)
>        WHERE {
>           ?arg1 ex:kmRight ?value .
>        }
>    """ .
>
> Should that be the "proposed best practice"?

I think the "core vocabulary" should remain as simple as possible while 
addressing a good chunk of use cases. Path expressions would make it too 
hard for many tools (such as UI form builders) to make sense of SHACL 
models. Your specific scenario is easily represented either as a SPARQL 
constraint or generalized into a template that uses a SPARQL query. In 
fact we have exactly that template in SPIN, which would accordingly be 
written in SHACL such as:

ex:Track a rdfs:Class;
   sh:constraint [
     a my:LessThanOtherPropertyConstraint ;
     my:property sh:kmLeft ;
     my:otherProperty sh:kmRight ;
   ] .


I am pretty certain that a library of such templates would emerge soon, 
without us necessarily having to do anything.

>
> simon
>
> (In Section [1.3] there is still a reference to a property called sh:path which seems to be outdated?)
>
> [1.3] http://w3c.github.io/data-shapes/shacl/#introduction-overview-advanced

Thanks, that example is fixed now.

Holger

Received on Tuesday, 7 April 2015 08:59:38 UTC