The SWRLJessTab is a plug-in to the SWRLTab that supports the execution of SWRL rules.    (6QM)

Activation    (6QN)

When the SWRLTab is activated, the SWRL Editor will display a list of icons for rule engines that have registered themselves with the rule engine bridge. 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. 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 below 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 seven 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)

Four sub tabs in the SWRLJessTab can be used to examine the knowledge that has been transferred to Jess. The "Jess Rules", "Imported Jess Classes", "Imported Jess Properties", and the "Imported Jess Individuals" tabs lists the SWRL rules, OWL classes, OWL properties, and OWL individuals, 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 Jess Individuals" and "Asserted Jess Properties" tabs.    (6QV)

At that point, this inferred knowledge can be passed back to OWL by pressing the "Jess->OWL" button.    (6RE)

Can I interact with the 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.    (6QW)

An implementation for the Jess rule engine is supplied with the standard Protege-OWL distribution. A class called SWRLJessBridge defines this implementation. This class is located in the following package:    (6QX)

edu.stanford.smi.protegex.owl.swrl.bridge.jess    (6RL)

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.*; {nid 6R1}

SWRLJessBridge bridge;
OWLModel owlModel
Rete rete; {nid 6R2}

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

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

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)

Limitations    (6RH)

It is very important to note that the bridge or associated rule engines such as Jess do not currently capture OWL restrictions and that conflicts can arise between the new knowledge inserted into an OWL knowledge base and OWL restrictions. When new knowledge is inserted into an OWL knowledge base, a reasoner should be executed to detect possible inconsistencies. Any inconsistencies found 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)

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 Jess rule engine must be downloaded separately. This engine is contained in a Java JAR called jess.jar, which is contained in the standard Jess distribution. This JAR must be copied to the Protege-OWL plugins subdirectory in the Protege installation directory. This subdirectory is called:    (6R9)

plugins/edu.stanford.smi.protegex.owl.    (6RK)

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.    (6RB)