W3C home > Mailing lists > Public > public-rdf-shapes@w3.org > September 2016

more on recursion [was Re: fun with sh:hasShape]

From: Peter F. Patel-Schneider <pfpschneider@gmail.com>
Date: Tue, 27 Sep 2016 04:51:56 -0700
To: Dimitris Kontokostas <kontokostas@informatik.uni-leipzig.de>
Cc: "public-rdf-shapes@w3.org" <public-rdf-shapes@w3.org>
Message-ID: <dad0c90f-ce36-bb1a-ea72-f9c338abbdd6@gmail.com>
I don't think that that the new wording is adequate.

"A recursive shape is a shape thar refers to itself directly or transitively
via shape-based constraint components (i.e. sh:shape), logical constraint
components (i.e. sh:or), filter shapes (sh:filterShape) or the sh:hasShape
SPARQL function as defined in appendix A. The handling of recursive shapes is
not defined in SHACL and is left to SHACL processor implementations."

s:s1 doesn't refer to itself.  Instead, the validation of s:s1 on ex:foo5 ends
up having the determination of whether a violation should be reported
depending on whether a violation should be reported, even though there is no
path from s:s1 back to itself in the shapes graph.  Different wording is
needed to describe this newly-detected problem with sh:hasShape.

The wording also continues to not distinguish between

ex:sr rdf:type sh:Shape ;
  sh:class ex:c ;
  sh:property [ rdf:type sh:ProperyConstraint;
                sh:predicate ex:p ; sh:shape ex:sr ] .

and

ex:sr rdf:type sh:Shape ;
  ex:class ex:c ;
  rdfs:seeAlso [ rdf:type sh:ProperyConstraint;
                 sh:predicate ex:p ; sh:shape ex:sr ] .



There needs to be a better definition of what counts as a recursive shape in
SHACL.


Peter F. Patel-Schneider
Nuance Communications




On 09/27/2016 12:44 AM, Dimitris Kontokostas wrote:
> As with other types of recursion, this is also unspecified in the spec
> 
> I placed the sh:hasShape function in the recursive shape list
> https://github.com/w3c/data-shapes/commit/52396ff9014e055a6332c28516ac0574fb3c3211
> 
> On Mon, Sep 26, 2016 at 10:01 PM, Peter F. Patel-Schneider
> <pfpschneider@gmail.com <mailto:pfpschneider@gmail.com>> wrote:
> 
>     What happens here?  Why?  Is what happens reasonable?
> 
> 
>     Data graph
> 
>     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
>     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>> .
>     @prefix sh:  <http://www.w3.org/ns/shacl#> .
>     @prefix ex:  <http://example.org/ex/> .
>     @prefix s:   <http://example.org/s/> .
> 
>     ex:foo1 rdf:type ex:foo ;
>             rdf:type ex:bar ;
>       s:shape s:bar .
> 
>     ex:foo2 rdf:type ex:foo ;
>             rdf:type ex:baz ;
>       s:shape s:bar .
> 
>     ex:foo3 rdf:type ex:foo ;
>             rdf:type ex:baz ;
>       s:shape s:baz .
> 
>     ex:foo4 rdf:type ex:foo ;
>             rdf:type ex:baz ;
>       s:shape s:s0 .
> 
>     ex:foo5 rdf:type ex:foo ;
>             rdf:type ex:baz ;
>       s:shape s:s1 .
> 
>     ex:foon1 rdf:type ex:foon ;
>             rdf:type ex:baz ;
>       s:shape s:s2 .
> 
> 
> 
>     Shapes graph
> 
>     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
>     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>> .
>     @prefix sh:  <http://www.w3.org/ns/shacl#> .
>     @prefix ex:  <http://example.org/ex/> .
>     @prefix s:   <http://example.org/s/> .
> 
>     s:s1 rdf:type sh:Shape ;
>       sh:targetClass ex:foo ;
>       sh:sparql [
>         sh:select
>           """SELECT $this WHERE {
>             $this s:shape ?shape ;
>             BIND (sh:hasShape($this,?shape,$shapesGraph) AS ?hasShape)
>             BIND (!bound(?hasShape) AS ?failure )
>             FILTER (?failure || !?hasShape) }""" ] .
> 
>     s:bar sh:class ex:bar .
> 
>     s:baz sh:class ex:baz .
> 
>     s:s2 rdf:type sh:Shape ;
>       sh:targetClass ex:foon ;
>       sh:sparql [
>         sh:select
>           """SELECT $this WHERE {
>             $this s:shape ?shape ;
>             BIND (sh:hasShape($this,?shape,$shapesGraph) AS ?hasShape)
>             BIND (!bound(?hasShape) AS ?failure )
>             FILTER (?failure || ?hasShape) }""" ] .
> 
> 
>     Peter F. Patel-Schneider
>     Nuance Communications
> 
> 
> 
> 
> -- 
> Dimitris Kontokostas
> Department of Computer Science, University of Leipzig & DBpedia Association
> Projects: http://dbpedia.org, http://rdfunit.aksw.org, http://aligned-project.eu
> Homepage: http://aksw.org/DimitrisKontokostas
> Research Group: AKSW/KILT http://aksw.org/Groups/KILT
> 
Received on Tuesday, 27 September 2016 11:52:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:44 UTC