- From: Gregg Kellogg <gregg@kellogg-assoc.com>
- Date: Fri, 23 Mar 2012 15:42:00 -0400
- To: elf Pavlik <perpetual-tripper@wwelves.org>
- CC: Linked JSON <public-linked-json@w3.org>
On Mar 23, 2012, at 11:39 AM, elf Pavlik wrote: > Hi, I've asked on XMPP related mailing list about opinion on JSON-LD, must admit still need to catch up with your work here myself! Could someone comment on the JSON-LD limitation in context Jack have mentioned below? Thanks =) > > --- Begin forwarded message from Jack Moffitt --- > From: Jack Moffitt <jack@metajack.im> > To: strophe <strophe@googlegroups.com> > Date: Fri, 23 Mar 2012 17:25:32 +0000 > Subject: Re: XMPP and JSON-LD? > >> I've noticed in one of old threads mention of speed gain using JSON. Someone reply on lack of extensibility using it, lately I found very active group working on JSON-LD (JSON Linked Data) >> http://json-ld.org/ >> http://www.w3.org/community/json-ld/ > > It's easy to see why JSON fails here. If I decide I want to add data > to the "name" tag, I can't in JSON. It's a string, so it can't be > extended. JSON-LD let's me override the meaning of that tag, but then > no one else will understand the original meaning. There are a number of ways that JSON-LD allows you do do this. Without modifying the markup at all, you could add information to the context document (the document which is used to translate JSON keys and values into IRIs or other typed data), or you could do it inline in the data itself. For example, you might have information about John Lennon in native JSON: { "name": "John Lennon", "birthday": "1940-10-9", } You can provide more context to this, either through adding a context as part of an HTTP header, or by adding information to the doccument: { "@context": { "xsd": "http://www.w3.org/2001/XMLSchema#", "foaf": "http://xmlns.com/foaf/0.1/", "name": "foaf:name", "birthday": {"foaf:birthday", "@type": "xsd:date" }, "name": "John Lennon", "birthday": "1940-10-9", } The context can also be specified by adding a link to an external document that defines the context. { "@context": "http://example.com/context-definition.jsonld", "name": "John Lennon", "birthday": "1940-10-9", } JSON-LD also allows you to define data elswhere, either as another part of the document, or in a separate document. By adding an identifier to the object definition, you're asserting information about that resource, that can also be asserted by another location; this is the whole idea of Linked Data (the LD in JSON-LD). { "@id": "http://dbpedia.org/page/John_Lennon", "@context": "http://example.com/context-definition.jsonld", "name": "John Lennon", "birthday": "1940-10-9", "member": "http://dbpedia.org/resource/The_Beatles" } In summary, JSON-LD is intended to be used with existing JSON data adding minimal markup. Gregg > You'd have to create sibling tags that extend it, and then it just > becomes a big mess. > > Compare this to XML: > > <name>John Lennon</name> > > which I can extend easily: > > <name myns:type="musician"> > John Lennon > <myns:pronunciation>....</myns:pronunciation> > </name> > > Old apps that know nothing of my namespace or it's meaning will still > see exactly the same data, and I didn't have to create extension > points in unrelated areas of the document. > > For XMPP, these are real issues, as this kind of extension is what the > protocol is built on. > > jack. > > --- End forwarded message --- >
Received on Friday, 23 March 2012 19:43:12 UTC