W3C home > Mailing lists > Public > public-schemaorg@w3.org > June 2015

Re: JSON-LD and multiple values

From: Melvin Carvalho <melvincarvalho@gmail.com>
Date: Tue, 9 Jun 2015 18:10:06 +0200
Message-ID: <CAKaEYhLqa-gopTy+MpP1=DQ5D_=_OBP+9G_UxdVKfphSNAtG8Q@mail.gmail.com>
To: Gregg Kellogg <gregg@greggkellogg.net>
Cc: Dan Brickley <danbri@google.com>, John Walker <john.walker@semaku.com>, "mfhepp@gmail.com" <mfhepp@gmail.com>, Manu Sporny <msporny@digitalbazaar.com>, "schema.org Mailing List" <public-schemaorg@w3.org>
On 9 June 2015 at 16:53, Gregg Kellogg <gregg@greggkellogg.net> wrote:

> > On Jun 9, 2015, at 7:06 AM, Dan Brickley <danbri@google.com> wrote:
> >
> > On 9 June 2015 at 14:36, Melvin Carvalho <melvincarvalho@gmail.com>
> wrote:
> >>
> >>
> >> On 9 June 2015 at 15:33, Dan Brickley <danbri@google.com> wrote:
> >>>
> >>> On 9 June 2015 at 14:20, Melvin Carvalho <melvincarvalho@gmail.com>
> wrote:
> >>>>
> >>>>
> >>>> On 9 June 2015 at 14:52, John Walker <john.walker@semaku.com> wrote:
> >>>>>
> >>>>> For the record I-JSON forbids duplicate names in an object:
> >>>>> https://tools.ietf.org/html/rfc7493#section-2.3
> >>>>
> >>>> So how do you do unordered lists.  Say a user has two nicknames or
> >>>> telephone
> >>>> numbers (strings).  This is a fundamental part of linked data, if it
> >>>> cant
> >>>> easily be done it's a *massive* interoperability issue.
> >>>
> >>> It's an array viewed from JSON, but a repeated property viewed from
> RDF.
> >>
> >>
> >> Got it, so you'd use @list in JSON LD for an ordered list, and a
> standard
> >> array for unordered.
> >>
> >> But is can I-JSON do the same thing?
> >
> > Yup, https://www.tbray.org/ongoing/When/201x/2015/03/23/i-json
> > "I-JSON is just a note say­ing that if you con­struct a chunk of JSON
> > and avoid the in­terop fail­ures de­scribed in RFC 7159, you can call
> > it an “I-JSON Message”.”
> Depends on what you mean by “do the same thing”; JSON does not have an
> unordered collection type, just an array. However, it is a syntax only.
> Most implementations will take this to be an ordered array of elements, and
> allow duplicates. JSON-LD explicitly treats these as being unordered,
> unless the context or an explicit @list indicates otherwise, but that’s due
> to the underlying data-model being RDF, where values are inherently
> unordered. Note that element contents in Microdata, RDFa and RDF/XML have a
> document order, but result in the same unordered set of values when
> converted to RDF.

Very interesting, thanks for the clarification.

Unordered items are not specific to RDF, or linked data, but rather, a
fundamental part of the web.  The web being a giant graph of links, and
thereby having a very special architecture, and well proven results on
scalability etc.

This issue seems to be a common case where unordered lists are neglected in
the design phase.  Another IETF serialization that does not have unordered
lists is JRD.  In fact, not only are arrays of links ordered, but lists
must be ordered in terms of 'preference', which is not always known or well

Clearly the relationship with JSON and ECMA Script would make repeating
keys in the data structure problematic for programmers, as keys are
generally considered unique.  It's good that unordered lists can be
represented in JSON LD another (and quite intuitive) way.

This seems to be a major deficiency of some JSON serializations in the
wild, but fixed in JSON LD.  It can be well argued that raw JSON is *not* a
very well aligned language for the web, and should be used in limited
examples of API data interchange.

I think there is an argument that the IETF would benefite from thinking
more carefully, going forward, about openstand principles such as
interoperability, when looking at the ordering of lists in proposed RFC

It's great that JSON LD provides the best of both worlds.

> Gregg
> > Dan
Received on Tuesday, 9 June 2015 16:10:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 9 June 2015 16:10:35 UTC