Re: Querying reified statements

David Allsopp wrote:
> 
> Hi all,
> 
> I've been following the various proposals for querying RDF (RDFDB,
> Squish, RQL, RDFQuery etc) and was wondering if anyone has given any
> thought to querying reified statements.
> ...
> But if I wanted a query along the lines of "What do people say John
> Smith's age is?" I would need something like:
>   select ?a where (?x rdf:type Statement)(?x rdf:subject JohnSmith)(?x
> rdf:predicate age)(?x rdf:object ?a)
>...

Dear David,

Hm, this is quite a good case for an additional layer of abstraction. It
is straightforward to interpret reification as relations, as has been
done in [1], that is (triples are in s):

reifies(R,S,P,O) :-
	res(S), uri(P), s(R,rdf:type,rdf:'Statement'),
        s(R,rdf:subject,S), s(R,rdf:predicate,P), s(R,rdf:object,O).

reifies_fact(R,S,P,O) :- reifies(R,S,P,O), s(S,P,O).

Now, taking your example, you would query:

?- reifies(R,'JohnSmith',age,O).

You can try out this and similar queries easily with the RDF Schema
Explorer [2]. Dan has asked to develop a SQL-like interface, but I
haven't found the time to do it yet (but I promise to do it, since it's
a neat idea) - otherwise, your query could be stated as:

SELECT $1,$4 FROM reifies WHERE $2 = "JohnSmith" AND $3 = "age",

which would also be nice (only a little bit more phony ;)

I hope that you might find this useful?

Regards,
	Wolfram + Reinhold

[1] "A locigal interpretation of RDF",
http://nestroy.wi-inf.uni-essen.de/rdf/logical_interpretation

[2] RDF Schema Explorer, http://wonkituck.wi-inf.uni-essen.de/rdfs.html

Received on Wednesday, 13 December 2000 11:16:56 UTC