Skip to content

pchampin/xsd_decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xsd:decimal and the E notation

This repository aims at

  • discussing a possible future evolution of xsd:decimal to support E notation, and
  • keep track of the current state of implementations.

The problem

The 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.

The ideal solution

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.

In the meantime (a pragmatic solution)

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.

Implementations that support 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

Implementations that support 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

Contributing

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.

About

Thought on the xsd:decimal datatype

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages