The SWRLJessTab is a plug-in to the SWRLTab in Protege-OWL that supports the execution of SWRL rules using the Jess rule engine.    (830)

Installation    (6RJ)

The SWRLJessTab is part of Protege-OWL and does not need to be downloaded separately. It has been available since version 3.2 beta, build 322 of Protege. However, the most recent beta build should be used when possible.    (6W6)

The Jess rule engine is not open source so must be downloaded separately. This engine is contained in a Java JAR called jess.jar, which is contained in the standard Jess distribution. This distribution can be obtained here. This JAR must be copied to the Protege-OWL plugins subdirectory in the Protege installation directory (i.e., the ./plugins/edu.stanford.smi.protegex.owl/ subdirectory of the Protege installation directory). Protege-OWL will automatically load this JAR file on startup if it is present in its plugins directory. If this JAR file is not present, the SWRLJessTab will display an error when it is activated. The 7.0 release version or later of Jess is required.    (8XM)

Activation    (6QN)

When the SWRLTab is activated, the SWRL Editor will display a list of icons for plugins that have registered themselves with the SWRLTab. These icons will be displayed on the top right of the SWRL rules table. The Jess tab is activated by pressing the "J" icon.    (6QO)

When it is pressed, the SWRLJessTab will be displayed within the SWRLTab in a window under the SWRL Editor.    (7GD)

http://protege.cim3.net/file/pub/images/SWRL/SWRLJessScreenshot.png    (7GE)

If the tab successfully loads the Jess rule engine, it will display a series of tabbed sub windows that can be used to interact with Jess. If it fails, an error message will be displayed indicating that the Jess rule engine was not found. The installation instructions above describe how to install the Jess rule engine so that the SWRLJessTab can find it.    (6QP)

Pressing the "J" icon again will hide the tab and deactivate the Jess rule engine. Note that when the tab is deactivated, the associated rule engine is deactivated too so all state that it may hold will be lost.    (6RC)

Interacting with the SWRLJessTab    (6RD)

The interaction between OWL and the Jess rule engine is user-driven. The user controls when OWL knowledge and SWRL rules are transferred to Jess, when inference is performed using those knowledge and rules, and when the resulting Jess facts are transferred back to Protégé-OWL as OWL knowledge. The paper "Supporting Rule System Interoperability on the Semantic Web with SWRL" gives a high-level overview of this process and describes how SWRL rules and OWL knowledge are represented in Jess.    (6QQ)

An explanation of the underlying software APIs that can be used to control this is described here. Basically, a generic bridge is provided that provides APIs can used to interact with the Jess inferencing mechanisms. This bridge is specialized for each rule engine implementation. A description of how to create one of these bridges for the Jess rule engine is outlined below.    (6QR)

The SWRLJessTab has eight tabbed subwindows that can be used to control and review this interaction. The primary tab is the Jess Control tab, which provides the control functionality. It provides a status window to display a record of the interaction between the user and Jess and three buttons to control the knowledge transfer and inference process.    (6QS)

The button marked "OWL+SWRL->Jess" will transfer all SWRL rules and appropriate OWL knowledge to the Jess rule engine. The status window will indicate the number of rules and OWL classes, properties, and individuals that have been transferred. Pressing the button again will clear all previously transferred knowledge in Jess and will reinitate the transfer process.    (6QT)

Five sub tabs in the SWRLJessTab can be used to examine the knowledge that has been transferred to Jess. The "Rules", "Classes", "Properties", "Individuals", and the "Restrictions" tabs lists the SWRL rules, OWL classes, OWL properties, OWL individuals, and OWL restrictions, respectively, as they are represented by Jess.    (6QU)

The "Run Jess" button can then be pressed to initiate the inference process. When pressed, Jess will run its inference engine and possibly generate new knowledge, which is represented as Jess facts. This inferred knowledge can be reviewed in the "Asserted Individuals" and "Asserted Properties" tabs.    (6QV)

At that point, this inferred knowledge can be passed back to OWL by pressing the "Jess->OWL" button. At the moment, this new inferred knowledge is not distinguished from asserted knowledge, as is the common practice with reasoner-inferred knowledge in Protege-OWL. We will be fixing this shortcoming in a later release.    (8AU)

Can I interact with the SWRL-Jess Bridge at the Java API level?    (6RF)

As mentioned above, a bridge mechanism is provided in Protege-OWL to allow interaction between an OWL knowledge base containing SWRL rules and a rule engine. This mechanism is described here. This bridge is specialized for each rule engine implementation. However, interaction with the bridge should be same irrespective of the underlying rule engine implementation.    (7GC)

An implementation for the Jess rule engine is supplied with the standard Protege-OWL distribution in a JAR called swrl-jess-bridge.jar. The source code for the SWRLJessTab is distributed separately from the Protege-OWL source code and is located in the SWRL-Jess bridge Subversion repository. A class inm this repository called SWRLJessBridge contains the Jess implementation. The constructor for this class takes an instance of the OWLModel class, representing the OWL knowledge base with its associated SWRL rules, and an instance of a Jess Rete object, which represents an instantiation of the Jess rule engine.    (6QZ)

The following code snippet shows the creation of a Jess bridge. It assumes that you know how to create an instance of an OWL model using the Protege-OWL API.    (6R0)

import edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.*;
import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
import edu.stanford.smi.protegex.owl.model.*;
import jess.*;

SWRLJessBridge bridge;
OWLModel owlModel
Rete rete;

...

owlModel = ... // Create using normal Protege-OWL mechanisms.
rete = new Rete(); // Will fail if jess.jar is not in CLASSPATH.

...

try {
  bridge = new SWRLJessBridge(owlModel, rete);
} catch (SWRLRuleEngineBridgeException e) {
  ... // Deal with exception.
} // try    (7GH)

Once the Jess bridge is created, the public methods it inherits from the SWRLRuleEngineBridge class can be used to interact with it. These methods are documented here.    (6RG)

Where can I get the source code for the SWRL-Jess bridge?    (6UX)

The source code is available in the SWRL Jess bridge Subversion Repository.    (6UY)

What are the limitations of the SWRL-Jess bridge?    (6RH)

It is very important to note that the bridge or associated rule engines such as Jess do not currently capture all OWL restrictions (the exceptions being owl:sameAs, owl:differentFrom, owl:allDifferent, owl:equivalentClass, and owl:equivalentProperty) and as a result possibly inconsistent knowledge can be inferred by Jess. When new Jess-inferred knowledge is inserted into an OWL knowledge base, a reasoner should immediately be executed to detect any inconsistencies. Such inconsistencies indicate conflicts between the SWRL rules and OWL restrictions and must be manually resolved by the user. Additionally, a conflict-free execution of the classifier may also infer new knowledge that may in turn produce information that may benefit from further SWRL inference, a process that may require several iterations before no new knowledge is generated. A more detailed discussion of these limitations is contained here.    (6RI)