W3C home > Mailing lists > Public > public-linked-json@w3.org > August 2011

What is the JSON-LD API?

From: Danny Ayers <danny.ayers@gmail.com>
Date: Wed, 31 Aug 2011 19:35:22 +0200
Message-ID: <CAM=Pv=TNcniU-b_VGWV3nxr3yBG4CvYNQyVK5f_oFekrg9BkSA@mail.gmail.com>
To: public-linked-json@w3.org
I'm sure this has been discussed before, but it only just clicked for
me (dogwalks are good!).

JSON stands for Javascript Object Notation, right?

so if we say

   var object = parse( // bunch of JSON-LD // )

what methods does object support?

Say we've got the description of a book, what about:

   var object = parse( // bunch of JSON-LD // )
   var book = object.book
   var title = book.title

But straight from RDF we're looking at something more like:

   var graph = parse( // bunch of JSON-LD // )

   var rdf_ns = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   var dc_ns = "http://purl.org/dc/elements/1.1/"
   var books_ns = "http://example.org/books#"

   var books = graph.getSubjects(rdf_ns+"type", books_ns+"Book")

   var titles = graphs.getObjects(books[0], rdf_ns+"type")

   var title = titles[0]

I'd say the challenge is to support accessor methods that look more
like the first version above, and less like the second.

But here the thing - ideally want this to work *without* needing a
custom parser.

Looking at it from this point of view, CURIES needn't be a
complication, if we could do things like:

Regular JSON developer version:
   var object = parse( // bunch of JSON-LD // )
   var title = object.book["title"]

RDF person's version:
   var object = parse( // bunch of JSON-LD // )
   var p_title = { "dc", "http://purl.org/dc/elements/1.1/"  }
   var title = object.book[p_title]

So what do the accessor methods of JSON-LD look like today, *without*
a custom parser?


Received on Wednesday, 31 August 2011 17:35:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:53:18 UTC