I am hoping to master the fine art of sh:sparql and sh:ask validators, and I have a situation where the source data can have geocoordinates as strings, eg "99.91°N" - the following sparql code correctly detects values out of range:
SELECT * WHERE { BIND("99.91°N" as ?value) BIND(abs(xsd:float(replace(str(?value),"[a-zA-Z°]",""))) as ?lat) FILTER( ?lat > "90.0"^^xsd:float ) } So with a source graph schema:Geocoordinate ex:BobPoint a schema:GeoCoordinates ; schema:latitude "-144.75N" ; schema:longitude "172" ; . I am expecting to detect that bad latitude with the following bit of shacl using sh:sparql to clean the ?value and cast it to float for comparison, just as with the above sparql code. But it doesn't work ... hmshape:GeoCoordinates-latitude-limits a sh:PropertyShape ; sh:path schema:latitude ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes schema: ; sh:prefixes xsd: ; sh:select """ SELECT $this ?lat WHERE { $this $PATH ?value . BIND(abs(xsd:float(replace(str(?value),\"[a-zA-Z° ]\",\"\"))) AS ?lat) FILTER( xsd:float(?lat) > xsd:float(90.0) ) }""" ; ] ; . hmshape:GeoCoordinatesShape a sh:NodeShape ; sh:property hmshape:GeoCoordinates-latitude-limits ; sh:targetClass schema:GeoCoordinates ; . Unfortunately, this rule always approves whatever value I give it, no warnings or errors. I've tried variations, casting to xsd:float or not, using sh:validator with sh:ask, but it still accepts any value. Just to be sure, I added sh:minCount 2 to assure myself the rule was being reached, and it is. What am I missing? Also, is this the correct use of sh:prefixes? these are defined in the hmshape owl:Ontology with sh:declare bnodes -- Gary Lawrence Murphy <g...@schemaapp.com> - Hunch Manifest, 15 Wyndham N 'C', Guelph -- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CADnyxpu7Fsf%3DN0vc%2BmWG2%2BnkiMD%3DHH5-uXwditHvF5zABGqYrA%40mail.gmail.com.