W3C home > Mailing lists > Public > www-rdf-interest@w3.org > August 2002

an algorith to query triple stores in SQL

From: Matt Biddulph <matt@picdiary.com>
Date: Wed, 21 Aug 2002 20:45:00 +0100
To: www-rdf-interest@w3.org
Message-ID: <20020821204500.A3638@picdiary.com>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:55 GMT