Data round-tripping issues: create a JSON vocabulary (ISSUE-35)

In the current spec we rely on XML Schema for automatic typing
(http://json-ld.org/spec/latest/#automatic-typing). This is problematic as
it causes several data round-tripping issues:

- no distinction between xsd:decimal and xsd:double (round-tripping)
- "doubles" are normalized to "%1.6e" which might be lossy
- JSON datatypes do not really match the XML datatypes:
  - xsd:boolean = { true, false, 0, 1 }
  - xsd:decimal = allows leading +, zeroes
  - xsd:double = has INF, -INF, NaN; 64-bit prec.

To my best knowledge XSD doesn't even have a resolvable representation
(vocabulary) in RDF. So it isn't even Linked Data.
Furthermore the use of XSD creates a dependency on the XML Schema
specification which I consider a huge overkill.

I know, we talked about this already when we discussed the support for NULL
(ISSUE-11) but I would like to discuss this again on the mailing list.
Should we create a simple vocabulary for the JSON type system? Considering
that the type system is quite small, it should be straightforward to do so.

We would then have something like e.g. json:number or json:string. This
would eliminate all our round-tripping issues at a very low price. It would
also allow us to eliminate the @iri keyword (which is just syntactic sugar)
if we would like to do so as we could introduce a json:iri.

What are your thoughts? I think it's worth the little effort and I'm quite
sure that it would be a vocabulary that would be reused quite often on the
Web. Just consider the number of JSON-only Web APIs right now.


--
Markus Lanthaler
@markuslanthaler

Received on Thursday, 29 September 2011 10:23:36 UTC