Skip to content

BigDecimal literals with no fractional part format as xsd:integer, not xsd:decimal #46

Description

@tlaundal

First of all: thanks for creating this great library!

I've run into a problem which I think comes down to flint incorrectly handling BigDecimal literals with no fractional part.

Take this example query:

(flint/format-query
 {:select '[?s]
  :where [['?s '?p (bigdec 1)]]}

This currently (flint 0.3.0) produces SELECT ?s WHERE { ?s ?p 1 . }.
I think it should produce SELECT ?s WHERE { ?s ?p "1"^^xsd:decimal . }.

The reason is that 1 is interpreted as "1"^^xsd:integer, which is a different literal from "1"^^xsd::decimal. This means a pattern like ['?s '?p (bigdec 1)] in flint generates SPARQL which doesn't match triples with the object literal "1"^^xsd::decimal. Flint does emit 1.0 for (bigdec 1.0) which is interpreted as "1.0"^^xsd:decimal, but that is still considered a different literal from "1"^^xsd:decimal, so it doesn't fix the query.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions