FU Berlin

AG Netzbasierte Informationssysteme / Networkbased Informationsystems
Institut für Informatik, Fachbereich Mathematik und Informatik, Freie Universität Berlin







An Engine for SWRL rules in RDF graphs






Version: 2005-02-12

Update: 2005-06-27

Goal:

This is a prototype system to support reasoning with SWRL rules in RDF graphs. In particular, a bottom-up Datalog evaluation strategy has been adopted for computing the least Herbrand model of SWRL rules.  The system provides reasoning over RDF Schema taxonomies plus SWRL rules. OWL reasoning beyond RDF Schema inheritance is not considered in the current version of the engine, yet it is subject of future work.

Used Resources:

Sesame, an RDF database, acts as an RDF store for the initial ground triples as well as for the derived consequences.

For testing purposes, we use the "family" SWRL file from the Protege ontology library. Further on we borrow  a figure from a paper of Christine Golbreich to illustrate this file. In our use case we extend the12 rules provided in the original file with the recursive rules "Def-hasDescendent-base", "Def-hasDescendent-iter" and the rule "Def-hasChild" (cf. #why additional rules).

Download:

Sat Feb 12 2005 --- local.java or remote.java and myfamily.rdf

DIY:

(1)   In order to use the programs, it is necessary to install Sesame. 

Sesame can be deployed in several ways, and its lib is imported by both our Java programs:

local.java communicates with your local Sesame server, whose triples are kept in main memory. By default, we have set the URI as http://localhost:8080/sesame/, the login name as testuser, and the password as opensesame.

remote.java communicates with your remote Sesame server, whose storage is the installed database. For the remote case, the available URI, login name and password should be configured by the users themselves.

(2)    Sesame provides a Web interface to allow access to repositories through a common Web browser :

For local.java , select the "MySQL RDFS DB"

For remote.java, select the "Main Memory RDF Schema"

(3)   Let us "Go>>"
first        --- press "Clear" in the top menu to clear the previous issues;
second   --- press "Add(file)" in the top menu to add a SWRL file (such as myfamily.rdf);
third     --- press "SeRQL-S" or "Explore" (further information about the syntax of the query languages are provided by the Sesame tutorial);
fourth    --- click any resource, and the "Explore repository" window will pop up.
for example: (press "Append namespaces" to automatically add namespaces)
select * from {s} p {o} where o = <swrl:Imp>
and then press "Evaluate"
In the case of myfamily.rdf , it should be verified that, in the initial repository, there are 15 rules (#Figure 1 shows the rules in Protege and #Figure 2 illustrates the evaluation of the above query in Sesame) and 20 individuals, with 12 statements of "hasChild" as primitive assertions. Note that at this point there is no inference capability. #Figure 3 shows the statements for the rule  "Def-hasUncle", obtained by clicking on the corresponding rule name in  the list from #Figure 2. The type of the rule is swrl:Imp, the body is an anonymous node, and the head is another anonymous node. That is, the RDF syntax will compose a rule into lots of triples.

(4)    Well, it is the time to run our Java program!
sorry for your waiting, but it runs...
In the case of myfamily.rdf , a 4 times iteration is needed to reach the fixpoint (since the recursive rules are considered). Using the following hardware (Intel Pentium 3 processor, 451 MHz, 256 MB of RAM) under Microsoft Window XP,  it takes 132247 milliseconds for remote.java and 61979 milliseconds for local.java. Finally, return to the Sesame server Web page: now, it should tell us more about the considered family ontology, as shown below (cf. myfamilyresult.txt):

24 hasChild -> initial 12 hasChild
24 hasParent
12 hasFather
12 hasMother
14 hasSon
10 hasDaughter

14 hasSibling <- 7-pairs
07 hasBrother
07 hasSister
04 hasUncle
10 hasAunt
08 hasNephew
06 hasNiece

54 hasDescendent


Enjoy it, if it runs well on your computer ^_^

Contact:

Please contact Jing Mei : mei@inf.fu-berlin.de or mayyam@is.pku.edu.cn

Appendix:

Why additional rules?

Notice that in this myfamily.rdf SWRL file, 12 statements of "hasChild" are regarded as the only primitive assertions. In the original SWRL file the subject of the "hasChild" statements is always "Man". The following rule of "Def-hasChild" is appended, so as to reinforce characteristics for both "Man" and "Woman". That is: if one Person has a Child, then his/her spouse also has the same Child, where Person = Man or Woman.
hasChild(z,x) <-- hasChild(y,x) & hasConsort(y,z)

On the other hand, consider the recursive "hasDescendent" procedure. As seen below, the first rule is "Def-hasDescendent-base", for finding the direct descendent through the parent relationship; the second rule is "Def-hasDescendent-iter", for finding the indirect descendent with a recursive call to the current procedure.
hasDescendent(x,y) <-- hasParent(y,x)
hasDescendent(y,z) <-- hasParent(x,y) & hasDescendent(x,z)

Figure 1: SWRL rules in Protege

Figure 2: SWRL rules in Sesame

Figure 3: Def-hasUncle in Sesame

  What is SWRL Full?

For example, Narcissism(x) <-- likeType(x, t) & t(x), we have a variable of "t" being an OWL class due to "t(x)" and being an OWL individual due to "likeType(x, t)". Here, SWRL Full employs, making CEXTI(SI(owl:Thing)) = CEXTI(SI(rdfs:Resource)), CEXTI(SI(owl:ObjectProperty)) = CEXTI(SI(rdf:Property)), CEXTI(SI(owl:Class)) = CEXTI(SI(rdfs:Class)). Now, a new version of remote4full.java is for your testing.