W3C home > Mailing lists > Public > public-rdfa@w3.org > April 2009

Re: [ANN] RDFj: Semantic objects in JSON

From: Mark Birbeck <mark.birbeck@webbackplane.com>
Date: Wed, 22 Apr 2009 22:57:47 +0100
Message-ID: <ed77aa9f0904221457u320a1ceen654b58325dab0d1@mail.gmail.com>
To: Toby A Inkster <tai@g5n.co.uk>
Cc: RDFa <public-rdf-in-xhtml-tf@w3.org>, "public-rdfa@w3.org" <public-rdfa@w3.org>
Hi Toby,

> Have you seen this?
> http://buzzword.org.uk/2008/jsonGRDDL/spec

No I haven't...but it's very interesting.

I take it that the goal is to work with JSON as one would do normally
in our applications, and then if you want to serialise out those
objects, to use jsonGRDDL to translate to RDF/JSON?

If so -- and please correct me if I'm wrong -- my use cases are
slightly different.

My first use-case was actually to get RDFa into my applications from
locations that caused cross-domain problems (parsing HTML documents
from another domain with my parser doesn't work in all browsers). Much
of the RDFa that I'm using contains JS functions, so when I wanted a
JSON equivalent for my data, I wanted functions and other objects to
be 'first-class' citizens.

However, it's my second use-case that in my view is more interesting,
and I think should explain why I didn't go for other JSON formats for
my RDF, and that is that I want to be able to use RDF objects directly
in my JS applications.

Obviously there's no such thing as an 'RDF object', but what I mean by
that is that by working out how JSON objects map to RDF, I can apply
'RDF features' to those objects.

There are many ways I could illustrate this, but one I've just
finished working on is a backward-chaining algorithm that operates
over JSON objects; each property of the object is treated as a simple

I've only got simple rules working at the moment, such as checking for
a specific value of a property, or checking that a property exists.
But even with these two basic features I can do things like fill in
missing properties in an object (i.e., infer them).

For example, after setting the appropriate rules, I can start with this object:

  var vehicle = {
    engine: true,
    wheels: 4

and find out what what type of vehicle we have, by calling the
backward-chaining function, like this:

  kb.bc("vehicleType", vehicle);

Although my plan is to use forward-chaining on the object to actually
keep the object up-to-date and add inferred properties -- hence the
notion of 'semantic objects' that I've mentioned -- my focus for now
is on adding more rule types for the backward-chaining. The reason is
that I started this whole thing because I want to be able to
'validate' objects. Using backward-chaining my validation step will
simply become:

  var foafPerson = { ... };

    { name: "valid", value: true },

and provided the correct rules appear in the knowledge base, I should
be able to establish whether the JSON object is 'valid' or not. Of
course, you've probably worked out that what I _really_ want to
validate is RDFa documents, and the rules I'll be processing will be
OWL constructs. :)

This is because, amongst the various RDFa projects I'm involved with,
a common problem I'm seeing is that people have no easy way to know if
they have their RDFa laid out correctly at the RDF level.

So, since I already have a parser that converts RDFa to triples, and I
already have a rudimentary SPARQL-like way to query across those
triples and create JSON objects with the results, then I figured that
I might as well do backward-chaining against the JSON objects, and
then put the whole sequence together to give me document validation.

A long answer to a short question, I realise...

All the best.



Mark Birbeck, webBackplane



webBackplane is a trading name of Backplane Ltd. (company number
05972288, registered office: 2nd Floor, 69/85 Tabernacle Street,
London, EC2A 4RR)
Received on Wednesday, 22 April 2009 21:58:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:03 UTC