[foaf-dev] RDF/SPARQL in Sqlite/.js again

Dan Brickley danbri at danbri.org
Mon Jun 14 11:07:10 CEST 2010


Hi Bengee, foafers,

I've been poking around some Firefox stuff -
http://wiki.foaf-project.org/w/FirefoxContacts

... and thinking again about doing RDF inside Sqlite,
http://wiki.foaf-project.org/w/Gradgrind#Next_Steps

This partly in reaction to watching Moz discussions about indexeddb vs
webdatabase APIs,
http://hacks.mozilla.org/2010/06/comparing-indexeddb-and-webdatabase/
...and thinking SPARQL is actually quite appealing as a mid-point
between the approaches.

Dataset: http://svn.foaf-project.org/foaftown/2010/gradgrind/examples/candyshop.html
(kids buying sweets)

Another use case - Firefox contacts,
http://wiki.foaf-project.org/w/FirefoxContacts

So I made an RDF dataset in RDFa from Moz example dataset, and started
testing some queries. This one for eg is to discover which kid began
the craze for eating 'Space dust' that has swept through the school:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX c: <http://candy.foaf.tv/>
SELECT ?d ?who
WHERE { ?p a c:Purchase; c:item [ foaf:name "Space dust" ] ; c:when
?d;  c:buyer [ foaf:name ?who ]  }
ORDER BY ?d
LIMIT 1

Ok maybe that's not the best idiom for 'earliest' but it works in ARC.

I'd like it to work in Firefox/.js too. I know there is some stuff in
Tabulator (hence Oshani/TimBL cc:) for SPARQL, at least for parsing
its syntax and mapping to some in-memory Tabulator APIs.

So my thinking:

It would be good to agree a common RDF table layout for Sqlite, so we
could either simply persist quads there (and do SPARQL in memory with
tabulator), or eventually rewrite SPARQL into Sqlite SQL.

Question: is ARC's table layout a good thing to try to port over to
Sqlite? I began that (via http://sqlfairy.sourceforge.net/) but only
managed to get the schema converted automatically, not the instance
data. If we stick to essentially the same layout, I have naive hope
that it might be possible for some poor soul to slog through and
convert ARC's PHP code into Javascript.

I'm off for meetings for a week but wanted to throw these experiments
out there. Thanks for any thoughts!

Dan


More information about the foaf-dev mailing list