TopQuadrant/shacl-js

Validation of xsd:dateTime not working

rapw3k opened this issue · 3 comments

Hi,
I was testing the service, and I am trying to understand how the validation of datetimes should work. For instance,
my SHACL (https://github.com/rapw3k/DEMETER/blob/master/models/SHACL/demeterAgriProfile-SHACL.ttl) has the definition:

https://astrea.linkeddata.es/shapes#cec13f824650b91401ee4d9e7051141d
a sh:PropertyShape ;
rdfs:isDefinedBy https://github.com/GSMADeveloper/NGSI-LD-Entities/blob/master/definitions/Agri-Parcel.md ;
rdfs:label "lastPlantedAt"@en , "Indicates the date when the crop was last planted." ;
sh:datatype xsd:dateTime ;
sh:description "Indicates the date when the crop was last planted." ;
sh:name "lastPlantedAt"@en ;
sh:nodeKind sh:Literal ;
sh:path fiware:lastPlantedAt ;
sh:pattern "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5]0-9?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?" .

I tried making a bad example that will report incorrect date (https://github.com/rapw3k/DEMETER/tree/master/models/examples). I tried:

https://uri.fiware.org/ns/data-models#lastPlantedAt "test-bad-pattern"^^xsd:dateTime .
and
https://uri.fiware.org/ns/data-models#lastPlantedAt "test-bad-pattern" .

both none report error. How these should work ?

thanks

See my comment on the start page: This project is not really actively maintained anymore. For a more modern JavaScript implementation, see https://github.com/zazuko/rdf-validate-shacl - have you tried that implementation?

ok thank, will try that one; will there be a playground (web UI) based on the new version, its very convenient for quick testing

You may want to encourage its developers to do that - would be a great asset.