W3C home > Mailing lists > Public > www-rdf-interest@w3.org > November 1999

Re: Storing RDF in relational databases

From: Jonas Liljegren <jonas@paranormal.o.se>
Date: Mon, 15 Nov 1999 08:26:58 +0100
Message-ID: <382FB5C2.D1309606@paranormal.o.se>
To: Sergey Melnik <melnik@DB.Stanford.EDU>
CC: RDF Interest Group <www-rdf-interest@w3.org>
Sergey Melnik wrote:
> Could you cut-and-paste a couple of SQL statements that you use to query
> the DB? For example, how do you select all triples with a given subject
> (think of reification)?

I am using the same sequence for both reified statements and other
The subj ID could be either a atatement ID, a resource ID or an internal

First, get the id from the id from the URI:

                 select id, value, isprefix, lang
		 from resources
		 where uri=$euri

If not found, see if it is a statement, and if not,
extract the id from the uri it it is a local uri. Else, fail.
The id for the uri will be cached. And the resource will be
represented by an object with a number of methods.

Then. Just select the statements:

                  select id
		  from statements
		  where subj = $subj_id

This method will return a reference to a list of statement objects.
Every statement object will consist of references to its resource

/ Jonas  -  http://paranormal.o.se/myself/cv/index.html
Received on Monday, 15 November 1999 02:22:19 UTC

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