Re: json-ld-api type fidelity in RDF roundtripping

On 04/04/13 15:02, Markus Lanthaler wrote:
> On Thursday, April 04, 2013 3:51 PM, Andy Seaborne wrote:
>
>>> By default, XSD integers and doubles are converted to JSON-native
>> numbers,
>>> which is what most developers would expect. If precision or the exact
>>> lexical form matters, the "use native types" flag of the Convert from
>> RDF
>>> algorithm [2] can simply be set to false and no literals will be
>> converted.
>>>
>>
>> xsd:integers are arbitrary size - there are derived classes that have
>> specific ranges (e.g. xsd:int is 32 bit - xsd:long at 64 bits is
>> outside
>> JSON numbers)
>
> Yeah, that's true but (theoretically) JSON numbers are arbitrary size as
> well. We shouldn't conflate JSON and JavaScript too much. Are you suggesting
> to change something or was that just an observation?

I don't see that you should separate them:

RFC 4627:
[[
JSON's design goals were for it to be minimal, portable, textual, and
a subset of JavaScript.
]]
(and reference to ECMAscript)

so while JSON syntax may allow long numbers, there is implicitly a limit 
to the range/precision of floating point doubles.

It would be better to note that xsd:int is safe but xsd:integer is not 
for javascript.

	Andy


>
>
> Cheers,
> Markus
>
>
>
> --
> Markus Lanthaler
> @markuslanthaler
>
>

Received on Thursday, 4 April 2013 14:18:18 UTC