Re: SHACL syntax and metamodel complexity

[This is a repeat of a previous message.  It now includes SHACL RDF syntax
for the examples.]


SHACL states property constraints in the following way

     for the values of property ex:p
     the special values must all belong to shape ex:s,
     there must be at least one,
     there must be at least five special values,
     they must all be either ex:a, ex:b, ex:c, ex:d, ex:e, ex:f, ex:d, ex:h,
       ex:i, or ex:j,
     there must be at most ten,
     the identifiers used for them must match regular expression r,
     they must all belong to class ex:c, and
     there must be at most seven special values.

in the current SHACL RDF syntax this is

     [ a sh:propertyConstraint ;
       sh:predicate ex:p ;
       sh:qualifiedValueShape ex:s ;
       sh:minCount 1 ;
       sh:qualifiedMinCount 5;
       sh:in ( ex:a ex:b ex:c ex:d ex:f ex:d ex:h ) ;
       sh:maxCount 10;
       sh:pattern r ;
       sh:class ex:c ;
       sh:qualifiedMaxCount 5 ]

but not in the following way

     for the values of property ex:p
     there must be at least one,
     they must all belong to class ex:c,
     there must be at most five,
     they must all belong to class ex:d, and
     there must be at least three.

in a simple extension of the current SHACL RDF syntax this would be

     [ a sh:propertyConstraint ;
       sh:predicate ex:p ;
       sh:minCount 1 ;
       sh:class ex:c ;
       sh:maxCount 5 ;
       sh:class ex:d ;
       sh:minCount 3 ]


In my opinion, these features of the SHACL RDF syntax are contributing to
the complexity of the SHACL metamodel and to the number of decisions that
have to be made to construct the SHACL metamodel.


If SHACL stated constraints in the following way

     there must be at least one value of property ex:p,
     all the values of property ex:p must belong to class ex:c,
     there must be at most five values of property ex:p,
     all the values of property ex:p must belong to class ex:d, and
     there must be at least three values of property ex:p.

in an extension of the SHACL RDF syntax this could be something like

   [ sh:and
     ( [ a sh:minCountConstraint ;
         sh:predicate ex:p ;
         sh:minCount 1 ] )
     ( [ a sh:classConstraint ;
         sh:predicate ex:p ;
         sh:class ex:c ] )
     ( [ a sh:maxCountConstraint ;
         sh:predicate ex:p ;
         sh:maxCount 5 ] )
     ( [ a sh:classConstraint ;
         sh:predicate ex:p ;
         sh:class ex:d ] )
     ( [ a sh:minCountConstraint ;
         sh:predicate ex:p ;
         sh:minCount 3 ] ) ]

then the the metamodel for SHACL constraints could have just particular
constraints (from the clauses above and other constraint constructs).  This
would be a significant simplification of the metamodel.


Even if SHACL permitted the second construction above and uniformly stated
multi-part particular constraints as at the end of the following there might
be significant simplifications of the metamodel

     for the values of property ex:p
     there must be at least one,
     they must all be either ex:a, ex:b, ex:c, ex:d, ex:e, ex:f, ex:d, ex:h,
       ex:i, or ex:j,
     there must be at most ten,
     the identifiers used for them must match regular expression r,
     they must all belong to class ex:c, and
     there must be at between five and seven values that belong to shape ex:s.

in an extension of the SHACL RDF syntax this might be

     [ a sh:propertyConstraint ;
       sh:predicate ex:p ;
       sh:minCount 1 ;
       sh:in ( ex:a ex:b ex:c ex:d ex:f ex:d ex:h ) ;
       sh:maxCount 10;
       sh:pattern r ;
       sh:class ex:c ;
       sh:qualifiedConstraint [
          sh:qualifiedValueShape ex:s ;
    sh:minCount 5;
    sh:maxCount 5 ] ]


These simplifications would require changes to the RDF syntax of SHACL.

peter

Received on Tuesday, 1 March 2016 18:12:08 UTC