An OWL ontology just living in a file system is
not of much use. Therefore application interfaces
(API) have been developed which allow programs to
load an ontology, access its data, manipulate the on-
tology, and save it back to files, all within ordinary
programs. The most recent one is the Java OWL API
2
for OWL-version 2 (Horridge and Bechhofer, 2011),
developed as part of the CO-ODE project
3
and the
TONES project
4
in the Manchester University
5
. It al-
lows one to load, access and manipulate the structure
of OWL ontologies and to integrate them with OWL
reasoners.
Java programs using the OWL API for loading
ontologies have two class hierarchies in parallel, the
Java class hierarchy and the OWL class hierarchy. For
applications where these hierarchies are sufficiently
different, this is no problem. If, however, the class
hierarchies overlap, one gets a considerable synchro-
nisation problem. Overlapping class hierarchies are
of interest if one wants to add procedural features to
the classes. Since OWL has no procedural features,
the only choice is to define correspondingJava classes
with the corresponding methods.
As an illustrating example, consider the partial
modelling of university structures. There are peo-
ple, students, tutors, lecturers, professors, secretaries,
technical staff etc. There are programmes of study,
Bachelor, Master and PhD programmes. There are
lectures, seminars, excursions etc. There are scien-
tific areas, natural sciences, humanities, social sci-
ences etc. All this can be modelled in OWL, but
there is no chance to add procedural features to these
OWL classes. This can only be done in corresponding
Java classes. Combining Java classes and their meth-
ods with corresponding OWL classes as the basis of
OWL-reasoning, however, may turn out to be a very
useful thing. The Java methods do the computation,
and the OWL classes can in particular be used to se-
lect sets of individuals by determining the instances
of OWL concept expressions.
The Java2OWL library presented in this paper tar-
gets the synchronised coexistence of Java classes and
OWL classes. It makes it possible to exploit the
strengths of both systems without too much program-
ming overhead.
2 A TYPICAL WORKFLOW
A typical workflow in the development and applica-
2
OWL API: http://owlapi.sourceforge.net/
3
CO-ODE project: http://www.co-ode.org/
4
TONES project: http://www.tonesproject.org/
5
Manchester University: http://owl.cs.manchester.ac.uk/
tion of Java programs using the Java2OWL library
consists of two major phases:
1. the preparation phase, which consists of the pro-
gramming and the compilation phase,
2. the Java application phase which starts with the
steps a Java application has to perform in order to
work with the Java2OWL library.
2.1 The Preparation Phase
This phase consists of the following steps:
1. Background Ontology. Most applications which
want to use ontologies do not start from scratch,
but us already existing ontologies, or develop spe-
cialised ontologies for this application. Therefore
the Java2OWL library assumes the existence of
a “background ontology” with predefined classes
and properties. This background ontology can be
loaded into the Java2OWL-compiler which then
extends it with OWL classes generated from Java
classes.
2. Annotating Java Classes. Java classes which
are to be mapped to OWL classes must be an-
notated in a special way. The class-level anno-
tations control the generation of OWL classes and
the method-level annotations control the genera-
tion of the OWL-properties. Typically, the Java
class has getter methods, setter methods, and for
collection-valued attributes, adder and remover
methods. The annotations of the getter methods
are sufficient to tell the system how to access and
manipulate the Java-attributes and to synchronise
them with the OWL-properties.
3. Compiling the Extension Ontology. The anno-
tated Java classes are mapped to newly gener-
ated OWL classes which are added to the back-
ground ontology. The getter methods are mapped
to OWL-properties, either data properties, map-
ping objects to data types like integer, or object
properties, mapping objects to other objects. The
so extended background ontology is then saved as
“extension ontology”.
4. Extending the Extension Ontology. In some ap-
plications it may be necessary to manually extend
the extension ontology, for example by adding
special individuals. Therefore one can manipulate
the extension ontology outside the Java2OWL-
system in an almost arbitrary way before it is used
in the application program.
5. Injecting Synchronisation Code into the Java
Classes. Since Java classes and OWL classes co-
exist in the Java2OWLsystem, their instances also
KEOD2012-InternationalConferenceonKnowledgeEngineeringandOntologyDevelopment
16