« Optimizing, finally... | Main | On Datatypes in Wilbur »

2006-04-02

Rewrite Rule Engine

Wilbur employs an RDF(S) reasoner based on rewriting WilburQL queries so that the results reflect the deductive closure of the contents of the triple store (as described in my ISWC 2002 paper). I realized that with just a little bit of work (= 2 hours) I could generalize this in a "rewrite rule engine", where "virtual" properties can be associated with a more complex query expression; at access time, these properties are rewritten by substituting the query expression.

Moving right along, I realized that this (with minimal work) also buys me "computed properties", i.e., properties whose values are the result of some (access-time) computational process. These are like slot access daemons in frame systems. Properties instantiated from the class "AccessDaemon" (in the Wilbur RDF schema) are recognized by the query engine, who calls the method db-compute-daemon-values. One can specialize this method, using eql specializers, to associate behavior with a property.

For example, one could first, in some RDF document, say

<wilbur:AccessDaemon rdf:about="&example;timestamp"/>

and then, in the CL source code say

(defmethod db-compute-daemon-values ((db db)
                                     frame
                                     (slot (eql !example:timestamp)))
  (list (db-make-literal db (iso8601-date-string (get-universal-time))
                         :datatype !xsd:dateTime)))

Then, if you call, say

(all-values !example:foo !example:timestamp)

the result is something like

(#"2006-04-02T14:45:57-05:00"^^<xsd:dateTime>)

I think this is pretty cool. You don't have to agree.

Posted by ora at 15:06

Comments

Well, I think it's pretty cool :)

Posted by: Rich at April 2, 2006 06:19 PM

I think people must agree :) I thought about this too, but as always, I get distracted to easily.

Posted by: Michael at April 2, 2006 07:38 PM