W3C home > Mailing lists > Public > public-rdf-wg@w3.org > August 2011

Can JSON-LD cater for Talis' RDF/JSON design goals?

From: Ian Davis <ian.davis@talis.com>
Date: Wed, 24 Aug 2011 20:00:25 +0100
Message-ID: <CAAiX05HUH3R6HZ1CtWjdVzKRwfNfK_ssR-9ZA+is39eOkWoQzg@mail.gmail.com>
To: RDF WG <public-rdf-wg@w3.org>
The design goals I had in mind when devising the Talis RDF/JSON
serialization were roughly as follows. These aren't necessarily RDF WG
design goals for a JSON serialization.

1. Serializes entire RDF model
2. Regular, predictable structure, one way to write any given graph
3. No parsing beyond eval of JSON (i.e. no client dependencies)
4. Usable without a client library, i.e. just an addressable data
structure that lets you quickly answer "what is the label of thing
with URI x"

On this morning's call I pondered whether JSON-LD might have a profile
that would meet those needs. I think it might which opens the
possibility of defining a profile of JSON-LD for simple data
interchange. A sample of how that might look is below:

[
{
  "@subject": "http://example.org/s1",
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [ { "@iri":
"http://xmlns.com/foaf/0.1/Person"   } ],
  "http://xmlns.com/foaf/0.1/name": [ { "@literal": "Anna"   } ],
  "http://xmlns.com/foaf/0.1/knows": [ { "@iri":
"http://example.org/s2" },{ "@iri": "_:a1" } ],
  "http://example.org/foo": [ { "@literal": "52", "@datatype" :
"http://www.w3.org/2001/XMLSchema#int" } ]
},
{
  "@subject": "http://example.org/s2",
  "http://xmlns.com/foaf/0.1/name": [ { "@literal": "Bertram"   } ],
  "http://xmlns.com/foaf/0.1/knows": [ { "@iri": "http://example.org/s1" } ]
},
{
  "@subject": "_:a1",
  "http://xmlns.com/foaf/0.1/name": [ { "@literal": "Colette",
"@language": "fr" } ],
  "http://xmlns.com/foaf/0.1/knows": [ { "@iri": "http://example.org/s1" } ]
}
]

People familiar with RDF/JSON will spot some similarities. The chief
differences are the subjects being values of a @subject key rather
than being keys into another object. That makes it a lot harder to
find the foaf:name of a given subject without using a parser for this
format. But that aside, this looks like it almost satisfies all my
design goals, with 4 being partially satisfied.

This gives me hope that there could be a way forward to produce only a
single JSON spec.

--
Ian Davis, Chief Technology Officer, Talis Group Ltd.
http://www.talis.com/ | Registered in England and Wales as 5382297
Received on Wednesday, 24 August 2011 19:01:02 GMT

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