an algorith to query triple stores in SQL

Some time ago (perhaps 18 months now), inspired by the proposed SQL
structures for triple storage presented in
http://www-db.stanford.edu/~melnik/rdf/db.html , I came up with a system
to automatically convert triples queries (in the style of RDFDB) into
SQL that could query a database with a schema similar to Eric Miller's
'naive approach'.

For example,

select ( ?x ?y ) from triple where (?x worksFor ?y) (?y name 'BBC')

is translated to

 SELECT a1.subject as x, a1.object as y
 FROM triple a1,triple a2
 WHERE
 a1.pred = 'worksFor'
 AND a2.subject = 'BBC'
 AND a2.pred = 'name'
 AND a1.object = a2.subject

Encouraged by (amongst others) Dan Brickley, Edd Dumbill and Libby
Miller, I finally got round to writing up this system and releasing
sample implementations in perl and php. Since I coded the original
system, Libby has based parts of the SquishQL query system on it, and Dan
has in turn based some of his code on that. 

The writeup makes it explicit that I encourage reuse of the system and
am happy to see it put to use in projects like this. The algorithm's
pretty simple and is language-independent (Libby transliterated it into
Java with many improvements, and Dan converted that code into Ruby).

More details here: http://www.picdiary.com/triplequerying/

Cheers,
Matt.

Received on Wednesday, 21 August 2002 15:44:29 UTC