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

On Wednesday, July 10, 2013 4:51 PM, Peter F. Patel-Schneider wrote:
> On 07/10/2013 06:49 AM, Markus Lanthaler wrote:
> > 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.

That's true and documented here:
  http://json-ld.org/spec/latest/json-ld-api/#data-round-tripping

That's also the reason why the useNativeTypes flag in the fromRDF algorithm is set to false by default. So a "1.0E1"^^xsd:double would end up as

  {
    "@value": "1.0E1",
    "@type": "xsd:double"
  }

by default when converting to JSON-LD.


--
Markus Lanthaler
@markuslanthaler

Received on Wednesday, 10 July 2013 15:04:43 UTC