W3C home > Mailing lists > Public > public-linked-json@w3.org > October 2011

Re: Type Coercion is confusing (ISSUE-34)

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Sat, 01 Oct 2011 15:53:13 -0400
Message-ID: <4E876FA9.7080208@digitalbazaar.com>
To: "public-linked-json@w3.org" <public-linked-json@w3.org>
On 09/28/2011 11:27 AM, Gregg Kellogg wrote:
> In fact, my internal representation is what you suggest. The
> rationale for the existing rep is that it is much shorter, otherwise
> a given type would need to be specified once for each property.

Exactly - we did it this way so that authors wouldn't have to author 
huge chunks of type coercion sections in their markup. Compare this:

{
    "xsd:integer": ["age", "pets", "cars", "children", "siblings"]
}

vs. this:

{
    "age": "xsd:integer",
    "pets": "xsd:integer",
    "cars": "xsd:integer",
    "children": "xsd:integer",
    "siblings": "xsd:integer"
}

Clearly, the first one is more compact and easier to author.

The spec started off doing it the way you suggested, Markus. It got old 
quickly when authoring JSON-LD week after week. As Gregg mentioned, the 
internal guts of a JSON-LD parser will end up using what you suggest 
internally, but we believe the top one is easier for authors and less 
bandwidth intensive.

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
Founder/CEO - Digital Bazaar, Inc.
blog: Standardizing Payment Links - Why Online Tipping has Failed
http://manu.sporny.org/2011/payment-links/
Received on Saturday, 1 October 2011 19:53:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:35 GMT