W3C home > Mailing lists > Public > public-rdf-comments@w3.org > September 2012

Re: XSD datatypes in JSON-LD (was: Re: Use of XSD namespace in RDF recommendations)

From: Richard Cyganiak <richard@cyganiak.de>
Date: Wed, 5 Sep 2012 11:50:46 +0100
Cc: "'Gregg Kellogg'" <gregg@greggkellogg.net>, "'public-rdf-comments Comments'" <public-rdf-comments@w3.org>
Message-Id: <EC78D0E7-A049-4431-9714-6AB129937D54@cyganiak.de>
To: Markus Lanthaler <markus.lanthaler@gmx.net>
On 5 Sep 2012, at 11:20, Markus Lanthaler wrote:
>> Why not convert "5"^^xsd:double to a JSON-native 5.0? This would allow
>> round-tripping, and no useNativeTypes flag is necessary.
> The problem is that JSON parsera automatically "normalize" a 5.0 to 5 during
> parsing. Since we reuse existing JSON parsers, there's no way for us to
> check whether there was a .0 or not.

TIL that every number is a double in JS.

I guess it's not possible to round-trip idiomatic RDF numbers through idiomatic JSON. Oh well.

What is the justification then for treating the JSON literal 5 as "5"^^xsd:integer in toRDF, rather than as "5"^^xsd:double? The latter seems to be the accurate translation.

Another issue I suppose is that xsd:double contains the values NaN, INF and -INF, which are not valid as JSON numbers and hence cannot be round-tripped if native JSON numbers are used.

Received on Wednesday, 5 September 2012 10:51:19 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:29:54 UTC