Re: [JSON] Clarification on JSON-LD

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