SWI-Prolog / packages-semweb

The SWI-Prolog RDF store
28 stars 14 forks source link

FIXED: Lexical representation of xsd:decimal numbers #100

Closed likelion closed 3 years ago

likelion commented 3 years ago

Forcing lexical representation through xsd_number_string/2 for decimal numbers causes incorrect behavior:

?- rdf_assert(s,p,^^(3.1415, xsd:decimal),g).
true.

?- rdf(s,p,X,g).
X = ^^(3.1415,'http://www.w3.org/2001/XMLSchema#decimal').

?- rdf_retractall(s,p,^^(3.1415, xsd:decimal),g).
true.

?- rdf(s,p,X,g).
X = ^^(3.1415,'http://www.w3.org/2001/XMLSchema#decimal').

Contrary to double, decimal numbers must not use scientific notation in their lexical representation.

JanWielemaker commented 3 years ago

Thanks. Merged after a small change to use atom_number/2 rather than converting through a string. This causes the conflict. Note that decimal support is still an issue as SWI-Prolog cannot represent decimals. Well, their value can be represented as a rational number, but the fact they are in fact a decimal is lost.