[ Team LiB ] Previous Section Next Section

10.2 Roots: rdfDB QL

One of the earliest persistent data stores for RDF was R.V. Guha's rdfDB, a database built from the ground up to store RDF data. This database, written in C and primarily tested within a Linux environment, uses a specialized language derived from SQL, a language he called "...a high level SQLish query language," to manipulate and query RDF data within the database.

You can download a copy of rdfDB at http://guha.com/rdfdb/. Note that there has been little activity with this database in the last few years; I'm including coverage of it here primarily for historical perspective.

In Guha's language, you can create a database, insert or delete rows from it, and query it. A row in his language would be an RDF triple, in the format of arc-source-target, somewhat different from N-Triples and other languages that portray an RDF triple as source-arc-target. However, the principles are the same.

For instance, to insert a row, use the following syntax (taken from Guha's sample session online):

insert into test1 (type DanB Person), (name DanB 'Dan Brickley') </>

If the result is successful, the database returns 0; otherwise, a negative value representing the type of error that occurred with the statement is returned.

The data is queried by forming a select statement that provides a variable or variables for resulting data, a from clause giving the database name, and a where clause made up of triples in the format of arc-source-target, with placeholders in the position of unknown values. Again from the sample he provides at his web site:

select ?x from test1 where (worksFor ?x W3C) (name ?x ?y) </>

The results are returned on separate lines, variables mapped to values:

?x = DanC ?y = 'Dan Connolly'
?x = DanB ?y = 'Dan Brickley'

Though Guha's rdfDB was the precursor to much of the effort in querying RDF, he hasn't worked on the database recently. However, others took up the effort he pioneered and have since worked to enhance and improve on it. Among these is the Inkling database and SquishQL, an open source effort that included contributions from Leigh Dobbs, Libby Miller, and Dan Brickley.

    [ Team LiB ] Previous Section Next Section