Title: A Five Minute Intro to XML
1A Five Minute Intro to XML
- Roger L. Costello
- The MITRE Corporation
2You have data How should you structure it?
Here's some data about a Canon camera
Canon-Sure-Shot-Z155
37-155mm zoom
4.8-11.7
318 USD
3The XML approach is to "wrap" each data item in
start/end tags
ltCameragt ltnamegtCanon-Sure-Shot-Z155lt/namegt
ltf-stopgt4.8-11.7lt/f-stopgt
ltfocal-lengthgt37-155mm zoomlt/focal-lengthgt
ltcostgt318 USDlt/costgt lt/Cameragt
Canon.xml
4XML Terminology
ltnamegtCanon-Sure-Shot-Z155lt/namegt
Start tag
End tag
Data
Element
5What's the date?
ltdategt05-10-99lt/dategt
The XML tags are generally very useful in
describing properties of the data. However, in
this case more is needed. That is, more data
about the data (metadata) is needed.
6XML Attributes
ltdate format"dd-mm-yy"gt05-10-99lt/dategt
attribute
Things to note 1. Attributes are "bundled" in
with the start tag. 2. Attributes take this form
attribute-name"attribute-value"
7Common Design PatternIDentify classes
Instead of this
ltCameragt ltnamegtCanon-Sure-Shot-Z155lt/namegt
ltf-stopgt4.8-11.7lt/f-stopgt
ltfocal-lengthgt37-155mm zoomlt/focal-lengthgt
ltcostgt318 USDlt/costgt lt/Cameragt
Design like this
ltCamera ID"Canon-Sure-Shot-Z155"gt
ltf-stopgt4.8-11.7lt/f-stopgt
ltfocal-lengthgt37-155mm zoomlt/focal-lengthgt
ltcostgt318 USDlt/costgt lt/Cameragt
8The General Design Pattern
ltClass ID"instance"gt ltproperty1gtdata
valuelt/property1gt ltproperty2gtdata
valuelt/property2gt ...
ltproperty-ngtdata valuelt/property-ngt lt/Classgt
Things to note 1. Names of Classes by convention
begin with uppercase. 2. Names of properties by
convention begin with lowercase.
9Example
ltCameraStore ID"Hunts-Camera-Store"gt
ltlocationgtMalden, MAlt/locationgt ltinventorygt
ltCamera ID"Canon-Sure-Shot-Z155"gt
ltf-stopgt4.8-11.7lt/f-stopgt
ltfocal-lengthgt37-155mm zoomlt/focal-lengthgt
ltcostgt318 USDlt/costgt
lt/Cameragt ltCamera
ID"Olympus-mju-II"gt
ltf-stopgt2.8lt/f-stopgt
ltfocal-lengthgt35mmlt/focal-lengthgt
ltcostgt178 USDlt/costgt lt/Cameragt
... lt/inventorygt lt/CameraStoregt
Hunts.xml
10With OWL you can define the Camera Class (which
is used in the XML document)
ltowlClass rdfID"Camera"gt lt/owlClassgt
"Qualify" the element (Class) to indicate that it
is provided by OWL
"Qualify" the attribute (ID) to indicate that it
is provided by RDF
Elements and attributes provided by RDF
Elements and attributes provided by OWL
11Why use XML?
- It is a universally accepted standard way of
structuring data (syntax). - It is a W3C recommendation (W3C World Wide Web
Consortium) - The marketplace supports it with a lot of
free/inexpensive tools. - The alternative to using XML is to define your
own proprietary data syntax, and then build your
own proprietary tools to support the proprietary
syntax (Not a very appealing idea).
12A Quick Introduction toOWL Web Ontology Language
- Roger L. Costello
- David B. Jacobs
- The MITRE Corporation
- (The creation of this tutorial was sponsored by
DARPA)
13What is OWL?
Answer OWL is a set of XML elements and
attributes, with standardized
meaning, that are used to define
terms and their relationships.
OWL extends RDF Schema
Class equivalentProperty sameIndividualAs ...
OWL
OWL elements and attributes (i.e., OWL Vocabulary)
subClassOf resource ID ...
RDF Schema
14Example of using OWL to define two terms and
their relationship
Example Define the terms "Camera" and "SLR".
State that SLRs are a type of Camera.
Here's how these two terms (classes) and
their relationship is defined using the OWL
vocabulary
ltowlClass rdfID"Camera"/gt
ltowlClass rdfID"SLR"gt ltrdfssubClassOf
rdfresource"Camera"/gt lt/owlClassgt
15Quick Intro Contents
- In this quick intro we present an example to
demonstrate one of the utilities of OWL - The example shows how OWL can be used to bridge
terminology differences and thus enhance
interoperability.
16Example Bridging the Terminology Gap using OWL
- A key problem in achieving interoperability is to
be able to recognize that two pieces of data are
talking about the same thing, even though
different terminology is being used. - The following slides presents an example to show
how OWL may be used to bridge the "terminology
gap".
17Interested in Purchasing a Camera
- Scenario
- I am interested in purchasing a camera with a
75-300mm zoom lens size, that has an aperture of
4.5-5.6, and a shutter speed that ranges from
1/500 sec. to 1.0 sec. - I launch my personal "Web Bot" which crawls the
Web looking for Web sites that can fulfill my
request. - Assume that there exists an OWL Camera Ontology,
which the Web Bot can "consult" upon its travels
across the Web.
18Is this document relevant?
ltPhotographyStore rdfID"Hunts"
xmlnsrdf"http//www.w3.org/1999/0
2/22-rdf-syntax-ns"gt ltstore-locationgtMalden,
MAlt/store-locationgt ltphonegt617-555-1234lt/phone
gt ltcatalog rdfparseType"Collection"gt
ltSLR rdfID"Olympus-OM-10"
xmlns"http//www.camera.org"gt
ltlensgt ltLensgt
ltfocal-lengthgt75-300mm zoomlt/focal-lengthgt
ltf-stopgt4.5-5.6lt/f-stopgt
lt/Lensgt lt/lensgt
ltbodygt ltBodygt
ltshutter-speed rdfparseType"Resource"gt
ltmingt0.002lt/mingt
ltmaxgt1.0lt/maxgt
ltunitsgtsecondslt/unitsgt
lt/shutter-speedgt lt/Bodygt
lt/bodygt ltcost
rdfparseType"Resource"gt
ltrdfvaluegt325lt/rdfvaluegt
ltcurrencygtUSDlt/currencygt lt/costgt
lt/SLRgt lt/cataloggt lt/PhotographyStoregt
The Web Bot finds this document at a Web site
Is it relevant? (Note SLR Single Lens
Reflex)
19A Match?
ltPhotographyStore rdfID"Hunts"
xmlnsrdf"rdf"gt
ltstore-locationgtMalden, MAlt/store-locationgt
ltphonegt617-555-1234lt/phonegt ltcatalog
rdfparseType"Collection"gt ltSLR
rdfID"Olympus-OM-10"
xmlns"http//www.camera.org"gt
ltlensgt ltLensgt
ltfocal-lengthgt75-300mm zoomlt/focal-lengthgt
ltf-stopgt4.5-5.6lt/f-stopgt
lt/Lensgt lt/lensgt
ltbodygt ltBodygt
ltshutter-speed rdfparseType"Resource"gt
ltmingt0.002lt/mingt
ltmaxgt1.0lt/maxgt
ltunitsgtsecondslt/unitsgt
lt/shutter-speedgt lt/Bodygt
lt/bodygt ltcost
rdfparseType"Resource"gt
ltrdfvaluegt325lt/rdfvaluegt
ltcurrencygtUSDlt/currencygt lt/costgt
lt/SLRgt lt/cataloggt lt/PhotographyStoregt
I am interested in purchasing a camera with a
75-300mm zoom lens size, that has an aperture of
4.5-5.6, and a shutter speed that ranges from
1/500 sec. to 1.0 sec.
Match?
To determine if there is a match, these questions
must be answered 1. What's the relationship
between "SLR" and "Camera"? 2. What's the
relationship between "focal-length" and "size"?
3. What's the relationship between "f-stop" and
"aperture"?
20Relationship between SLR and Camera?
The Web Bot "consults" the OWL Camera Ontology.
This OWL statement tells the Web Bot that a SLR
is a type of Camera
ltowlClass rdfID"SLR"gt ltrdfssubClassOf
rdfresource"Camera"/gt lt/owlClassgt
"Relationship between Camera and SLR?"
ltPhotographyStore rdfID"Hunts"
ltSLRgt lt/SLRgt lt/PhotographyStoregt
Web Bot
ltowlClass rdfID"SLR"gt ltrdfssubClassOf
rdfresource"Camera"/gt lt/owlClassgt
"SLR is a type of Camera."
Camera.owl
Hunts.xml
21Relationship between focal-length and lens size?
This OWL statement tells the Web Bot that
focal-length is equivalent to lens size
ltowlDatatypeProperty rdfID"focal-length"gt
ltowlequivalentProperty rdfresource"size"/gt
ltrdfsdomain rdfresource"Lens"/gt
ltrdfsrange rdfresource"xsdstring"/gt lt/o
wlDatatypePropertygt
"focal-length is synonymous with (lens) size.
focal-length is to be used within a Lens.
focal-length has a value that is a string."
22Relationship between f-stop and aperture?
This OWL statement tells the Web Bot that f-stop
is equivalent to aperture
ltowlDatatypeProperty rdfID"f-stop"gt
ltowlequivalentProperty rdfresource"aperture"/gt
ltrdfsdomain rdfresource"Lens"/gt
ltrdfsrange rdfresource"xsdstring"/gt lt/o
wlDatatypePropertygt
The Web Bot now recognizes that the XML document
it found at the Web site - is talking about
Cameras, and it - does show the lens size,
and it - does show the aperture for the
camera, and - the values for lens size,
aperture, and shutter speed are met. Thus, the
Web Bot recognizes that the XML document is a
match!
23Semantic Definitions Separate from Application!
Semantic Definitions
"Relationship between Camera and SLR?"
ltowlClass rdfID"SLR"gt ltrdfssubClassOf
rdfresource"Camera"/gt lt/owlClassgt ltowl
DatatypeProperty rdfID"focal-length"gt
ltowlequivalentProperty rdfresource"size"/gt
ltrdfsdomain rdfresource"Lens"/gt
ltrdfsrange rdfresource"xsdstring"/gt lt/owlD
atatypePropertygt ltowlDatatypeProperty
rdfID"f-stop"gt ltowlequivalentProperty
rdfresource"aperture"/gt ltrdfsdomain
rdfresource"Lens"/gt ltrdfsrange
rdfresource"xsdstring"/gt lt/owlDatatypeProper
tygt
ltSLR rdfID"Olympus-OM-10"
xmlns"http//www.camera.org"gt ltlensgt
ltLensgt
ltfocal-lengthgt75-300mm zoomlt/focal-lengthgt
ltf-stopgt4.5-5.6lt/f-stopgt
lt/Lensgt lt/lensgt ltbodygt
ltBodygt
ltshutter-speed rdfparseType"Resource"gt
ltmingt0.002lt/mingt
ltmaxgt1.0lt/maxgt
ltunitsgtsecondslt/unitsgt
lt/shutter-speedgt lt/Bodygt
lt/bodygt ltcost rdfparseType"Resource"gt
ltrdfvaluegt325lt/rdfvaluegt
ltcurrencygtUSDlt/currencygt
lt/costgt lt/SLRgt
"SLR is a type of Camera."
Web Bot (application)
"Relationship between aperture and f-stop?"
"f-stop is synonymous with aperture."
"Relationship between size and focal-length?"
Hunts.xml
"focal-length is synonymous with size."
Camera.owl
See the article "Why use OWL?" for a discussion
of why it is good practice to separate the
semantic definitions from the application.
24Summary Interoperability despite terminology
differences!
- The example demonstrated how a Web Bot
application was able to dynamically process an
XML document from a Web site, despite the fact
that the XML document used terminology different
than was used to express the request. This
interoperability was achieved by using the OWL
Camera Ontology! - This example also demonstrated the architectural
design principle of cleanly separating the
application code (e.g., Web Bot) from the
semantic definitions (e.g., Camera.owl).
25Demo of interoperability in a heterogeneous data
environment
What do you know about SLR?
Hunts.xml
Camera Application
SLR is a type of Camera.
Camera.owl
26Demo - searching for Camera, lens size, aperture
info
- The Camera Application is searching for documents
that meet this desire - I am interested in purchasing a Camera with a
75-300mm zoom lens size, that has an aperture of
4.5-5.6, and a shutter speed that ranges from
1/500 sec. to 1.0 sec. - The Camera Application understands the terms
(i.e., elements) Camera, lens size, and aperture. - If a document uses terms that it does not
understand, then the Camera application
"consults" the Camera Ontology.
27Hunts.xml - uses unfamiliar terminology
ltPhotographyStoregt ltcatalog
rdfparseType"Collection"gt ltSLR
rdfID"Olympus-OM-10"
xmlns"http//www.xfront.com/owl/ontologies/camera
/"gt ltlensgt ltLensgt
ltfocal-lengthgt75-300mm
zoomlt/focal-lengthgt
ltf-stopgt4.5-5.6lt/f-stopgt
lt/Lensgt lt/lensgt ltbodygt
ltBodygt
ltshutter-speed rdfparseType"Resource"gt
ltmingt0.002lt/mingt
ltmaxgt1.0lt/maxgt
ltunitsgtsecondslt/unitsgt
lt/shutter-speedgt lt/Bodygt
lt/bodygt lt/SLRgt lt/cataloggt lt/Photog
raphyStoregt
?
Need to consult the Camera Ontology!
28QuikPhoto.xml - uses familiar terminology
ltCameragt ltlensgt ltLensgt
ltsizegt75-300mm zoomlt/sizegt
ltaperturegt4.5-5.6lt/aperturegt lt/Lensgt
lt/lensgt ltbodygt ltBodygt
ltshutter-speed rdfparseType"Resource"gt
ltmingt0.002lt/mingt
ltmaxgt1.0lt/maxgt
ltunitsgtsecondslt/unitsgt
lt/shutter-speedgt lt/Bodygt
lt/bodygt lt/Cameragt
No need to consult the Camera Ontology.
29Lesson Learned
- The Camera Application is able to process
documents that uses unfamiliar terminology.
Interoperates!
Community B uses terms Camera, aperture, lens size
Community A uses terms SLR, f-stop, focal-length
OWL Camera Ontology
30Who's Using Ontologies?
- Real estate investment agencies are using
Ontologies to exchange data with regulatory
agencies (Data Consortium - Real Estate Data
Standards). - Reuter's Health is using Ontologies to describe
the content of articles and sort them into
various news feeds (using SNOMED Ontology). - Electric utilities describe their networks using
Ontologies for exchange purposes (CIM/XML). - SUN has a large knowledge management initiative
called swoRDfish that uses Ontologies.
31Related Articles
"Why use OWL?" by Roger L. Costello
http//www.xfront.com/owl/motivation/sld001.htm
"Why use OWL?" by Adam Pease
http//www.xfront.com/why-use-owl.html
"Using OWL to Avoid Syntactic Rigor Mortis" by
Roger L. Costello http//www.xfront.com/avo
iding-syntactic-rigor-mortis.html
32The OWL Camera Ontology is Online!
Here is the URL to a pictorial view of the Camera
Ontology http//www.xfront.com/owl/ontologies
/camera/sld001.htm Here is the URL to the
camera.owl document http//www.xfront.com/owl
/ontologies/camera/camera.owl Here are the URLs
to 7 physical expressions (instance documents)
http//www.xfront.com/owl/ontologies/camera/Quer
y1.xml http//www.xfront.com/owl/ontologies/cam
era/Hunts.xml http//www.xfront.com/owl/ontolog
ies/camera/Query2.xml http//www.xfront.com/owl
/ontologies/camera/Hunts2.xml
http//www.xfront.com/owl/ontologies/camera/RJs.xm
l http//www.xfront.com/owl/ontologies/camera/O
lympusOutletStore.xml http//www.xfront.com/owl
/ontologies/camera/OlympusCorp.xml
33The Robber and the Speeder
- Roger L. Costello
- David B. Jacobs
- The MITRE Corporation
- (The creation of this tutorial was sponsored by
DARPA)
34An OWL Ontology can be used to answer questions
that are implicit in your data
4
How many guns/people are registered in a gun
license?
1
ltGunLicensegt ltregisteredGungt ltGungt
ltserialgtABCDlt/serialgt
lt/Gungt lt/registeredGungt ltholdergt
ltPersongt ltdriversLicenseNumbergtZXYZX
Ylt/driversLicenseNumbergt lt/Persongt
lt/holdergt lt/GunLicensegt
How many guns can have this serial number?
Can this gun be registered in other gun licenses?
2
How many people can have this driver's license
number?
3
35The OWL Gun License Ontology answers the
questions!
4
A gun license registers one gun to one person.
ltGunLicensegt ltregisteredGungt ltGungt
ltserialgtABCDlt/serialgt
lt/Gungt lt/registeredGungt ltholdergt
ltPersongt ltdriversLicenseNumbergtZXYZX
Ylt/driversLicenseNumbergt lt/Persongt
lt/holdergt lt/GunLicensegt
1
Only one gun can have this serial number.
A gun can be registered in only one gun license.
2
Only one person can have this driver's license
number.
3
36The Robber and the Speeder
- On the next few slides is an example that shows
how an OWL Ontology provides the necessary
information to link a robber and a speeder. - Thanks to Ian Davis for this example!
37Robber drops gun while fleeing!
First of all a robbery takes place. The robber
drops his gun while fleeing. This report is filed
by the investigating officers
ltRobberyEventgt ltdategt...lt/dategt
ltdescriptiongt...lt/descriptiongt ltevidencegt
ltGungt ltserialgtABCDlt/serialgt
lt/Gungt lt/evidencegt ltrobbergt
ltPerson /gt lt!-- an unknown person --gt
lt/robbergt lt/RobberyEventgt
38Speeder stopped
Subsequently a car is pulled over for speeding.
The traffic officer files this report
electronically while issuing a ticket
ltSpeedingOffencegt ltdategt...lt/dategt
ltdescriptiongt...lt/descriptiongt ltspeedergt
ltPersongt ltnamegtFred
Blogslt/namegt ltdriversLicenseNumbergtZ
XYZXYlt/driversLicenseNumbergt lt/Persongt
lt/speedergt lt/SpeedingOffencegt
39The speeder owns a gun with the same serial
number as the robbery gun!
At police headquarters (HQ), a computer analyzes
each report as it is filed. The computer uses
the driver's license information to look up any
other records it has about Fred Blogs (the
speeder) and discovers this gun license
ltGunLicensegt ltregisteredGungt ltGungt
ltserialgtABCDlt/serialgt
lt/Gungt lt/registeredGungt ltholdergt
ltPersongt ltdriversLicenseNumbergtZXYZX
Ylt/driversLicenseNumbergt lt/Persongt
lt/holdergt lt/GunLicensegt
40Case Solved?
- Not yet! These questions must be answered before
the speeder can be arrested as the robbery
suspect - Can multiple guns have the same serial number?
- If so, then just because Fred Blogs owns a gun
with the same serial number as the robbery gun
does not mean it was his gun that was used in the
robbery. - Can multiple people have the same driver's
license number? - If so, then the gun license information may be
for someone else. - Can a gun be registered in multiple gun licenses?
- If so, then the other gun licenses may show the
holder of the gun to be someone other than Fred
Blogs. - Can a gun license have multiple holders of a
registered gun? - If so, then there may be another gun license
document (not available at the police HQ) which
shows the same registered gun but with a
different holder. - The OWL Gun License Ontology provides the
information needed to answer these questions!
1
2
3
4
41Can multiple guns have the same serial number?
This OWL statement tells the computer at police
HQ that each gun is uniquely identified by its
serial number
ltowlInverseFunctionalProperty rdfID"serial"gt
ltrdfsdomain rdfresource"Gun"/gt
ltrdfsrange rdfresource"http//www.w3.org/2000/
01/rdf-schemaLiteral"/gt lt/owlInverseFunctionalPr
opertygt
1
Only one gun can have this serial number.
ltGungt ltserialgtABCDlt/serialgt lt/Gungt
42Can multiple people have the same driver's
license number?
The following OWL statement tells the computer
that a driver's license number is unique to a
Person
ltowlInverseFunctionalProperty rdfID"driversLice
nseNumber"gt ltrdfsdomain
rdfresource"Person"/gt ltrdfsrange
rdfresource"http//www.w3.org/2000/01/rdf-schema
Literal"/gt lt/owlInverseFunctionalPropertygt
2
Only one person can have this driver's license
number.
ltPersongt ltdriversLicenseNumbergtZXYZXYlt/dri
versLicenseNumbergt lt/Persongt
43Can a gun be registered in multiple gun licenses?
The next OWL statement tells the computer that
the registeredGun property uniquely identifies a
GunLicense, i.e., each gun is associated with
only a single GunLicense
ltowlInverseFunctionalProperty rdfID"registeredG
un"gt ltrdfsdomain rdfresource"GunLicense"
/gt ltrdfsrange rdfresource"Gun"/gt lt/owl
InverseFunctionalPropertygt
ltGunLicensegt ltregisteredGungt ltGungt
ltserialgtABCDlt/serialgt
lt/Gungt lt/registeredGungt ... lt/GunLicensegt
A gun can be registered in only one gun license.
3
44Can a gun license have multiple holders of a
registered gun?
The police computer uses the following OWL
statement to determine that the gun on
the license is the same gun used in the robbery.
This final statement seals the speeder's fate.
It tells the computer that each GunLicense
applies to only one gun and one person. So,
there is no doubt that the speeder is the person
who owns the gun
ltowlClass rdfID"GunLicense"gt
ltowlintersectionOf rdfparseType"Collection"gt
ltowlRestrictiongt
ltowlonProperty rdfresource"registeredGun"/gt
ltowlcardinalitygt1lt/owlcardinalitygt
lt/owlRestrictiongt
ltowlRestrictiongt ltowlonProperty
rdfresource"holder"/gt
ltowlcardinalitygt1lt/owlcardinalitygt
lt/owlRestrictiongt lt/owlintersectionOfgt lt/ow
lClassgt
4
A gun license registers one gun to one person.
ltGunLicensegt ltregisteredGungt ...
ltholdergt ... lt/GunLicensegt
45Summary
- An OWL Ontology provides additional information
about your data. - Example The Gun License Ontology provided the
data needed for the police computer to link the
Robber and the Speeder! - OWL is intended to be used when processing Web
documents. Thus, OWL enables an ad-hoc
exploitation of Web documents, i.e., the Semantic
Web!