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

Ivan,

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:

_:c14n0
   <data> 
      _:c14n1,
      _:c14n2,
      _:c14n3.
_:c14n1
   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
"http://xmlns.com/foaf/0.1/Person";
   <http://xmlns.com/foaf/0.1/homepage> "http://example.com/bob/";
   <http://xmlns.com/foaf/0.1/name> "Bob".
_:c14n2
   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
"http://xmlns.com/foaf/0.1/Person";
   <http://xmlns.com/foaf/0.1/homepage> "http://example.com/eve/";
   <http://xmlns.com/foaf/0.1/name> "Eve".
_:c14n3
   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
"http://xmlns.com/foaf/0.1/Person";
   <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
@markuslanthaler




> -----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