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

It does appear that now the only way for the validation of one shape to
initiate validation of another shape is via the about six constraint
components that take shapes as parameter values.  This means no more filter
shapes.  It also means that there is no way that SPARQL-based SHACL constructs
can initiate processing of another shape.  This further means that the core
SHACL constructs provide facilities that cannot be obtained through the SPARQL
extension.

In this considerably-changed SHACL the wording appears to be getting close to
the intent of recursive shapes, i.e., that a recursive shape points back to
itself via a chain of triples whose predicates are each sh:property or one of
the shape-expecting constraint parameters.  However, I do not think that the
wording is yet adequate.  Something along the following lines is required:

"A shape *directly uses* another shape when that other shape is the value of a
shape-expecting constraint parameter of the shape itself or one of the
property constraints of the shape.  The *uses* relationship between shapes is
the transitive closure of the directly uses relationship.  A shape is
*recursive* if it uses itself."

The handling of recursive shapes is also problematic as it appears that a
SHACL processor is supposed to do something useful with recursive shapes.  The
wording should be expanded to allow SHACL processors to refuse to do anything
with recursive shapes, i.e., by producing some sort of error during syntactic
checking of shapes.


Another problem with the current wording is that it permits parameters like
sh:minCount to contribute to recursive shape determination.

peter


On 11/21/2016 02:10 AM, Dimitris Kontokostas wrote:
> Dear Peter,
> 
> Could you please check if you have further comments on the definition of
> recursive shapes?
> http://w3c.github.io/data-shapes/shacl/#shapes-recursion
> 
> Best regards,
> Dimitris
> 
> On Tue, Sep 27, 2016 at 1:51 PM, Peter F. Patel-Schneider
> <pfpschneider@gmail.com <mailto:pfpschneider@gmail.com>> wrote:
> 
>     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
>     <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>
>     <mailto: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#>
>     >     <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#>
>     >     <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 <http://aksw.org/DimitrisKontokostas>
>     > Research Group: AKSW/KILT http://aksw.org/Groups/KILT
>     >
> 
> 
> 
> 
> -- 
> 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 Monday, 21 November 2016 14:58:46 UTC