Re: JSON as JSON-LD

On Apr 16, 2012, at 2:07 PM, mark@coactus.com wrote:

> Hey everyone,

Hi Mark,

> I managed to convince the RDF WG of the value of the following idea
> back in 2003 for RDF/XML, and wanted to try again now for JSON-LD.
> 
> The idea was that some existing XML documents should be able to be
> interpreted as RDF/XML.  So this;
> 
> <Person xmlns="something">
>  <Name>Mark</Name>
>  <City>Ottawa</Name>
> </Person>
> 
> means the same thing as if it were wrapped in rdf:RDF.
> 
> I had a look at the spec, and AFAICT (by looking at the spec, but also
> playing in the playground), this isn't the case with JSON-LD, i.e. the
> following JSON isn't also JSON-LD;
> 
> {"name":"Mark","city":"Ottawa"}

This _could_ be JSON-LD, if you either add an appropriate @context key to the object, or process it by providing a context which defines "name" and "city". There's also a mechanism for allowing a context to be added to a normal JSON document through an HTTP header [1], or by providing it as an API argument.

> Is there a reason why this isn't already the case? I'm still quite new
> to JSON-LD and don't have a feel for some of its goals, but as a new
> user, this would simplify things for me. And as I mentioned to the RDF
> WG, it's also a terrific tool in explaining the value of JSON-LD and
> also in aiding in migration from JSON to JSON-LD.

I think we got you covered.

> I should mention that despite using JSON-LD, I'm *not* using RDF, so
> I'm not at all concerned about the fact that "name" and "city" aren't
> grounded. I understand that will be a concern for others, but it would
> be nice if I weren't required to care about it ;-)

For processing as JSON-LD, they will need to correspond to IRIs, as everything ends up going through expansion, which drops keys that don't resolve to IRIs.

> Mark.
> 


Gregg

[1] http://json-ld.org/spec/ED/json-ld-syntax/20120318/#referencing-contexts-from-json-documents

Received on Monday, 16 April 2012 22:03:37 UTC