Re: Understanding of JSON-LD values

On 06/13/2013 11:04 AM, Sven R. Kunze wrote:
> And to repeat myself. JSON-LD data is just a string.

JSON-LD data should not be thought of as "just" a string. Working with 
JSON is not the same as working with Turtle. This statement and the ones 
below seem to a cause of misunderstanding. I don't know if it arises 
from a general unfamiliarity with JSON or not, but I'll explain below.


On 06/12/2013 05:54 AM, Sven R. Kunze wrote:
>
> Well, if JSON-LD is a concrete syntax of RDF then people indeed will 
> wish to work with it on the abstract RDF level. They need tools than 
> can parse the JSON-LD and "transform it into a usable programmable 
> API" just using the abstract interface.
>
> As I mentioned earlier, the big advantage of RDF is the separation of 
> abstract and concrete syntax. Nobody actually wants to take care of 
> the concrete syntax. There is a graph and I can query it and change at 
> will via an abstract interface like SPARQL or rdflib interface. 

While RDF people will certainly be interested in tools that can 
"transform [JSON-LD] into a usable programmable API", your assertion 
that "nobody" wants to take care of the concrete syntax, they just want 
to use tools that provide them with an API to query the graph is 
inaccurate. I take this statement to mean that you think *no one* really 
cares how the serialization (or its structure) looks -- they just want 
to parse it and get it into something they can query with an API. If 
that's what you mean, then you're missing the purpose underlying perhaps 
the most important design goal of JSON-LD: to make sure it can function 
just like idiomatic JSON. That "nobody" you speak of is actually a huge 
swath of web developers; if you're unaware of that, then it explains 
much of the confusion.

I understand that you're arguing that RDF is all about an abstract 
syntax ... so the concrete syntax shouldn't matter. The concrete syntax 
matters to JSON developers -- and we're trying to bring the power of RDF 
to them.

In other words, for web developers, JSON (or JSON-LD) documents are 
essentially themselves *already* "usable, programmable APIs," without 
any API cruft or extra tools. Languages with native JSON parsers make it 
possible to work with JSON documents with the same natural syntax that 
is used to manipulate any other objects or arrays in memory. In more 
concrete terms:

// create an object directly from JSON in JavaScript
var object = {"foo": "bar"};
console.log(object.foo); // access and print the foo property's value
object.foo = 'a'; // set the foo property's value

# create an object directly from JSON in Python
object = {"foo": "bar"}
print object.foo // access and print the foo property's value
object["foo"] = 'a'; // set the foo property's value

Working with JSON is different from working with other serializations 
because the extra layers of parsers and APIs that are required ... *are 
not*. You just don't need them if you want to do something simple. The 
strength of JSON-LD is that you can indicate which parts of a JSON 
document can be interpreted as Linked Data/RDF. That means that you can 
use JSON-LD as JSON *or* you can employ RDF tools to use it as RDF.

This gives us the best of both worlds; it allows people who were 
previously locked out of the Linked Data/RDF world to join it at their 
own pace.

-- 
Dave Longley
CTO
Digital Bazaar, Inc.

Received on Thursday, 13 June 2013 15:49:26 UTC