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: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Wed, 10 Jul 2013 15:49:30 +0200
To: "'RDF WG'" <public-rdf-wg@w3.org>
Message-ID: <008401ce7d74$4e832920$eb897b60$@lanthaler@gmx.net>
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? 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.



--
Markus Lanthaler
@markuslanthaler
Received on Wednesday, 10 July 2013 13:50:05 UTC

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