W3C home > Mailing lists > Public > public-linked-json@w3.org > January 2012

RE: clarification/precision question on the JSON-LS syntax document

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Thu, 12 Jan 2012 21:25:40 +0800
To: "'Ivan Herman'" <ivan@w3.org>
Cc: "'Linked JSON'" <public-linked-json@w3.org>
Message-ID: <00d601ccd12d$b0839a50$118acef0$@lanthaler@gmx.net>

I agree, we should disallow that optimization. It is really only needed if
the document contains a number of nodes at the top level and the context
should not be repeated. I think we can fall back on the fact that in JSON-LD
we allow to mix plain old JSON with linked JSON. So a developer could simple
us a term such as "data" that is not mapped/coerced to anything. Taking the
example from the spec [1], it would look as follows:

  "@context": { "foaf": "http://xmlns.com/foaf/0.1/" },
  "data": [
      "@id": "_:bnode1",
      "@type": "foaf:Person",
      "foaf:homepage": "http://example.com/bob/",
      "foaf:name": "Bob"
      "@id": "_:bnode2",
      "@type": "foaf:Person",
      "foaf:homepage": "http://example.com/eve/",
      "foaf:name": "Eve"
      "@id": "_:bnode3",
      "@type": "foaf:Person",
      "foaf:homepage": "http://example.com/manu/",
      "foaf:name": "Manu"

The Turtle output looks as follows:

   <http://xmlns.com/foaf/0.1/homepage> "http://example.com/bob/";
   <http://xmlns.com/foaf/0.1/name> "Bob".
   <http://xmlns.com/foaf/0.1/homepage> "http://example.com/eve/";
   <http://xmlns.com/foaf/0.1/name> "Eve".
   <http://xmlns.com/foaf/0.1/homepage> "http://example.com/manu/";
   <http://xmlns.com/foaf/0.1/name> "Manu".

The only additional blank node which is currently created in the playground
is an error in my opinion - but it is currently specified that way. I've
filed ISSUE-56 for this. 

[1] http://json-ld.org/spec/latest/json-ld-syntax/#rdfa

Markus Lanthaler

> -----Original Message-----
> From: Ivan Herman [mailto:ivan@w3.org]
> Sent: Thursday, January 12, 2012 8:40 PM
> To: Markus Lanthaler
> Cc: 'Linked JSON'
> Subject: Re: clarification/precision question on the JSON-LS syntax
> document
> Markus,
> after we have established that is it correct... yes, it looks weird.
> And if it looks weird than it may be misleading, and may lead to author
> errors. If so, my instinctive reaction would be to disallow it. But, of
> course, this comes out of a necessity, namely that we have a graph and
> not a tree, ie, we need several roots. And the syntactic restrictions
> of JSON force us to do something. Ie, we have to have something.
> I understand (and agree with) the requirement to reduce the number of
> keywords in JSON-LD. But maybe this is the case where it is worth
> making things explicit and not to try to conflate several different
> meanings into one keyword. What I would propose is to have a separate
> keyword, say, @root, that can be used to denote what we do here with
> @id. I would actually even introduce the extra restriction that this
> keyword can appear only at the top level of a JSON-LD file, although if
> we think of cut and paste from one JSON-LD file to the other, we may
> not want to have this. In parallel, I would disallow usage of @id in
> the examples below.
> My 2 cents...
> Ivan 

Received on Thursday, 12 January 2012 13:33:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:33 UTC