Title: OWL Tutorial from a data interoperability perspective
1OWL Tutorial(from a data interoperability
perspective)
- Roger L. Costello
- The MITRE Corp.
2Note
- Eventually this tutorial will replace the OWL
Tutorial in owl.ppt. - At the moment this tutorial is far from complete.
However, there is lots of good material in here,
that will give you practical tips on how to use
OWL to achieve data interoperability. - Let me know how you like this tutorial!
3OWL Another Data Source
OWL
Application
Input Data
Output Data
You should think of an OWL document as simply
another source of data that your applications can
tap into (along with other data sources such as
databases, flat files, etc).
4OWL XML
- An OWL document is an XML document.
- The OWL specification specifies the set of
elements and attributes that you may use in an
OWL document, and it clearly defines the meaning
of those elements and attributes. - By convention, the suffix of an OWL document is
.owl
5All XML Tools Available
- Since an OWL document is simply an XML document
you can take advantage of all the XML tools when
using an OWL document - XSLT, XML APIs (SAX,
DOM), XQuery, etc.
6Programmatically accessing OWL
OWL
API
Application
As mentioned on the previous slide, you can use
any of the XML APIs when accessing OWL
documents. However, it would be easier to use an
API that is specifically designed for accessing
the data in OWL documents, i.e., an OWL API.
(See the OWL API in this package)
7OWL RDFS more
- All of the elements and attributes that RDF
Schema provides is available to you when creating
OWL documents.
8Class Relationships
- Scenario your application receives input data
(that is structured as RDF/XML). As it parses
the data it encounters a Class that it was not
pre-wired to understand. It can consult an OWL
document to see if the unfamiliar Class relates
to a Class that it is familiar with.
9Defining Classes in OWL
Here's an OWL document which defines a Camera
Class
lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsrdfs"http//www.w3.o
rg/2000/01/rdf-schema" xmlnsowl"http//www.w3
.org/2002/07/owl" xmlns"http//www.xfront.com/
owl/ontologies/camera/" xmlbase"http//www.xf
ront.com/owl/ontologies/camera/"gt
ltowlClass rdfID"Camera"gt
ltrdfssubClassOf rdfresource"http//www.w3.org/2
002/07/owlThing"/gt lt/owlClassgt lt/rdfRDFgt
camera.owl (see example01)
10All OWL definitions are nested within an RDF
element
lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
...gt ... lt/rdfRDFgt
11The OWL Namespace
lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
... xmlnsowl"http//www.w3.org/2002/07/owl"
...gt ... lt/rdfRDFgt
12Defining a Class
lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsrdfs"http//www.w3.o
rg/2000/01/rdf-schema" xmlnsowl"http//www.w3
.org/2002/07/owl" ...gt
ltowlClass rdfID"Camera"gt ...
lt/owlClassgt lt/rdfRDFgt
Recall that rdfID is used to create an "initial
definition". If the Class already exists, and you
simply want to "add to it" then you use rdfabout.
13xmlbase provides the base URI for all IDs
lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsrdfs"http//www.w3.o
rg/2000/01/rdf-schema" xmlnsowl"http//www.w3
.org/2002/07/owl" xmlns"http//www.xfront.com/
owl/ontologies/camera/" xmlbase"http//www.xf
ront.com/owl/ontologies/camera/"gt
ltowlClass rdfID"Camera"gt ...
lt/owlClassgt lt/rdfRDFgt
The full URI for Camera is
http//www.xfront.com/owl/ontologies/camera/Camer
a
14All Classes are subclasses of owlThing
lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsrdfs"http//www.w3.o
rg/2000/01/rdf-schema" xmlnsowl"http//www.w3
.org/2002/07/owl" xmlns"http//www.xfront.com/
owl/ontologies/camera/" xmlbase"http//www.xf
ront.com/owl/ontologies/camera/"gt
ltowlClass rdfID"Camera"gt
ltrdfssubClassOf rdfresource"http//www.w3.org/2
002/07/owlThing"/gt lt/owlClassgt lt/rdfRDFgt
15Defining a SLR Class
- The next slide shows how to define a SLR Class
that is a subclass of Camera.
Camera
SLR
16lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsrdfs"http//www.w3.o
rg/2000/01/rdf-schema" xmlnsowl"http//www.w3
.org/2002/07/owl" xmlns"http//www.xfront.com/
owl/ontologies/camera/" xmlbase"http//www.xf
ront.com/owl/ontologies/camera/"gt
ltowlClass rdfID"Camera"gt
ltrdfssubClassOf rdfresource"http//www.w3.org/2
002/07/owlThing"/gt lt/owlClassgt
ltowlClass rdfID"SLR"gt
ltrdfssubClassOf rdfresource"Camera"/gt
lt/owlClassgt lt/rdfRDFgt
camera.owl (see example02)
17OWL API
Here is one of the methods in the OWL API
public String getSuperClasses(String classURI)
Example if this method is invoked with the SLR
URI http//www.xfront.com/owl/ontologies/c
amera/SLR the superclasses of SLR is returned
http//www.xfront.com/owl/ontologies/camera/
Camera http//www.w3.org/2002/07/owlThing
18Processing input data that contains an unfamiliar
Class
lt?xml version"1.0" encoding"UTF-8"?gt ltSLR
xmlns"http//www.xfront.com/owl/ontologies/camera
/"gt ... lt/SLRgt
Application
??? What's "SLR"?
Suppose that the application was not pre-wired to
understand SLR.
19Consult the Camera OWL document to see if SLR
relates to anything familiar
getSuperClasses("http//www.xfront.com/owl/ontolog
ies/camera/SLR")
OWL API
Application
"http//www.xfront.com/owl/ontologies/camera/Came
ra http//www.w3.org/2002/07/owlThing"
"Ah, a SLR is a type of Camera."
Camera.owl
Suppose that the application was pre-wired
to understand Camera. The OWL Camera
contains the relationship of SLR to Camera.
20Interoperability despite terminology differences!
- The application was able to process the input
data despite the fact that the data used
unfamiliar elements. - The OWL Camera document provided the information
needed to bridge the terminology gap!
21Synonymous Properties
- Scenario your application receives input data
(that is structured as RDF/XML). As it parses
the data it encounters a property that it was not
pre-wired to understand. It can consult an OWL
document to see if the unfamiliar property
relates to a property that it is familiar with.
22Defining Properties in OWL
lt?xml version"1.0" encoding"UTF-8"?gt ltrdfRDF
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlnsrdfs"http//www.w3.o
rg/2000/01/rdf-schema" xmlnsowl"http//www.w3
.org/2002/07/owl" xmlns"http//www.xfront.com/
owl/ontologies/camera/" xmlbase"http//www.xf
ront.com/owl/ontologies/camera/"gt
ltowlClass rdfID"Camera"gt
ltrdfssubClassOf rdfresource"http//www.w3.org/2
002/07/owlThing"/gt lt/owlClassgt
ltowlClass rdfID"SLR"gt
ltrdfssubClassOf rdfresource"Camera"/gt
lt/owlClassgt ltowlClass rdfID"Range"gt
ltrdfssubClassOf rdfresource"http//www.w3
.org/2002/07/owlThing"/gt lt/owlClassgt
ltowlDatatypeProperty rdfID"aperture"gt
ltrdfsdomain rdfresource"Camera"/gt
ltrdfsrange rdfresource"http//www.w3.org/2001/X
MLSchemastring"/gt lt/owlDatatypePropertygt
ltowlObjectProperty rdfID"shutter-speed"gt
ltrdfsdomain rdfresource"Camera"/gt
ltrdfsrange rdfresource"Range"/gt
lt/owlObjectPropertygt lt/rdfRDFgt
camera.owl (see example03)
23Properties come in 2 flavors
ltowlDatatypeProperty rdfID"aperture"gt
ltrdfsdomain rdfresource"Camera"/gt
ltrdfsrange rdfresource"http//www.w3.org/2001/X
MLSchemastring"/gt lt/owlDatatypePropertygt
ltowlObjectProperty rdfID"shutter-speed"gt
ltrdfsdomain rdfresource"Camera"/gt
ltrdfsrange rdfresource"Range"/gt lt/owlObject
Propertygt
Use owlObjectProperty when the value (range)
is a Class type. Example the range
of shutter-speed is a Range Class.
Use owlDatatypeProperty when the value (range)
is a simple type. Example the range of aperture
is an XML Schema string.
Note that OWL leverages RDFS for defining the
domain and range of properties (using rdfsdomain
and rdfsrange).
24Review Class Hierarchy plus Properties
Camera
Properties aperture xsdstring
shutter-speed Range
Range
SLR
The OWL document currently defines three
Classes, and two properties of Camera.
Legend
Class
Properties propert1 range property2
range ...
25Subclasses inherit properties
Camera
Properties aperture xsdstring
shutter-speed Range
SLR
Subclasses inherit the properties of all parent
classes. Thus, the SLR Class also has the
properties aperture and shutter-speed.
26Defining synonymous properties
ltowlDatatypeProperty rdfID"aperture"gt
ltrdfsdomain rdfresource"Camera"/gt
ltrdfsrange rdfresource"http//www.w3.org/2001/X
MLSchemastring"/gt lt/owlDatatypePropertygt ltowlD
atatypeProperty rdfID"f-stop"gt
ltowlequivalentProperty rdfresource"aperture"/gt
ltrdfsdomain rdfresource"Camera"/gt
ltrdfsrange rdfresource"http//www.w3.org/200
1/XMLSchemastring"/gt lt/owlDatatypePropertygt
camera.owl (see example04)
The OWL document is defining another property,
f-stop, and asserting that it is equivalent
(synonymous) with aperture.
27OWL API
Here is one of the methods in the OWL API
public String getEquivalentProperties(String
propertyURI)
Example if this method is invoked with the
f-stop URI http//www.xfront.com/owl/ontol
ogies/camera/f-stop the equivalent properties of
f-stop are returned http//www.xfront.com/
owl/ontologies/camera/aperture
28Processing input data that contains an unfamiliar
property
lt?xml version"1.0" encoding"UTF-8"?gt ltSLR
xmlns"http//www.xfront.com/owl/ontologies/camera
/"gt ltf-stopgt4.5-5.6lt/f-stopgt ... lt/SLRgt
Application
??? What's "f-stop"?
Suppose that the application was not pre-wired to
understand f-stop.
29Consult the Camera OWL document to see if f-stop
relates to anything familiar
getEquivalentProperties("http//www.xfront.com/owl
/ontologies/camera/f-stop")
OWL API
Application
"http//www.xfront.com/owl/ontologies/camera/aper
ture"
"Ah, an f-stop is the same as aperture."
Camera.owl
Suppose that the application was pre-wired
to understand aperture. The OWL Camera
contains the relationship of f-stop to aperture.
30Interoperability despite terminology differences!
- The application was able to process the input
data despite the fact that the data used
unfamiliar elements. - The OWL Camera document provided the information
needed to bridge the terminology gap!