Re: JSON as JSON-LD

On 04/17/2012 03:29 PM, mark@coactus.com wrote:
> Hi Markus,
>
> On Mon, Apr 16, 2012 at 6:11 PM, Markus Lanthaler
> <markus.lanthaler@gmx.net>  wrote:
>>> {"name":"Mark","city":"Ottawa"}
>> It is valid JSON-LD but not valid linked data as there's no way to map those
>> two properties (name&  city) to a IRI. You would need a context to do so.
> Understood about the context, but I don't understand the distinction
> you make there.
>
> It's certainly not a serialized RDF graph; is that what you mean by
> "not valid linked data"?
>
> But what does it mean that it's valid JSON-LD? I tried it in the
> playground, and it yielded the same result as an empty dictionary.

What did you try specifically? You can click the "permalink" button and 
then run the result through a URL compressor (which we should add to the 
playground but haven't gotten around to it) like I did here:

http://tinyurl.com/7hprema

If you add context to your data (as mentioned previously) either through 
an HTTP-header, inline, or through an API call (as in the playground 
example I linked to) you can make that Mark/Ottawa example valid 
JSON-LD. You can see that it doesn't produce an empty dictionary when 
compacting, expanding, converting to turtle, etc.

What it means to be "valid JSON-LD" here is that each of the properties 
in your object have an associated IRI. Those associations can be made 
"after-the-fact" via the "@context" object I mentioned and put in the 
above example. This way you can turn your existing JSON into "valid 
JSON-LD" when you're ready to move to Linked Data land.

-- 
Dave Longley
CTO
Digital Bazaar, Inc.

Received on Tuesday, 17 April 2012 19:52:19 UTC