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

Re: Updated JSON-LD spec to more closely align w/ RDF data model

From: Peter F. Patel-Schneider <pfpschneider@gmail.com>
Date: Wed, 10 Jul 2013 07:51:22 -0700
Message-ID: <51DD74EA.8070105@gmail.com>
To: Markus Lanthaler <markus.lanthaler@gmx.net>
CC: 'RDF WG' <public-rdf-wg@w3.org>

On 07/10/2013 06:49 AM, Markus Lanthaler wrote:
> On Wednesday, July 10, 2013 2:37 AM, Peter F. Patel-Schneider wrote:
>> I've been looking through the IETF JSON mailing list, and haven't been finding
>> anything about mixed JSON numbers (i.e., some JSON numbers are integers
>> and some are floats).
>>
>> I would appreciate pointers that support this interpretation of what
>> JSON numbers mean.
> This is one of the issues that consumed most time. We concluded that the vast majority of applications don't care about some minor issues when round-tripping data between JSON-LD and RDF. On the other hand, it significantly simplifies developer's lives if we map things like 1, 2, 3 to xsd:integers instead of converting them to xsd:doubles.
>
> It also aligns JSON-LD closer to Turtle, which does the same but doesn't suffer under the same problems as parsers are specifically built for this purpose whereas we built on top of existing JSON parsers. How concrete applications handle arbitrarily big integers in a Turtle document is also unspecified for that matter. Sure, you can always represent those things as strings but you can't do anything useful with it then. Consequently, some applications might reject too large integers. Same situation in JSON IMO.
>
> I think you would prefer to interpret all JSON numbers as xsd:doubles, is that correct?

I would prefer something that works well.   As far as I can see, using 
xsd:double fits that bill.  I'm not so convinced about the current situation, 
with its mixed use of xsd:integer and xsd:double.

> This was already proposed by Pierre-Antoine some time ago but didn't have enough support to result in a spec change. I could live with that but wouldn't be too happy about it because it would mean that a JSON-LD document like
>
>    {
>      "@id": "",
>      "ex:prop": 1
>    }
>
> wouldn't result in the following Turtle document
>
>    <> ex:prop 1
>
> but
>
>    <> ex:prop 1.0E0
>
> I think most people would agree that the mapping we currently have aligns better in that regard.

Yes, but there is the potential issue that round-tripping the RDF literal 
"1.0E1"^^xsd:double through JSON-LD using JSON numbers (even ignoring 
potential further round-tripping through JSON implementations) appears to 
result in "10"^^xsd:integer.

>
>
>
> --
> Markus Lanthaler
> @markuslanthaler
>
>
peter
Received on Wednesday, 10 July 2013 14:51:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:04:30 UTC