ISSUE-133 several options for syntax simplification and regularization

The proposed change from Dimitris appears to be better than the current
sitaution, but leaves a lot of issues open.   Here are several other options,
including a description of the current situation in SHACL.


Current situation in SHACL:

Different properties link shapes to constraints.  These properties do not
themselves determine what links to traverse.  A constraint can be the object
of triples with only one of the properties as predicate.  Some of the
properties provide a default or sort-of inferred type of of the constraint.
The type (provided or inferred or default) of the constraint alone
determines what links to traverse, if any.  The different kinds of
constraints have to be disjoint.

ex:s0a a sh:Shape ;
 sh:constraint [ a sh:NodeConstraint ;
           sh:nodeKind sh:IRI ] ;
 sh:constraint [ a sh:PropertyConstraint ;
           sh:predicate ex:p ;
    sh:class ex:Person ;
    sh:minCount 3 ;
    sh:maxCount 5 ] ;
 sh:constraint [ a sh:InversePropertyConstraint ;
           sh:predicate ex:p ;
    sh:class ex:Person ;
    sh:minCount 3 ;
    sh:maxCount 5 ] .

ex:s0b a sh:Shape ;
 sh:constraint [ sh:nodeKind sh:IRI ] ;
 sh:constraint [ a sh:PropertyConstraint ;
           sh:predicate ex:p ;
    sh:class ex:Person ;
    sh:minCount 3 ;
    sh:maxCount 5 ] ;
 sh:constraint [ a sh:InversePropertyConstraint ;
           sh:predicate ex:p ;
    sh:class ex:Person ;
    sh:minCount 3 ;
    sh:maxCount 5 ] .

ex:s0c a sh:Shape ;
 sh:constraint [ a sh:NodeConstraint ;
           sh:nodeKind sh:IRI ] ;
 sh:property [ a sh:PropertyConstraint ;
         sh:predicate ex:p ;
         sh:class ex:Person ;
         sh:minCount 3 ;
         sh:maxCount 5 ] ;
 sh:inverseProperty [ a sh:InversePropertyConstraint ;
         sh:predicate ex:p ;
         sh:class ex:Person ;
         sh:minCount 3 ;
         sh:maxCount 5 ] .

ex:s0d a sh:Shape ;
 sh:constraint [ a sh:NodeConstraint ;
           sh:nodeKind sh:IRI ] ;
 sh:property [ sh:predicate ex:p ;
         sh:class ex:Person ;
         sh:minCount 3 ;
         sh:maxCount 5 ] ;
 sh:inverseProperty [ sh:predicate ex:p ;
         sh:class ex:Person ;
         sh:minCount 3 ;
         sh:maxCount 5 ] .

Option 1:

One property links shapes to constraints.  Each constraint needs to be an
instance of one of the three operational constraint classes.  This class
alone determines what links to traverse, if any.  The classes need to be
disjoint.

ex:s1 a sh:Shape ;
 sh:link [ a sh:NodeConstraint ;
     sh:nodeKind sh:IRI ] ;
 sh:link [ a sh:PropertyConstraint ;
     sh:predicate ex:p ;
    sh:class ex:Person ;
     sh:minCount 3 ;
     sh:maxCount 5 ] ;
 sh:link [ a sh:InversePropertyConstraint ;
     sh:predicate ex:p ;
     sh:class ex:Person ;
     sh:minCount 3 ;
     sh:maxCount 5 ] .

Option 2:

One property links shapes to constraint structures.  The structure
determines what links to traverse, if any.  There is no need for
different kinds of constraints.

ex:s2 a sh:Shape ;
 sh:link ( ( ) [ a sh:Constraint ; sh:nodeKind sh:IRI ] ) ;
 sh:link ( ex:p [ a sh:Constraint ;
        sh:class ex:Person ;
        sh:minCount 3 ;
        sh:maxCount 5 ] ) ;
 sh:link ( [sh:inverse ex:p] [ a sh:Constraint ;
                     sh:class ex:Person ;
           sh:minCount 3 ;
           sh:maxCount 5 ] ) .

Option 2a:

One property links shapes to constraints.  The constraints optionally have
an extra property.  The extra property determines whether and how to
traverse links.  There is no need for different kinds of constraints.

ex:s2a a sh:Shape ;
 sh:link [ a sh:Constraint ; sh:nodeKind sh:IRI ] ;
 sh:link [ a sh:Constraint ;
     sh:predicate ex:p ;
     sh:class ex:Person ;
     sh:minCount 3 ;
     sh:maxCount 5 ] ;
 sh:link [ a sh:Constraint ;
     sh:inversePredicate ex:p ;
     sh:class ex:Person ;
     sh:minCount 3 ;
     sh:maxCount 5 ] ) .

Option 3:

One property links shapes to shape structures that operate on (sets of)
property values.  The structure determines what links to traverse.
Everything is a shape.  There is no need for constraints at all.

ex:s3 a sh:Shape ;
 sh:nodeKind sh:IRI ;
 sh:link ( ex:p [ a sh:Shape ;
        sh:class ex:Person ;
        sh:minCount 3 ;
        sh:maxCount 5 ] ) ;
 sh:link ( [ sh:inverse ex:p] [ a sh:Shape ;
                sh:class ex:Person ;
     sh:minCount 3 ;
     sh:maxCount 5 ] ) .

Option 3a:

One property links shapes to shapes that have an extra property.  The extra
property determines what links to traverse.  Everything is a shape.  There
is no need for constraints at all.

ex:s3a a sh:Shape ;
 sh:nodeKind sh:IRI ;
 sh:link [ a sh:Shape ;
     sh:predicate ex:p ;
     sh:class ex:Person ;
     sh:minCount 3 ;
     sh:maxCount 5 ] ;
 sh:link [ a sh:Shape ;
     sh:inversePredicate ex:p ;
     sh:class ex:Person ;
     sh:minCount 3 ;
     sh:maxCount 5 ] .

Option 4:

Different properties link shapes to shape structures depending on what is to
be done.  Everything is a shape.  There is no need for constraints at all.

ex:s4 a sh:Shape ;
 sh:nodeKind sh:IRI ;
 sh:all ( ex:p [ a sh:Shape ; sh:class ex:Person ] ) ;
 sh:atleast ( 3 ex:p ) ;
 sh:atmost ( 5 ex:p ) ;
 sh:all ( [ sh:inverse ex:p ] [ a sh:Shape ; sh:class ex:Person ] ) ;
 sh:atleast ( 3 [ sh:inverse ex:p ] ) ;
 sh:atmost ( 5 [ sh:inverse ex:p ] ) .

Received on Tuesday, 10 May 2016 17:44:21 UTC