Title: OWL API
1OWL API
- Roger L. Costello
- June, '03
2OWL API
OWL API
Java Application
OWL Ontologies
The purpose of the OWL API is to shield your
Java application from directly accessing OWL
Ontologies.
3Contents of this Document
1. API Description the API is described, along
with examples. 2. Demo this section tells you
how to test the API. 3. API Implementation this
gives some details on how the API is
implemented. 4. Want to help? Describes how you
can participate.
4The OWL Genie API - 1
getProperties(classURI) returns a list of
space-separated property URIs.
Example Calling getProperties with
http//www.xfront.com/owl/ontologies/camera/Camer
a results in returning http//www.xfront.c
om/owl/ontologies/camera/lens
http//www.xfront.com/owl/ontologies/camera/body
http//www.xfront.com/owl/ontologies/camera/
viewFinder http//www.xfront.com/owl/ontolo
gies/camera/cost
5The OWL Genie API - 2
getEquivalentProperties(propertyURI)
returns a list of space-separated property URIs.
Example Calling getEquivalentProperties with
http//www.xfront.com/owl/ontologies/camera/si
ze results in returning
http//www.xfront.com/owl/ontologies/camera/focal
-length
6The OWL Genie API - 3
getSuperClasses (classURI) returns a list
of space-separated class URIs.
Example Calling getSuperClasses with
http//www.xfront.com/owl/ontologies/camera/SLR
results in returning http//www.xfront.com/
owl/ontologies/camera/Camera
http//www.xfront.com/owl/ontologies/camera/Purch
aseableItem
7The OWL Genie API - 4
getPropertyTypes (propertyURI) returns a
list of space-separated type URIs.
Example Calling getPropertyTypes with
http//www.xfront.com/owl/ontologies/gunLicense/s
erial results in returning
http//www.w3.org/2002/07/owlDatatypeProperty
http//www.w3.org/2002/07/owlFunctionalPropert
y http//www.w3.org/2002/07/owlInverseFunct
ionalProperty
8The OWL Genie API - 5
getClassSpecificPropertyDefinitions (classURI,
propertyURI) returns a list of
space-separated propertyvalue URI pairs.
Example Calling getClassSpecificPropertyDefinitio
ns with http//www.xfront.com/owl/ontologie
s/water/River http//www.xfront.com/owl/ont
ologies/water/connectsTo results in returning
http//www.w3.org/2002/07/owlsomeValuesFrom
http//www.xfront.com/owl/ontologies/water/BodyOf
Water
9The OWL Genie API - 6
getDomain (propertyURI) returns a list of
space-separated class URIs.
Example Calling getDomain with
http//www.xfront.com/owl/ontologies/water/emptie
sInto results in returning
http//www.xfront.com/owl/ontologies/water/River
10The OWL Genie API - 7
getRange (propertyURI) returns a list of
space-separated class URIs.
Example Calling getRange with
http//www.xfront.com/owl/ontologies/water/emptie
sInto results in returning
http//www.xfront.com/owl/ontologies/water/BodyOf
Water
11The OWL Genie API - 8
getInstances (classURI) returns a list of
space-separated instance URIs.
Example Calling getInstances with
http//www.xfront.com/owl/ontologies/water/Kyoto-
Protected-River results in returning
http//www.china.org/geography/riversYangtze
http//www.us.org/riversMississippi
http//www.africa.org/riversNile
http//www.s-america.org/riversAmazon
12The OWL Genie API - 9
getEquivalentClasses(classURI) returns a
list of space-separated class URIs.
Example Calling getEquivalentClasses with
http//www.xfront.com/owl/ontologies/water/BodyOf
Water results in returning
http//www.other.orgWaterGeoFeature
13Note - 1
The previous slides showed URIs returned by the
API. The URIs were on separate lines. I did this
just for presentation purposes. In reality, the
API does not separate each URI by a carriage
return. Rather, each URI is separated by a
single space, e.g., uri1 uri2 uri3 ...
14Note - 2
Suppose that these are the superclasses of class
A
D
C
B
A
Here is what you get when you invoke the
getSuperClasses template with class A
B D C
15Summary of the OWL API
public class OWL_API public String
getProperties(String classURI) public
String getEquivalentProperties(String
propertyURI) public String
getSuperClasses(String classURI) public
String getPropertyTypes(String propertyURI)
public String getClassSpecificPropertyDefinition
s(String classURI, String propertyURI)
public String getDomain(String propertyURI)
public String getRange(String propertyURI)
public String getInstances(String classURI)
public String getEquivalentClasses(String
classURI)
OWL_API.java
16Demo
- OWL_API.java contains a "main" routine which
tests each API method. To see the API in action
simply open a DOS window, change to this
directory and type run. (Read README.txt first
to set your classpath and path variable)
17OWL API Implementation Details (a layered
approach)
OWL_API.java
XALAN.java
OWL-API.xsl
OWL-Genie.xsl
Private.xsl
OntologyDirectory.xsl
OWL Documents
18XALAN.java
The OWL API is implemented (under the hood) using
several XSLT stylesheets. XALAN.java is a Java
program which is used to invoke the
XSLT stylesheets, and pass parameters to them.
19OWL-API.xsl
All Java method invocations result in invoking
this XSLT stylesheet. The name of the
method, the classURI (where relevant), and the
propertyURI (where relevant) are passed into this
stylesheet. It invokes the appropriate XSLT
named template in the OWL-Genie package (next
slide).
20OWL-Genie.xsl
This XSLT stylesheet contains the templates that
an application invokes. It "includes" the other
two stylesheets, and invokes the templates that
they provide.
21Private.xsl
This XSLT stylesheet contains templates
that actually implement the capabilities exposed
in OWL-Genie.xsl.
22OntologyDirectory.xsl
This XSLT stylesheet has just one template. The
template is invoked with a namespace, and it
returns the filename of the OWL document that
defines that namespace. - When you create a new
OWL ontology you must add the
namespace/filename to this document!
23Want to Help?
There are two ways to help 1. Suggest new
APIs. 2. Help Implement.
24To Do List
- Currently the API just supports a single document
for defining an ontology. However, an ontology
may be split over multiple documents. The API
needs to be enhanced to support this.