Re: Regex quirk of the Playground

Oops -- never mind ;) turned out I had defined the rule differently
elsewhere ;)

On Mon, Jan 21, 2019 at 4:26 PM Gary Murphy <gary@schemaapp.com> wrote:

> Apologies if this is a naive question, but I've been having some
> difficulty with the shacl sh:pattern operator; I was working on a rule to
> allow the various types for schema:ImageObject width and height values and
> had tried the following property rules in my shape:
>
>     sh:property [
>         sh:path schema:width ;
>         sh:or (
>             [ sh:class schema:QuantitativeValue ]
>             [ sh:datatype xsd:integer ]
>             [ sh:datatype xsd:string ;
>                 sh:pattern "^\\d+\\.?\\d*.*" ]
>             ) ;
>         ] ;
>     ] .
>
> Then using this test data:
> ex:BobsPix
>   a schema:ImageObject ;
>   schema:url "http://bob.pmx" ;
>   schema:height "600"^^xsd:string;
>   schema:width "600 ft"^^xsd:string ;
> .
>
> In shacl.org/playground, this fails to match the string "600" (with or
> without the ^^xsd:string); it will match the string "600.0" and if I
> replace the '?' with '*' it will accept "600", but then also accepts
> "600..0".
>
> Neither version accepts "600 px" or even "600.0 px" which I had expected
> to be covered with the trailing ".*"
>
> is this a quirk of the playground, or are the shacl pattern rules
> restricted to a subset of regex syntax?
>
> Both the question operator and ".*" seem to be supported in
> https://www.w3.org/TR/xpath-functions/#regex-syntax (.* is used in the
> examples) -- is there something else that I'm missing? (my tests work fine
> in https://regex101.com/ :)
>
> any and all guidance greatly welcomed ;)
>
> --
> Gary Lawrence Murphy <gary@schemaapp.com> - Hunch Manifest, 15 Wyndham N
> 'C', Guelph
>


-- 
Gary Lawrence Murphy <gary@schemaapp.com> - Hunch Manifest, 15 Wyndham N
'C', Guelph

Received on Monday, 21 January 2019 21:32:14 UTC