Professional Documents
Culture Documents
Using JessTab to
Integrate Protégé
and Jess
Henrik Eriksson, Linköping University
with and control external programs. External programs must sometimes control a devel-
Integration with
opment environment. For example, it is often useful to create programs that perform
external systems, such
operations on ontologies or modify a knowledge base mapping between these tools’ knowledge represen-
as problem solvers, is in certain ways. We might want to define rules that tation schemes, JessTab lets us build knowledge
trigger actions after matching knowledge base pat- bases in Protégé that work with Jess programs and
becoming increasingly terns, or run a problem-solving method and record rule bases. JessTab can also propagate modifications
the results in a knowledge base. Integrating devel- automatically to mapped Protégé instances on Jess.
important for ontology opment environments with other software is a criti-
cal factor for using these systems in a range of orga- JessTab integration model
development and nizations and a key to widespread acceptance of such A Jess engine running inside the Protégé frame-
environments. work is the basis for the JessTab integration model
knowledge-modeling Protégé1 is a popular, modular ontology devel- (see Figure 1a). Because Protégé and Jess are imple-
opment and knowledge acquisition tool. It produces mented in Java, we can run them together in a single
tools. The author’s output (that is, ontologies and knowledge bases) that Java virtual machine. This approach lets us use Jess
other programs can read. Protégé assumes that the as an interactive tool for manipulating Protégé
JessTab extension system’s performance engine runs as a separate pro- ontologies and knowledge bases. Furthermore, we
gram, perhaps on a different platform. This separa- can propagate changes in Protégé to Jess (for exam-
lets you write Jess tion is often advantageous because the development ple, by monitoring Protégé events).
and runtime environments are different. Neverthe- There are several alternative approaches to inte-
programs that manage less, tight integration with the performance engine grating systems such as Protégé and Jess. The main
is sometimes essential. Currently, we can access considerations are as follows:
Protégé ontologies and Protégé knowledge bases using Java and an appli-
cation-programming interface, but doing so is time • Information transfer. We can transfer information
knowledge bases. consuming. between systems in different ways. Loosely cou-
I built a plug-in called JessTab (www.ida.liu.se/ pled systems use files to communicate asynchro-
~her/JessTab), which integrates Protégé with Jess, a nously. Other systems communicate directly
light, fast rule engine and scripting environment. (See through network connections (such as TCP/IP
the “Background” sidebar on page 46 for more streams, Corba, and remote method invocation).
detailed information on Jess, Protégé, and the Pro- Tightly coupled systems try to integrate the soft-
tégé Axiom Language.) By creating a declarative ware (for example, by merging source code).
Jess> (facts)
about the instance.)
JessTab asserts facts based on a certain
pattern-match on mapped f-0 (object (is-a Person) (is-a-name “Person”)
pattern (template). The pattern starts with (OBJECT <External-Address:SimpleInstance>)
object and always contains the class name and instances in many ways. (age 20) (name “John”))
a direct reference to the Protégé object. As For a total of 1 facts.
the example shows, the instance’s slot–value
pairs are also part of the fact. The mapping This fact represents the instance of the class
mechanism asserts a fact for every instance Mapping from instances to facts is uni- Person we created. In addition to the class name
(of a mapped class). Creating a new instance directional because changes to the Jess fact and the slot–value pairs, the fact contains a
of the class Person, for example, will result in list, such as fact assertions, are not propagated reference to the actual Protégé instance (the
the assertion of a new fact matching the back to the Protégé knowledge base. How- Java object representing it). This reference is
instance. ever, we can make changes to the knowledge useful when defining rules that perform oper-
The motivation for designing this type of base from Jess by calling functions that oper- ations on the object in the action part. The is-
mapping to facts is that it lets us define Jess ate on knowledge base constructs. a-name value is a string version of the class
rules that pattern-match on mapped instances name, which is useful in some rule patterns.
in many ways. For example, we can write Knowledge base operations Because the class Person is marked as
rules that match instances regardless of their from Jess mapped, changing a Protégé slot value results
class by using a wild card for the is-a prop- JessTab provides several functions for in a change of the corresponding fact. We use
erty. The pattern (object (is-a ?) (name “John”)) retrieving information from Protégé knowl- the slot-set function to change the age to 21:
matches every (mapped) instance that has a edge bases and for modifying them. Func-
slot name with the value “John.” (The charac- tions exist for getting slot values from Jess> (slot-set john age 21)
ter ? represents a wild card in patterns.) instances, defining new classes, and instan- Jess> (facts)
In addition to wild-card matching, it is tiating classes. Whenever possible, these f-1 (object (is-a Person) (is-a-name “Person”)
often useful to define rules that match functions are compatible with their corre- (OBJECT <External-Address:SimpleInstance>)
instances of several alternative classes. The sponding Clips counterparts (if any). (age 21) (name “John”))
mapping ensures that the is-a fact slot con- How can we use JessTab to create Protégé For a total of 1 facts.
tains the unique class name for the instance classes and instances from Jess? Just as in
(as a Jess atom). Fortunately, Jess provides a Clips, we can use the defclass construct to cre- When we change a fact property, Jess actu-
rich language for rule patterns, which lets us ate a new class and attach slots to it. (Jess ally retracts the old fact and asserts a new ver-
express classes that match in several ways. also implements an alternative format for sion of it—that is, the fact number changes.
One approach is to match several alternative defclass.2 Advanced developers can use this This behavior is normal Jess semantics.
Background
Some background information on the current Protégé we cannot use it to define inferences and behaviors. We invoke
implementation (http://protege.stanford.edu), the comple- PAL explicitly to perform constraint checking. The result of this
mentary Protégé Axiom Language extension, and the Jess process is a report (rather than a behavior). Unlike Jess, PAL is
language (http://herzberg.ca.sandia.gov/jess) and its imple- custom tailored for expressing constraints when checking
mentation should help users understand and use the JessTab knowledge bases.
implementation. Jess and PAL are complementary languages; we can use PAL
to test a knowledge base’s integrity, whereas we can use Jess
to implement operations on the knowledge base. Because Jess
Protégé is Turing complete, we can use it to implement custom-tailored
The Protégé tool supports knowledge acquisition and knowl- constraint checkers and programs that modify the knowledge
edge base development.1 It is a powerful development and base.
knowledge-modeling tool with an open architecture. Protégé
includes an ontology editor and a system for generating and
custom-tailoring forms for data entry by domain specialists.
Jess
The user interface consists of several tabs that provide differ-
Jess2 is a reimplementation of a subset of Clips3 in Java. Jess
ent views of the knowledge base. For example, tabs exist for
implements some additional functionality not provided by
ontology editing, form layout, knowledge entry, and knowledge
Clips. Like Clips, reasoning in Jess is based on a list of known
base search. Protégé is implemented as an open-source Java
facts and a set of rules that try to match on these facts in its
application.
fact base.
An important feature of Protégé is the possibility to extend
Facts are basically a list of known values, such as (temperature
its functionality through plug-in modules. By defining slot-
outdoor 25), which represents the value 25 for the temperature at
widget plug-ins, we can extend the functionality of data entry
the outdoor location. The rules’ preconditions are patterns
widgets (for example, by implementing new interaction modes).
with wild cards and conditional expressions, which match such
The mechanism for tab-widget plug-ins lets us add new tabs to
facts. For example, the pattern (temperature ? ?t&:(> ?t 20)) matches
the Protégé user interface. Developers often use this plug-in
temperatures greater than 20, while ignoring the location.
application programming interface to implement project-
Rules can assert new facts when they fire, which in turn could
specific tabs that provide unique views of the knowledge base.
result in other rules firing. Jess uses the Rete algorithm to ensure
The Protégé Java API lets us control the ontology’s internal
efficient pattern matching and rule activation. Jess supports
representation. For example, we can create new classes and
mainly forward chaining and, to some extent, backward chaining.
instances programmatically. Although we can use this API to
Integrating Jess with other Java programs is easy because it
manage all aspects of the Protégé internal representation,
has a well-defined API for controlling the reasoning engine
doing so is complicated because of the API’s flexible but low-
from Java. For example, Java programs can send expressions to
level nature.
the Jess engine for evaluation. In addition, we can define new
The tool has no performance engine, so we must use proce-
Jess functions in Java. The JessTab implementation takes advan-
dural Java code to access the API.
tage of the Jess API to map information in the Protégé knowl-
edge base to Jess facts and to extend Jess with additional func-
tions for communication with Protégé.
Protégé Axiom Language
PAL is a language for expressing constraints in Protégé
knowledge bases. It is based on first-order predicate logic. PAL References
lets us define constraints that the PAL interpreter can check.
Once the knowledge base under development is in a reason- 1. J.H. Gennari et al., “The Evolution of Protege: An Environment for
ably coherent state, we can invoke the PAL engine to check Knowledge-Based Systems Development,” Int’l J. Human–Computer
consistency with respect to the constraints. PAL then reports Studies, vol. 58, no. 1, 2003, pp. 89–123.
any constraint violations. PAL is implemented as a tab-widget
2. E.J. Friedman-Hill, Jess in Action: Java Rule-Based Systems,
plug-in to Protégé. Manning, 2003.
The main difference between JessTab and PAL is that JessTab
lets us use Jess as a programming language and inference 3. CLIPS Reference Manual, Software Technology Branch, Lyndon B.
engine. PAL, however, is not a programming language because Johnson Space Center, NASA, 1991.
Creating a second instance adds a new fact f-1 (object (is-a Person) (is-a-name “Person”) Because the mapping of the class Person is
to the Jess list of facts: (OBJECT <External-Address:SimpleInstance>) reactive, JessTab asserts a new fact automat-
(age 21) (name “John”)) ically when we create a new instance.
Jess> (make-instance sue of Person (name “Sue”) f-4 (object (is-a Person) (is-a-name “Person”) We can now write a Jess rule that pattern-
(age 22)) (OBJECT <External-Address:SimpleInstance>) matches on the facts. The following rule
<External-Address:SimpleInstance> (age 22) (name “Sue”)) prints the name for every person age 21 or
Jess> (facts) For a total of 2 facts. older:
Protégé ontologies. Functions such as class- ment. For example, such Jess scripts can cre- as slots and facets, using the same approach.
subclasses and class-slots return information about ate, modify, and move sets of classes in large For example, we can print out all slots with
the ontology’s structure. Programs that ana- ontologies. The major advantages of using a certain value type.
lyze ontologies can then use this information Jess over Java are that we can develop and Another application is to modify the ontol-
to discover ontology properties and to draw test programs quickly (through the interac- ogy (or the instances) in rule conclusions.
conclusions from the ontologies. Examples tive Jess console) and that we can use the Jess For example, the following rule changes the
of such analysis tasks are searching for cer- rule engine to write declarative programs for role to abstract for classes that have sub-
tain patterns, detecting inconsistencies, and managing ontologies. classes but do not have any instances:
generating reports. As I mentioned previously, another way
These basic reflection functions are simi- of using JessTab is to use it as the basis for a Jess> (defrule make-abstract
lar to the ones Clips provides. In JessTab, problem solver, which could then operate ?c <- (object (:NAME ?n)
however, programmers get direct access to directly on metalevel objects. (:ROLE Concrete)
the ontology as it evolves in the editor. In (:DIRECT-INSTANCES))
addition to the basic reflection functions, Mapping metaclasses (not (object (:NAME ?n)
JessTab provides a means for advanced The Protégé metaobject model and the Jess- (:DIRECT-SUBCLASSES)))
reflection. Tab support for handling classes as instances =>
apply to the JessTab mapping functions. Jess- (slot-set ?c :ROLE Abstract))
Metalevel objects
Protégé provides advanced support for The left-hand side of this rule matches
metalevel objects.3 Every class has a meta- classes where the value of the
class, and every slot has a metaslot. Protégé
users can create custom metaclasses by extend- The metalevel objects in Protégé • :ROLE slot is Concrete
ing the standard metaclass (:STANDARD-CLASS). • :DIRECT-INSTANCES slot is an empty list
Custom metaclasses can contain additional are not only useful for extending • :DIRECT-SUBCLASSES slot is not an empty list
slots, which result in new class properties and
new fields on the class-editor form. The met- the ontology editor, they are also Mapping system classes lets the Jess pro-
alevel objects in Protégé are not only useful for gram examine the ontology declaratively
extending the ontology editor, they are also the
basis for ontology reflection and modification.
the basis for ontology reflection through the list of facts rather than function
calls such as class-abstractp, slot-get, and facet-get.
Examining and manipulating such meta-
level objects is a powerful tool for ontology
and modification. Protégé’s metaobject protocol is suitable for
this task because we can view classes, slots,
management. We can handle classes as reg- and facets as regular instances and first-
ular instances in Jess and apply functions for class citizens.
manipulating instances to classes. For exam-
ple, instantiating a metaclass is equivalent to Tab can map instances of Protégé metaclasses Definition mirroring
creating a regular class. The expression to facts just as it maps regular instances to facts. JessTab adds the mirroring of Jess defini-
This functionality lets us map class defini- tions in Protégé ontologies and knowledge
(make-instance A of :STANDARD-CLASS tions—that is, instances of metaclasses—to bases. This mirroring is a reflective mapping
(:DIRECT-SUPERCLASSES :THING)) facts. The expression (mapclass :STANDARD-CLASS) from Jess to Protégé. During initialization,
maps all classes to facts. JessTab adds Jess-related system classes to
creates a new Protégé class A, which is a sub- Now we can write Jess rules that pattern- Protégé. Jess constructs such as defrule and def-
class of :THING. By setting the value of the match metaobject values. For example, the function have corresponding system classes
:DIRECT-TEMPLATE-SLOT slot of the class, we can following Jess code prints out all abstract (:JESS-RULE, :JESS-FUNCTION, and so on). Figure 3
attach slots to the class. The expression classes in the ontology: shows the system classes added by JessTab.
Instances of these classes represent actual def-
(slot-set A :DIRECT-TEMPLATE-SLOTS Jess> (mapclass :STANDARD-CLASS) initions in Jess. For example, when we define
(create$ (instance-address :NAME))) :STANDARD-CLASS a Jess rule, JessTab will automatically create
Jess> (defrule print-abstract a corresponding instance of the class :JESS-RULE.
sets the slots for the class A. The slot list now (object (:NAME ?n) (:ROLE Abstract)) Several advantages exist for mirroring Jess
consists of the (predefined) slot :NAME. Thus, => definitions in Protégé. Because the instances
we can view the defclass function as “syn- (printout t ?n “ is abstract.” crlf)) representing Jess definitions are regular Pro-
tactical sugar” for the standard metaclass TRUE tégé instances, we can edit them using forms.
instantiation. Jess> (run) Figure 4 shows the form for an instance of a
Jess can essentially perform all the ontol- Jess rule in Protégé. Furthermore, we can
ogy operations available from the Protégé The left-hand side of this rule matches map these instances to Jess facts in the same
GUI by manipulating metalevel objects. This classes (metaclass instances) where the value way we map other instances. Thus, this func-
functionality lets us use Jess as a scripting of the :ROLE slot is Abstract. In the same way, we tionality lets us write Jess programs that
language for supporting ontology develop- can pattern-match other system classes, such examine themselves.
Discussion
During the course of development, both the
user and developer communities broadened
Protégé’s scope from an environment that
mainly supported knowledge acquisition from Figure 3. Jess system classes in Protégé.
domain experts (by generating knowledge
acquisition tools) to a general tool for ontol-
ogy and knowledge base development with an
open architecture.1 The advantage of today’s
Protégé is the combined power of the plug-in
components and the ability to tailor the envi-
ronment by developing custom components.
A practical goal is for JessTab to be a use-
ful tool for projects originating from both the
Protégé and Jess communities. For the Pro-
tégé user, the JessTab extension adds a per-
formance engine to Protégé and support for
a declarative mapping between Protégé and
Jess. For the Jess developer, JessTab makes
it possible to take advantage of Protégé as a
graphical development environment and use
third-party plug-ins (tabs) added to Protégé.
A development tool and a performance sys-
tem working together is a powerful combina-
tion, and one we can use in several ways. Com-
bining graphical environments and reasoners
is not a new approach. In the mid-1980s,
hybrid tools such as KEE featured graphical
development environments. These tools, how-
ever, did not have the richness and flexibility
of current knowledge-modeling tools, and they
lacked the suppleness of the Java-based Jess
engine. JessTab lets us use the performance
system for ontology and knowledge base
Figure 4. A Jess rule as a Protégé instance. This instance represents the rule
development (for example, using Jess to query print-abstract. The instance form serves as a rule editor.
and modify ontologies). There are also recent
tools that have performance counterparts, such
as OntoEdit (which uses Ontobroker4), Web- Defining the requirements for JessTab is taining JessTab is that it combines two sys-
ODE,5 WebOnto,6 and Ontosaurus7 (which not an obvious task. A major technical chal- tems, both of which are under active and
uses Loom). lenge for designing, developing, and main- sometimes experimental development. They
are two separate moving targets. In addition The current users of JessTab range from
to this dynamic software environment, there ontology maintainers to agent-based systems T h e A u t h o r
are emerging user communities. The Jess and developers. For example, developers use
Protégé user communities consist mainly of JessTab for Web data mining, medical advi- Henrik Eriksson is a
researchers and developers who are design- sory systems, and implementation of problem- professor of computer
science at Linköping
ing their own systems. Our goal is to make solving methods. Currently, there are several University. He has a
future JessTab requirement specification and hundred JessTab users, most of whom are PhD in computer sci-
development a community process as much researchers and developers working on ence from Linköping
as possible. We welcome requests for addi- advanced projects with specific goals. They University. His research
interests include knowl-
tional functionality, and we invite others to use Protégé and Jess as building blocks in their edge-based systems,
extend the system by encouraging source systems, and they often extend Protégé and knowledge acquisition, reusable problem-solv-
code development. Jess—for instance, by developing custom-tai- ing methods, the Semantic Web, medical infor-
Generalizing the JessTab approach beyond lored plug-ins. Some developers use Protégé matics, and ubiquitous computing. Contact him
Jess is an interesting prospect. Currently, and Jess as rapid-prototyping tools; they pre- at the Dept. of Computer and Information Sci-
ence, Linköping Univ., S-581 83 Linköping,
JessTab serves as an example of how you can fer reimplementing their production systems Sweden; her@ida.liu.se.
integrate programming languages, expert- in a different environment (for example, for
system shells, and other performance engines interoperability and performance reasons).
with Protégé. Although the mapping from
Protégé instances to facts is Jess-specific, we tems Development,” Int’l J. Human–Computer
can mirror structures in Protégé to other sys- Studies, vol. 58, no. 1, 2003, pp. 89–123.
tems. From a communication perspective,
integrating systems implemented in Java, the
same programming language that Protégé
T he JessTab project contributes to the
understanding of how ontology editors
and performance systems can work together.
2. E.J. Friedman-Hill, Jess in Action: Java Rule-
Based Systems, Manning, 2003.
uses, is relatively straightforward. (Examples This understanding includes the mapping 3. H. Eriksson et al., “Automatic Generation of
of such integrated Protégé plug-ins are from the Protégé knowledge representation Ontology Editors,” Proc. 12th Workshop
JessTab, PrologTab, and the Algernon rea- to the Jess representation and the use of Jess Knowledge Acquisition, Modeling, and Man-
agement, Univ. Calgary, 1999, pp. 4.6.1–4.6.20.
soner.) However, we can achieve integration definitions as system classes in Protégé
with systems running in other environments ontologies. In practice, JessTab contributes 4. S. Decker, “Ontobroker: Ontology Based
through Corba or native interfaces. (Exam- to the Protégé community by enabling the use Access to Distributed and Semi-structured Infor-
ples of Protégé tabs that take advantage of of Jess under Protégé. JessTab also supports mation,” Proc. DS-8: Semantic Issues in Multi-
media Systems, Kluwer, 1999, pp. 351–369.
this approach are the OntoViz, OIL, and the Jess community by allowing the use of
Flora tabs.) Although appealing, a general- Protégé as an object-oriented extension to 5. J.C. Arpirez et al., “WebODE: A Workbench
ized tab for any programming language Jess and by providing a tool for using Protégé for Ontological Engineering,” Proc. 1st Int’l
beyond a simple console window is difficult as a graphical front end to Jess. Conf. Knowledge Capture (K-CAP 2001),
to achieve because of the differences in com- JessTab is a solid basis for further develop- ACM Press, 2001, pp. 6–13.
munication and representation formats. ment of the Protégé–Jess integration. Exam- 6. E. Motta, S. Buckingham Shum, and J.
One major advantage of the Protégé– Jess ples of such potential integration projects are Domingue, “Ontology-Driven Document
combination is that we can use other Protégé the representation of Jess problem solvers in Enrichment: Principles, Tools and Applica-
plug-ins and other Jess extensions and inter- ontologies and detailed modeling of Jess def- tions, Int’l J. Human–Computer Studies, vol.
52, no. 6, 2000, pp. 1071–1109.
faces. For example, Jess and JessTab let us use initions (such as rules) in knowledge bases.
Protégé for development of software agents. Furthermore, the JessTab approach is a road 7. W. Swartout et al., “Toward Distributed Use
The Java Agent Development Framework8 map for integrating Protégé and other perfor- of Large-Scale Ontologies,” Proc. 10th Banff
(JADE) can communicate with Jess, which in mance systems. Knowledge Acquisition for Knowledge-Based
turn communicates with Protégé using Systems Workshop, Univ. Calgary, 1996, pp.
32.1–32.19; http://ksi.cpsc.ucalgary.ca/KAW/
JessTab. Using this approach, you can get Pro- KAW96/swartout/Banff_96_final_2.html.
tégé ontology support for JADE agents by Acknowledgments
using Jess rules. Jess rules can create Protégé The JessTab user community contributed to this 8. F. Bellifemine, A. Poggi, and G. Rimassa,
article with testing, bug reports, and suggestions “Developing Multi-Agent Systems with a
instances based on messages from agents. Fur- for further improvements. Ray Fergerson and FIPA-Compliant Agent Framework,” Soft-
thermore, Jess rules can create and send agent Ernest Friedman-Hill provided Protégé and Jess ware: Practice and Experience, vol. 31, no.
messages based on the content of Protégé support, respectively. Samson Tu provided valu- 2, 2001, pp. 103–128.
knowledge bases. Another possibility is using able insights in the problem of transferring infor-
Protégé and Jess to develop Semantic Web mation from Protégé and Jess via Java. Vinnova 9. T. Berners-Lee, J. Hendler, and O. Lassila,
supported this work in part under grant 2002- “The Semantic Web,” Scientific American,
applications.9 Protégé supports encoding 00907, project P22454-1A. vol. 284, no. 5, May 2001, pp. 34–44.
ontologies in the resource description frame-
work (RDF) format. Thus, Jess can operate on
such ontologies through JessTab. Used in this References
For more information on this or any other com-
fashion, the Protégé–Jess combination is a 1. J.H. Gennari et al., “The Evolution of Protege: puting topic, visit our Digital Library at http://
building block for the Semantic Web. An Environment for Knowledge-Based Sys- computer.org/publications/dlib.