Re: SHACL for SHACL

Hi Dimitris,

On 4/04/2017 5:35, Dimitris Kontokostas wrote:
> Another comment
>
> there are also a few recursive shapes that by definition are undefined
>
> shsh:ShapeShape a sh:NodeShape ;
>   sh:property [
>     sh:path sh:node ;
>     sh:node *_shsh:NodeShapeShape_* ; # node-node
>   ] ;
>   sh:property [
>     sh:path ( sh:xone [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
>     sh:node*_shsh:ShapeShape_* ; # xone-members-node
>   ] ;
> sh:property [
> sh:path sh:not ;
> sh:node *_shsh:ShapeShape_* ;       # not-node
> ] ;
> sh:property [
> sh:path ( sh:and [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
> sh:node *_shsh:ShapeShape_* ;       # and-members-node
> ] ;
> sh:property [
> sh:path sh:property ;
> sh:node *_shsh:PropertyShapeShape_* ;    # property-node
> ] ;
> .
>
> shsh:NodeShapeShapea sh:NodeShape ;
> sh:node *_shsh:ShapeShape_* ;
> .
>
> shsh:PropertyShapeShape  a sh:NodeShape ;
>   sh:node *_shsh:ShapeShape_* ;
> .
>
> shsh:PathShape
>   sh:xone (
>
> [ sh:nodeKind sh:BlankNode ;    # 2.3.1.5 <http://2.3.1.5>: 
> Zero-or-more path
>  sh:closed true ;
>  sh:property [
>    sh:path sh:zeroOrMorePath ;
>    sh:node *shsh:PathShape* ; # multiple similar cases in the same shape
>    sh:minCount 1 ;
>    sh:maxCount 1 ;
>  ]
> ]
> [ sh:nodeKind sh:BlankNode ;    # 2.3.1.3 <http://2.3.1.3>: 
> Alternative path
>  sh:closed true ;
>  sh:property [
>    sh:path sh:alternativePath ;
>    sh:node *_shsh:PathListWithAtLeast2Members_* ; # multiple similar 
> cases in the same shape
>    sh:minCount 1 ;
>    sh:maxCount 1 ;
>  ]
> ]
>
> shsh:PathListWithAtLeast2Members
> a sh:NodeShape ;
> sh:node shsh:ListShape ;
> sh:property [
> sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
> sh:node *_shsh:PathShape_* ;
> ] ;

Ok thanks for reminding me of this. I have restructured a few shapes so 
that they avoid recursion and instead use path operations. I would 
appreciate if these change could be reviewed as it is easy to get things 
wrong at this level of complexity - e.g. writing meta-paths to traverse 
SHACL paths.

https://github.com/w3c/data-shapes/commit/0c212df3674924b308223acdfdd78bba6c858eb4

Note that I have avoided recursion by adding sh:targetXY statements, 
e.g. shsh:NodeShapeShape sh:targetObjectsOf sh:node. This work-arounds 
does work in our case, but I don't think this is a general design 
pattern that others can follow to avoid recursion too.

Unfortunately this exercise confirms my long-held belief that the 
current work-around to avoid structural recursion leads to 
unmaintainable and redundant shape definitions. SHACL users will get 
negatively surprised by this. I believe we have made a mistake in SHACL 
by generally making structural recursion undefined. Instead we should 
have made runtime recursion undefined, i.e. the cases in which the same 
node is visited twice. We ended up with the current compromise after 
long long discussions, trying to reconcile a wide spectrum of 
viewpoints, including Peter's preference to completely disallow recursion.

>
>
> On Mon, Apr 3, 2017 at 6:26 PM, Dimitris Kontokostas 
> <kontokostas@informatik.uni-leipzig.de 
> <mailto:kontokostas@informatik.uni-leipzig.de>> wrote:
>
>     Thanks Holger,
>
>     Although I didnĀ“t check the actual shapes in detail I have a
>     couple of comments on some annotations
>     We have the following triple:
>
>         shsh: a owl:Ontology ;
>
>
>     Do we need shsh to be an owl ontology?
>

No, this is not needed. However several tools use the rdf:type 
owl:Ontology triple to find the graph URI if they find a local file. I 
see no costs in keeping the owl:Ontology triple.

>
>     Do we also need to import the SHACL vocabulary?
>
>         shsh: owl:imports sh: ;
>
>     I think we only need a few subclass relations which we could
>     duplicate to make it standalone
>

I think it's a good practice to owl:import the namespace that shapes are 
about. I have not tested whether this owl:import is necessary.

>
>     I am not sure if this is needed as well, we do not have
>     SHACL-SPARQL constraints
>
>         sh:declare [
>         sh:prefix "shsh" ;
>         sh:namespace "http://www.w3.org/ns/shacl-shacl#
>         <http://www.w3.org/ns/shacl-shacl#>" ;
>         ] .
>

These are not needed either, but I believe we should try to establish 
and support a best practice in which each RDF file that defines a 
namespace also declares the prefix in a triple-ized form. This will make 
it easier to avoid clashes in the future and makes prefixes more explicit.

Holger



>
>     On Mon, Apr 3, 2017 at 10:45 AM, Holger Knublauch
>     <holger@topquadrant.com <mailto:holger@topquadrant.com>> wrote:
>
>         Thanks, good catch. Fixed.
>
>         Holger
>
>
>
>         On 3/04/2017 18:34, Olivier Corby wrote:
>
>             Hi,
>
>             On 04/03/2017 04:13 AM, Holger Knublauch wrote:
>
>                 ACTION: Everyone please review the SHACL file above,
>                 and/or try it against shape definitions - we should
>                 sign this off in the Wednesday meeting so that we can
>                 swiftly resubmit the CR request.
>
>
>
>             I think there is a problem with the URIs
>             shsh:PropertyShape and shsh:PropertyShapeShape, they
>             should be the same URI :
>
>
>             sh:property [
>                     sh:path sh:property ;
>                     sh:node shsh:PropertyShape ;    # property-node
>                 ] ;
>
>
>
>             shsh:PropertyShapeShape
>                 a sh:NodeShape ;
>                 sh:targetSubjectsOf sh:path ;
>                 sh:node shsh:ShapeShape ;
>                 sh:property [
>                     sh:path sh:path ;
>                     sh:maxCount 1 ;                 # path-maxCount
>                     sh:minCount 1 ;                 #
>             PropertyShape-path-minCount
>                     sh:node shsh:PathShape ;        # path-node
>                 ] ;
>
>
>             The same problem occurs with shsh:NodeShapeShape and
>             shsh:NodeShape
>
>
>
>             Olivier
>
>
>
>
>
>
>
>
>
>
>     -- 
>     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 Tuesday, 4 April 2017 04:27:41 UTC