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
 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/

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:44:37 UTC