W3C home > Mailing lists > Public > public-rdf-wg@w3.org > May 2013

Re: RDF-ISSUE-129 Re: json-ld-api: change proposal for handling of xs:integer

From: Sandro Hawke <sandro@w3.org>
Date: Mon, 13 May 2013 17:36:15 -0400
Message-ID: <51915CCF.6010803@w3.org>
To: Markus Lanthaler <markus.lanthaler@gmx.net>
CC: 'W3C RDF WG' <public-rdf-wg@w3.org>
On 05/13/2013 04:00 PM, Markus Lanthaler wrote:
> On Monday, May 13, 2013 4:49 PM, Sandro Hawke wrote:
>> Sorry, the flag doesn't really help in the scenario I provided above,
>> where someone is serving JSON-LD to an unknown client.  I would argue
>> this is the expected, majority use case.  (I guess the other one that
> I see, you are concerned about systems exchanging JSON-LD. Then the
> situation is exactly the same as with exchanging JSON. Not sure we
> should/can change that.

I feel like we bear some responsibility building a hotel on quicksand, 
if we know it's quicksand.

>
>> might be common is reading RDF and converting it to JSON-LD for
>> internal
>> use as a kind API to the data?)  And in this use case, if the server
>> sets useNativeTypes=true, it's going to be providing data that for some
>> data values the client will get either the wrong RDF data value and/or
>> the wrong RDF data type.
>>
>> In other words with useNativeTypes turned on, JSON-LD is not a faithful
>> RDF syntax.
> JSON-LD the data format is.. the problem are the (JSON) parsers.

If we know it's quicksand, we should try to engineer around its 
deficiencies if that's practical, and if it's not, we should give people 
appropriate warnings of the danger.  (For example, I had no idea (until 
you told me last week) that important platforms used something other 
than a 64-bit IEEE floating point representation of JSON numbers.    If 
I were publishing data in JSON LD, I would have been making that 
assumption, and ... consumers would have been getting the data wrong.)

>
>> Given that -- which you all seem invested in -- maybe we should go all
>> the way and convert all RDF numeric literals to native JSON numbers.
>> It
>> makes the lossy-but-convenient conversion even more convenient and
>> lossy
>> in a less-surprising way.    Rather than weirdly having *some* doubles
>> turned into integers in the rdf->json->rdf round trip, we'd just have
>> (I
>> propose) EVERY numeric literal turned into an xs:double.   Certainly
>> that's what pretty much every JavaScript coder would want/expect with
>> useNativeTypes=true.
>>
>> I'd also suggest we say the people SHOULD NOT publish JSON-LD with
>> json-native numbers in it, unless they're fine with them being
>> understood in a platform-dependent way.
> I would be fine with doing that. As you say, in most cases that's what
> people want anyway.

Excellent.

> I hope we can still get this changes in before
> publishing LC2.
>

Seems doable.    A couple of sentenced and one or two tests.

      -- Sandro
Received on Monday, 13 May 2013 21:36:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 22:02:13 UTC