In search of value shapes

Seeking some guidance with a frequent pattern:  I have several properties
which are all constrained to xsd:dateTime or xsd:string with a regex for
ISO dates, but each of these properties also has other constraints such as
maxCount = 1

So for a familiar example, in Person, for birthDate, I have these
alternatives in sh:or clauses, plus I have the maxCount and the sh:lessThan
deathDate rules, but when the data value is the wrong type, the violation
takes the sh:message for the entire test, reporting only that the
sh:OrConstraintComponent was violated and then a second violation for
sh:LessThanConstraintComponent.

I can of course split these into successive sh:property rules for the same
sh:path and each with it's own sh:message, but the same datatype
constraints apply also to deathDate and every other date value in my
graph.  I'd far prefer to define the rules for all date-like paths in one
place.

Is it possible to define a generic "value shape" where the rules are
applied to the current path rather than to a path defined in the shape
itself?

something like

myshape:DateShape a sh:PropertyShape ;
            [ sh:datatype xsd:dateTime ]
            [ sh:datatype xsd:date ]
            [ sh:datatype xsd:string ;
              sh:pattern
               "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[0-9.+-Z]*$" ;
            ]
            ) ;
    sh:name "dateTime" ;
    gist:start "2017-12-18T17:00:00Z"^^xsd:dateTime ;
    sh:message "Date must be xsd:date xsd:dateTime or string in ISO format,
eg 2018-12-18T12:00:00.000+0500" .

myshape:PersonShape a sh:NodeShape ;
   sh:property [
       sh:path ex:birthDate ;
       sh:??? myshape:DateShape ;    # can this be done?
       sh:lessThan ex:deathDate ;
       sh:message "Birth date must be before death date unless time travel
is possible" .

Is there any mechanism in shacl to apply a path-agnostic shape?
-- 
Gary Lawrence Murphy <gary@schemaapp.com> - Hunch Manifest, 15 Wyndham N
'C', Guelph

Received on Tuesday, 19 March 2019 18:17:44 UTC