W3C home > Mailing lists > Public > public-rdf-comments@w3.org > May 2012

Re: JSON-LD Syntax request for FPWD via RDF WG

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Tue, 22 May 2012 14:49:56 -0400
Message-ID: <4FBBDFD4.2090404@digitalbazaar.com>
To: public-rdf-comments@w3.org
CC: Linked JSON <public-linked-json@w3.org>
On 05/22/12 08:17, Richard Cyganiak wrote:
> A couple of questions:
> * Is JSON-LD an RDF serialization?

The answer to this question is very nuanced, so I will try to be precise.

You can express the entirety of RDF via JSON-LD. You can transform from
RDF/XML, TURTLE, N-Quads, etc. to JSON-LD and back loss-lessly. So in
that sense, JSON-LD is an RDF serialization.

However, we were very careful to craft it in such a way that Web
developers wouldn't need to know anything about RDF in order to use
JSON-LD for most day-to-day activities. The syntax and API is meant to
stand on its own, without requiring any other part of the more
traditional RDF stack technologies (no TURTLE, no SPARQL, no
triple/quad-store, etc. required).

We also attempted to put some distance between JSON-LD and RDF because
of the immediate negative reaction we've found most Web developers that
have heard things about RDF have when they hear those three letters

This is more about messaging than anything else: JSON-LD is not about
RDF, it's about Linked Data for Web developers. It just so happens that
you can go to/from RDF if you really want to do so, but that's not the
primary goal of JSON-LD.

> * Given a JSON-LD document, how do I get an RDF graph from it?

By using the JSON-LD API:

// This callback will be called once per RDF statement
function rdfCallback(quad)
  console.log(quad.subject, quad.property, quad.object, quad.name);

// this converts the document at the given URL to RDF
jsonld.toRDF("http://foo.org/8374.jsonld", rdfCallback);

> * Given an RDF graph, how do I turn it into a JSON-LD document?

var rdfGraph = ... created by the application ...;

function conversionComplete(doc)
   console.log("JSON-LD document:", doc);

jsonld.fromRDF(rdfGraph, conversionComplete);

> * Can any RDF graph be serialized as a JSON-LD document?

Yes, we believe so - we don't know of any RDF graphs that cannot be
serialized as a JSON-LD document. If this is not true, it's a bug.

> @cygri via Twitter: A bit disheartening: The JSON-LD specs are 23k
> words. For comparison, RDF/XML is 13k, Turtle 6k. Well… RDF Concepts:
> 6k words. RDF Semantics: 23k. RDF Schema: 6k. RDF Primer: 38k. It
> adds up…
> bit.ly/LcOxTx bit.ly/Lov0ix

I don't think this is a valid line of argumentation against any
specification that has seen a decent amount of review and
implementation. I understand the gist of what you're saying, but this is
now true for any Web technology that depends on HTTP, IRI, JSON,
JavaScript, CSS, and HTML (which is basically every modern Web App being
created today). It's a lot to learn... I think that point is valid.

However, smushing the JSON-LD Syntax specification and the JSON-LD API
specification together and comparing it against RDF/XML or Turtle is
comparing apples to oranges. Neither RDF/XML or Turtle /have/ an API, so
why include the JSON-LD API document in the word count? Furthermore, it
is asserted that 80% of Web developers will only need to use the Basic
Concepts in the JSON-LD spec, which only constitutes around 45% of the

JSON-LD Basic Concepts: 4.8K words
JSON-LD: 11.2K words
Turtle: 9.4K words

In addition, many of the words in the document are examples. We were
incredibly verbose with the examples because it's a good way to show how
the spec text translates to real-world examples. Strip out the examples,
which is basically what the RDF/XML Syntax spec does, and the document
size shrinks dramatically.

Keep in mind that the JSON-LD specification also doesn't require you to
read any of the RDF specifications in order to use it... you should be
able to just read the JSON-LD Syntax specification (just the Basic
Concepts) and have a good idea of how you could express Linked Data with
the language.

-- manu

Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: PaySwarm Website for Developers Launched
Received on Tuesday, 22 May 2012 18:51:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:29:53 UTC