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

RE: Yet another serialization format?

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Tue, 28 Jun 2011 18:02:23 +0800
To: <public-linked-json@w3.org>
Message-ID: <010501cc357a$7cb37640$761a62c0$@lanthaler@gmx.net>
On 06/28/2011 5:01 PM Kingsley Idehen wrote:
> On 6/28/11 7:52 AM, Markus Lanthaler wrote:
> > What I really intended to propose was to completely separate the JSON
> representation from the Linked Data description instead of mixing out-
> of-band information with inline JSON-LD constructs.
> 
> RDF did not invent:
> 
> 1. Triples
> 2. URIs
> 3. Use of URIs in Triple patterns as vehicle for "whole data
> representation" using graphs.
> 
> It becoming excruciatingly painful to see who many have come to see RDF
> as meaning Linked Data Graphs. Or assuming, that without RDF we don't
> have Linked Data. [...]

Kingsley, I was not talking about RDF at all. What I've said was that I would prefer to have two documents with clearly separated concerns. One would be the serialization in plain old JSON representation as it is done in a lot of Web APIs today. The other document adds means to "understand" the former, let's call it context or schema.

The context describes the structure of the JSON representation and what the attributes and values mean and how they have to be interpreted. So, effectively it will define the type or concept represented by different objects/attributes/values and how these can be transformed to/interpreted as hyperlinks.

Let me illustrate it based on Manu's example. The JSON representation could look as follows:

// http://www.example.com/artists/justin-bieber.json
// Link: <http://www.example.com/jsonld/artist.json>; REL=described-by
{
   "name": "Justin Bieber",
   "albums": [ 
      {
        "name": "My World 2.0", 
        "released": 2010
      },
      {
        "name": "Just found out he has just one album",
        "released": null
      }
   ]
}

What I propose would be a context/schema describing this representation (pseudo-code based on JSON schema):

// http://www.example.com/jsonld/artist.json
{
  "type": "object",
  "model": "foaf:Person",
  "properties": {
    "name": {
      "type": "string", "model": "foaf:name"
    },
    "albums": {
      "type": "array", "model": "ex:made",
      "items": {
        "type": "object", "model": "ex:album",
        "properties": {
          "name": {
            "type": "string", "model": "ex:albumtitle"
          },
          "released": {
            "type": "number", "model": "ex:released"
          }
        }
      }
    }
  }
}

This is just a illustrative example and thus by no means complete - so please don't nail me down on this :-)

A  template-like approach as the one shown above would allow to create valid JSON representations directly out of a generic triple store. In the current JSON-LD approach that's not possible and requires an additional template mechanism. This is, e.g., an important aspect for Web APIs (where JSON is typically used these days) as it would allow you to automatically create valid requests.


--
Markus Lanthaler
Received on Tuesday, 28 June 2011 10:02:55 GMT

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