Polar-integer datatypes not verifying polarity of lexical value · Issue #1757 · RDFLib/rdflib (original) (raw)
I recently encountered an issue using pySHACL to validate a xsd:positiveInteger
and found it was accepting "0"^^xsd:positiveInteger
.
From review of today's term.py
and the influence of the members of _NUMERIC_LITERAL_TYPES
, and from a test-patch (linking in a few moments, I need this Issue number first), this is currently an acceptable rdflib statement:
value = Literal("-1", datatype=XSD.positiveInteger)
What should this behavior be instead? A runtime error (something like raise ValueError
) would be correct to me, but I appreciate it'd potentially be a jarring change for many applications.