[ 
https://issues.apache.org/jira/browse/JENA-2005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240372#comment-17240372
 ] 

Andy Seaborne edited comment on JENA-2005 at 11/29/20, 9:44 PM:
----------------------------------------------------------------

Matching triple patterns is by RDF term - not by value.

{{"4"^^xsd:decimal}} does not match {{"4.0"^^xsd:decimal}} by triple matching 
(it would under D-entailment but not normal triple matching).

The usual approach is represent decimals in canonical form and the Jena parsers 
provide this with
{noformat}
    RDFParser.create().canonicalValues(true).source(...).parse(...);
{noformat}
of put a FILTER in the MINUS because comparison by "=" is value sensitive (and 
not by "seameTerm").

Note: The canonical representation of a decimal changed between XML Schema 1 
and 1.1:
 [https://www.w3.org/TR/xmlschema11-2/#decimal]

It is now "4.0".


was (Author: andy.seaborne):
Matching triple patterns is by RDF term - not by value. 

{{"4"^^xsd:decimal}} does not match {{"4.0"^^xsd:decimal}} (it would under 
D-entailment but not normal triple matching).

The usual approach is represent decimals in canonical form and the Jena parsers 
provide this with 

{noformat}
    RDFParser.create().canonicalValues(true).source(...).parse(...);
{noformat}

of put a FILTER in the MINUS because comparison by "=" is value sensitive (and 
not by "seameTerm").

Note: The canonical representation of a decimal changed between XML Schema 1 
and 1.1:
https://www.w3.org/TR/xmlschema11-2/#decimal

It is now "4.0".


> SPARQL does not correctly handle xsd:decimal datatypes
> ------------------------------------------------------
>
>                 Key: JENA-2005
>                 URL: https://issues.apache.org/jira/browse/JENA-2005
>             Project: Apache Jena
>          Issue Type: Question
>          Components: Fuseki
>    Affects Versions: Jena 3.16.0
>            Reporter: Steve Baskauf
>            Priority: Minor
>
> In performing a federated query at the Wikidata Query Service 
> ([https://query.wikidata.org/sparql),] I bound the object of the triple:
>  
> <http://www.wikidata.org/entity/Q97446840>  
> <http://www.wikidata.org/prop/direct/P2896>  "4"^^xsd:decimal.
>  
> as it was provided by the SERVICE endpoint. I also bound the value of the 
> triple:
>  
> <http://www.wikidata.org/entity/Q97446840>  
> <http://www.wikidata.org/prop/direct/P2896>  "4.0"^^xsd:decimal.
>  
> which was present in the local dataset. (The value was originally loaded from 
> Turtle as the number 4.0 (not a datatyped literal).
> When I performed a MINUS operation between the bound values from the SERVICE 
> endpoint and the bound values from the local triplestore, this value should 
> have been removed from the result set because according to the XML schema 
> Recommendation [https://www.w3.org/TR/xmlschema-2/#decimal] both "4" and 
> "4.0" are valid lexical representations ("If the fractional part is zero, the 
> period and following zero(es) can be omitted.") of the same decimal number. 
> However, Fuseki did not recognize the two values as identical, which is an 
> error.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to