Re: [ANN] RDFj: Semantic objects in JSON

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
fact.

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 = { ... };

  kb.prove(
    { name: "valid", value: true },
    foafPerson
  );

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.

Regards,

Mark

-- 
Mark Birbeck, webBackplane

mark.birbeck@webBackplane.com

http://webBackplane.com/mark-birbeck

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:32 UTC