-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validating xsd:date and xsd:dateTime #151
Comments
I tried the above with https://github.com/TopQuadrant/shacl (CLI) version 1.4.2:
[ rdf:type sh:ValidationReport ; datetime.ttl <https://openalex.org/W2738724892> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/CreativeWork>.
<https://openalex.org/W2738724892> <http://schema.org/dateCreated> "2022-07-08T06:48:22.159262"^^<http://www.w3.org/2001/XMLSchema#date> creativework.ttl @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema1: <http://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://rescs.org/dash/creativework/CreativeWorkShape> a sh:NodeShape ;
rdfs:label "CreativeWork"^^xsd:string ;
rdfs:comment "The most generic kind of creative work, including books, movies, photographs, software programs, etc."^^xsd:string ;
sh:property [ sh:datatype xsd:date ;
sh:description "The date on which the CreativeWork was created or the item was added to a DataFeed." ;
sh:maxCount 1 ;
sh:name "dateCreated" ;
sh:path schema1:dateCreated ] ;
sh:targetClass schema1:CreativeWork .
There are two things I can see in the output:
Shouldn't Please let me know if I should provide more information about my use case. Thanks! |
Sorry for the delayed response on this one. This problem is coming from RDFLib. PySHACL uses the RDFLib library to check whether the Literal's lexical text matches its given datatype. Note, there was some work done in this area in the lead up to the RDFLib v6.2.0 release, so the new version may have some changes that help with this issue. Additionally, RDFLib v6.2.0 gives the ability for a Literal to be flagged as "ill-typed", that is, when a Literal's given lexical text does not match its given data type, it is flagged as "ill-typed", and PySHACL can now use this value to help complete the validation checks in the There will be a new version of PySHACL out later today, (pyshacl v0.20.0), that uses RDFLib v6.2.0 by default, and takes advantage of this new "ill-typed" Literals feature, so please try that and let me know if it solves your issue. |
No worries, I was on a long holiday in August and did not do anything with RDF for a while ;-) Thanks for the heads-up. I will gladly try the new |
Sorry, didn't mean to automatically close this |
I've just installed |
Thanks. I'll forward that up to the RDFLib team, the fix will lie with them now. |
Hi @ashleysommer , I've recently updated
So it seems that |
I figured that What I found a bit surprising is that
So this means that |
Yeah, I've seen this issue come up before (in Python, outside of the RDF world). I think we would see this same issue with whichever datetime library RDFLib uses. This level of detail in RDF spec seems to be very implementation-specific. |
Hi there,
I have a question regarding validation of
xsd:date
andxsd:dateTime
. I am usingpyshacl
version 0.19.1.Given the following shapes:
I noticed that
schema:dateCreated
only has to have the correct type annotation and the value has to be a string to be valid.So this also does pass validation although it is not a
xsd:date
but anxsd:dateTime
:Does
pyshacl
actually check if the given value string is a valid date or is this somehow out of scope?Thanks for your feedback!
The text was updated successfully, but these errors were encountered: