Re: In search of value shapes

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 <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> 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 01:38:27 UTC