Thought on the xsd:decimal datatype
xsd:decimal
and the E notationThis repository aims at
xsd:decimal
to support E notation, andThe xsd:decimal
datatype is defined in a way that it only support the "simple" decimal notation (e.g. 12.3
) but not the E notation (e.g. 1.23E1
).
This can be a problem when xsd:decimal
values are generated programmatically. In particular, in JSON-LD, type coercion used with JSON numbers can lead to decimals expressed with the E notation, which are ill-formed, according to the standard.
It is not entirely clear why the E notation is was allowed for xsd:decimal
.
If a new version of XSD Datatypes is published, it would seem like a good idea in extend xsd:decimal
to support E notation.
As a matter of fact, many RDF and related implementations already support the E notation for xsd:decimal
(see below).
So in practice, it might be relatively safe to use it, even though it is not (yet?) standard.
xsd:decimal
with E notation
Implementation | Version | Evidence |
---|---|---|
GraphDB | 10.0.2 | tested with test.rq |
Virtuoso | 8.03 | tested with test.rq, try online |
Qlever | latest on 22-10-24 | tested with test_qlever.rq |
RDFlib | 6.2.0 | tested with test_rdflib.py |
Hermit | 1.3.8 | tested with test.owl.ttl |
Eye | v22.1021.1922 | tested with test.n3, try online |
CWM | 1.197 | tested with test.n3, try online |
xsd:decimal
WITHOUT E notation
Implementation | Version | Evidence |
---|---|---|
Apache Jena | 4.6.1 | tested with test.rq |
Corese | commit 3ebe016 | tested with test.rq |
Oxigraph | commit 825b330 | tested with test.rq |
Ruby RDF | 3.2.9 | tested with test.rq |
If you know of another implementation that does not appear in the tables above, or of any change with a new version of one that does appear, please make a pull-request adding or updating a line in the appropriate table, following the model of other lines.