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

Re: [JSON] Clarification on JSON-LD

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Thu, 10 Mar 2011 11:47:46 -0500
Message-ID: <4D7900B2.8090003@digitalbazaar.com>
To: RDF Working Group WG <public-rdf-wg@w3.org>
On 03/10/11 09:05, Ivan Herman wrote:
> I try to familiarize with the different JSON inputs. Looking at
> JSON-LD, two questions:
> 
> Is it correct that
> 
> { "foaf:name" : "Ivan" }
> 
> translates into
> 
> [ foaf:name : "Ivan" ]

Yes. I'm not great with TURTLE, so for the avoidance of doubt, the above
is the same as this:

@prefix foaf: <http://xmlns.com/0.1/foaf/> .
_:bnode1 foaf:name "Ivan" .

> ie, that if I do not have the "@" there, then it is considered to be
> a blank node in RDF terms?

Correct.

> Also, is it so that I can say
> 
> { "ex:prop : { "foaf:name" : "Ivan" } }
> 
> meaning
> 
> [ ex:prop [ foaf:name "Ivan" ] ]
> 
> ie, the subject can be a complete JSON object?

Yes. However, I'm going to be pedantic here: In JSON-LD, the "value" of
the JSON key-value pair can be an associative array. An associative
array in JSON-LD can be thought of as a self-contained graph. When it is
in the "value" position, the current predicate is linked to the
self-contained graph. That is, this:

{ "ex:prop" : { "foaf:name" : "Ivan" } }

would give you this:

@prefix foaf: <http://xmlns.com/0.1/foaf/> .
_:bnode1 ex:prop _:bnode2 .
_:bnode2 foaf:name "Ivan" .

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: Payment Standards and Competition
http://digitalbazaar.com/2011/02/28/payment-standards/
Received on Thursday, 10 March 2011 16:48:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:04:04 UTC