Re: In search of value shapes

On the sh:or of sh:path values - you could express them using 
SPARQL-like property paths

     ex:date | ex:birthDate | ex:deathDate

which is formalized in RDF as

sh:path [
     sh:alternativePath ( ex:date ex:birthDate ex:deathDate )
]

See https://www.w3.org/TR/shacl/#property-path-alternative

Having said this, while these patterns will work OK for validation 
purposes, it becomes harder for other tools to make sense of them. For 
example, many people reuse SHACL shapes for UI form definitions, and 
form display engines need to pick the most common patterns, and would 
find it hard to support them all.

Holger


On 20/03/2019 11:38 am, Irene Polikoff wrote:
> Another example of an invalid or rather (using correct terminology) 
> not a “well formed” shape.
>
> Do you ever use SHACL (e.g., https://www.w3.org/ns/shacl-shacl) to 
> make sure the shapes you produce follow the spec?
>
>> On Mar 19, 2019, at 2:40 PM, Gary Murphy <gary@schemaapp.com 
>> <mailto:gary@schemaapp.com>> wrote:
>>
>> just for fun I tried
>>
>> hmshape:DateTimeShape
>>     a sh:PropertyShape ;
>>     sh:or (
>>         [ sh:path ex:date ]
>>         [ sh:path ex:birthDate ]
>>         [ sh:path ex:deathDate ]
>>     );
>>     ...
>>
>> seemed promising, but no, doesn't work ;)
>>
>>
>> On Tue, Mar 19, 2019 at 2:17 PM Gary Murphy <gary@schemaapp.com 
>> <mailto:gary@schemaapp.com>> wrote:
>>
>>     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
>>     <mailto:gary@schemaapp.com>> - Hunch Manifest, 15 Wyndham N 'C',
>>     Guelph
>>
>>
>>
>> -- 
>> Gary Lawrence Murphy <gary@schemaapp.com <mailto:gary@schemaapp.com>> 
>> - Hunch Manifest, 15 Wyndham N 'C', Guelph
>

Received on Wednesday, 20 March 2019 02:08:56 UTC