Skip to content

Datatype confusion with XSD float, decimal, integer, double #2454

@chgoe

Description

@chgoe

I observed the following issue in QLever (installed via PIP, version 0.5.29) after unsuccessfully trying to delete triples yielded by a CONSTRUCT query which turned out to be caused by literals being typed differently than suggested by the query result:

Inserting the following data:

INSERT DATA {
  GRAPH <http://example.org/graph> {
    <http://example.org/s> <http://example.org/p> "960000.06"^^<http://www.w3.org/2001/XMLSchema#float> .
  }
}

followed by querying for that literal:

SELECT * WHERE {
  GRAPH <http://example.org/graph> {
    <http://example.org/s> <http://example.org/p> ?o .
  }
}

will yield the literal, but typed to xsd:decimal rather than the expected xsd:float:
"960000"^^<http://www.w3.org/2001/XMLSchema#decimal>

The following CONSTRUCT query:

CONSTRUCT { ?s  ?p  ?o } WHERE {
  GRAPH <http://example.org/graph> {
    ?s ?p ?o .
  }
}

will even yield an integer literal:
<http://example.org/s> <http://example.org/p> 960000 .

Perhaps this is somehow related to #1817, as the following query also returns xsd:double?

SELECT (DATATYPE(?o) AS ?dt) { 
  GRAPH <http://example.org/graph> {
    <http://example.org/s> <http://example.org/p> ?o .
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions