Skip to content
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

rdflib.Literals need a well-formed / ill-formed status flag #848

Closed
ashleysommer opened this issue Sep 20, 2018 · 1 comment · Fixed by #1773
Closed

rdflib.Literals need a well-formed / ill-formed status flag #848

ashleysommer opened this issue Sep 20, 2018 · 1 comment · Fixed by #1773
Labels
duplicate This issue or pull request already exists

Comments

@ashleysommer
Copy link
Contributor

ashleysommer commented Sep 20, 2018

I encountered this issue while working on pySHACL.
Specifically, this bug is causing a failure in several of the tests in the standard data-shapes-test-suite here or-datatypes-001.ttl and datatype-ill-formed.ttl
This test relies on the assertion that literals such as "none"^^xsd:boolean and "300"^^xsd:byte should be considered by the validator to be ill-formed literals, so that when checking rules such as sh:datatype, if validating that this property value is a well-formed Literal of type xsd:boolean or xsd:byte (respectively) this should Fail.

Currently, "none"^^xsd:boolean is parsed to a Literal with value=False, datatype=xsd:boolean and "300"^^xsd:byte is parsed to a Literal with value=int(300) and datatype=xsd:byte, so the validation checks which should fail actually pass.

An ideal solution would be at Literal-creation time before converting the lexical value to a Python value, check if it is ill-formed first, store that as an ill_formed flag on the Literal itself, then do the conversion as normal.

@ashleysommer
Copy link
Contributor Author

This is potentially related to issue: #737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant