Richard Cyganiak created JENA-1694:
--------------------------------------

             Summary: Lexical form for unsigned numeric types should not 
include sign
                 Key: JENA-1694
                 URL: https://issues.apache.org/jira/browse/JENA-1694
             Project: Apache Jena
          Issue Type: Bug
    Affects Versions: Jena 3.10.0
            Reporter: Richard Cyganiak


According to the XSD spec, the lexical space for the four unsigned numeric 
types available in SPARQL (unsignedLong, unsignedInt, unsignedShort, 
unsignedByte) consists of a sequence of digits only. It does not start with a 
sign. So, "+1", "+0" or "-0" should not be valid lexical forms for these 
datatypes.

Jena accepts all of these lexical forms for all of the unsigned datatypes.

For example, the following query returns {{"+1"^^xsd:unsignedLong}} but should 
return no binding for {{?x}}:

{noformat}
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (xsd:unsignedLong("+1") AS ?x) {}
{noformat}

This returns true but should return false:

{noformat}
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (isNumeric("-0"^^xsd:unsignedByte) AS ?x) {}
{noformat}

References:

- 
[unsignedLong|https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#unsignedLong-lexical-representation]
- 
[unsignedInt|https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#unsignedInt-lexical-representation]
- 
[unsignedShort|https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#unsignedShort-lexical-representation]
- 
[unsignedByte|https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#unsignedByte-lexical-representation]




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to