owl: web ontologies

67
1 OWL: Web Ontologies Matthew Yau [email protected]

Upload: nerina

Post on 12-Jan-2016

25 views

Category:

Documents


0 download

DESCRIPTION

OWL: Web Ontologies. Matthew Yau [email protected]. Reminder on Ontologies. An ontology is a formal, explicit specification of a shared conceptualisation. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: OWL: Web Ontologies

1

OWL:Web Ontologies

Matthew Yau [email protected]

Page 2: OWL: Web Ontologies

2

Reminder on Ontologies

An ontology is a formal, explicit specification of a shared conceptualisation.

A conceptualisation refers to an abstract model of some phenomenon in the world which identifies the relevant concepts of that phenomenon.

Explicit means that the type of concepts used and the constraints on their use are explicitly defined.

Formal refers to the fact that the ontology should be machine understandable, i.e. the machine should be able to interpret the semantics of the information provided.

Shared reflects the notion that an ontology captures consensual knowledge, that is, it is not restricted to some individual, but accepted by a group.

Page 3: OWL: Web Ontologies

3

RDF Schema and Ontologies Can define Classes and Properties

Using: <rdfs:Class ...>...</rdfs:Class> Using: <rdfs:Property ...>...</rdfs:Property>

Can identify Individuals as members of classes Using: <rdf:type ... />.

Can identity the domain and range of a property. Using: <rdfs:domain ...> Using: <rdfs:range ...>

Can identity subclasses and subproperties Using: <rdfs:subClassOf ...>...</rdfs:subClassOf> Using: <rdfs:subPropertyOf ...>...</rdfs:subPropert

yOf>

Page 4: OWL: Web Ontologies

4

RDF Schema Problems

there are lot of relationships we would like to add which RDF Schema does not allow us to say:That two classes are disjoint - they have no members in common

e.g. Cats and Dogs That properties are Inverses of each other - that is one property is the other "backwards":

e.g. hasChild and hasParentThat one class is formed by taking union of two other classes.

e.g. UniversityMembers is the combination of Staff and StudentsThat two classes are the same.

e.g. the class Humans is the same as the class People

Page 5: OWL: Web Ontologies

5

OWL: Three variants on OWL

OWL provides three increasingly expressive sublanguages designed for use by specific communities of implementers and users.

1. OWL Lite: 2. OWL DL: 3. OWL Full

Page 6: OWL: Web Ontologies

6

OWL: Namespaces As we are using RDF as the basis of OWL, we

start with a rdf:RDF element, and a series of Namespace declarations.

<rdf:RDF xmlns ="http://example.org/walkthru-in-owl#" xmlns:oex ="http://example.org/walkthru-in-owl#" xmlns:owl ="http://www.w3.org/2002/07/owl#" xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd ="http://www.w3.org/2000/10/XMLSchema#">

Page 7: OWL: Web Ontologies

7

OWL: Starting the Ontology This give metadata about the ontology.<owl:Ontology rdf:about="">

<owl:versionInfo>walkthru-in-owl.v2.0.0</owl:versionInfo> <owl:priorVersion rdf:resource="http://example.org/wal kthru-in-owl-v1"></owl:priorVersion> <rdfs:comment> An example ontology, with data types taken from XML Schema </rdfs:comment> <owl:imports rdf:resource="..."/> <rdfs:label>Walkthru Ontology</rdfs:label>

</owl:Ontology>

Page 8: OWL: Web Ontologies

8

OWL: Defining Classes

Classes are defined in a very similar manner to RDF Schema classes.

<owl:Class rdf:ID="Animal"> <rdfs:label>Animal</rdfs:label> <rdfs:comment> This is the class of animals. </rdfs:comment>

</owl:Class>

Page 9: OWL: Web Ontologies

9

OWL: Defining Classes

owl:Class is defined as a subclass of rdfs:Class

<rdfs:Class rdf:ID="Class"> <rdfs:label>Class</rdfs:label> <rdfs:comment>The class of all "object" classes</rdfs:comment> <rdfs:subClassOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class" />

</rdfs:Class>

Page 10: OWL: Web Ontologies

10

OWL: Class Thing and Nothing

<Class rdf:ID="Thing"> <rdfs:label>Thing</rdfs:label> <rdfs:comment> The most general (object) class in DAML. This is equal to the union of any class and its complement. </rdfs:comment> <unionOf rdf:parseType="Collection">

<rdfs:Class rdf:about="#Nothing"/> <rdfs:Class> <complementOf rdf:resource="#Nothing"/> </rdfs:Class>

</unionOf> </Class>

<Class rdf:ID="Nothing"> <rdfs:label>Nothing</rdfs:label> <rdfs:comment>the class with no things in it.</rdfs:comment> <complementOf rdf:resource="#Thing"/>

</Class>

Page 11: OWL: Web Ontologies

11

OWL: Defining SubClasses As OWL classes are also RDF classes, we

can use RDF Schema's subclassing mechanism

<owl:Class rdf:ID="Male"> <rdfs:subClassOf rdf:resource="#Animal"/>

</owl:Class> <owl:Class rdf:ID="Man"> <rdfs:subClassOf

rdf:resource="#Person"/> <rdfs:subClassOf rdf:resource="#Male"/>

</owl:Class>

Page 12: OWL: Web Ontologies

12

OWL: disjointWith Axiom Class descriptions form the building

blocks for defining classes through class axioms.

<owl:Class rdf:ID="Female"> <rdfs:subClassOf rdf:resource="#Animal"/> <owl:disjointWith rdf:resource="#Male"/>

</owl:Class> NOTE: OWL Lite does not allow the use of

owl:disjointWith

Page 13: OWL: Web Ontologies

13

OWL: Defining Individuals

Recall that in the OIL example, we provided individuals.

Can simply do the same in OWL - as in RDF:

<Man rdf:ID="Peter" /> <Man rdf:ID="Ian"/> This just says that Peter and Ian are objects

in the class Man. The first is equivalent to saying: <owl:Thing rdf:ID="Peter" /> <owl:Thing rdf:about="#Peter"><rdf:type rdf:resource="#Man"/></owl:Thing>

Page 14: OWL: Web Ontologies

14

OWL: sameAs Individuals

OWL can allow us to assert that individuals are the same

Use the owl:sameAs property<Man rdf:ID="Peter" /> <Man rdf:ID="MrSmith"> <owl:sameAs rdf:resource="#Peter" /> </Man>

Page 15: OWL: Web Ontologies

15

OWL: Enumerated Classes OWL DL (not OWL Lite) can provide Classes

of enumerated individual values. <owl:Class rdf:ID="Height"> <owl:oneOf rdf:parseType="owl:collection"> <Height rdf:ID="short"/> <Height rdf:ID="medium"/> <Height rdf:ID="tall"/> </owl:oneOf> </owl:Class>

Page 16: OWL: Web Ontologies

16

OWL: Defining Properties

OWL allows us to define two sorts of Properties:

1. Datatype properties 2. Object properties

Page 17: OWL: Web Ontologies

17

OWL: Defining DataType Properties

DataType Properties relate Classes with Datatypes (e.g. literals defined in XML Schema)

<owl:DatatypeProperty rdf:ID="age"><rdfs:comment> age is a DatatypeProperty

whose range is xsd:nonNegativeInteger.</rdfs:comment> <rdfs:range

rdf:resource="http://www.w3.org/2000/10/XMLSchema#nonNegativeInteger"/>

</owl:DatatypeProperty>

Page 18: OWL: Web Ontologies

18

OWL: Object Properties

To define Object Properties, we use owl:ObjectProperty. Again similar to RDF Schema properties, with domains and ranges:

<owl:ObjectProperty rdf:ID="hasParent"> <rdfs:domain rdf:resource="#Animal"/><rdfs:range rdf:resource="#Animal"/>

</owl:ObjectProperty> Domain and range information can be used to

infer type information <owl:Thing rdf:ID="Fred">

<hasParent rdf:resource="#Ian" /> </owl:Thing> Allows us to deduce that Fred is an Animal

Page 19: OWL: Web Ontologies

19

OWL: Object Properties

As another example, we define a property called hasHeight

<owl:ObjectProperty rdf:ID="hasHeight"> <rdfs:range rdf:resource="#Height"/>

</owl:ObjectProperty> We don't specify a domain, so this can be the

height of any "Thing" The following is the formal defintion of Objec

tProperty from the OWL standard.

Page 20: OWL: Web Ontologies

20

OWL: Object Properties The following is the formal defintion of Obje

ctProperty from the OWL standard <rdfs:Class rdf:ID="ObjectProperty">

<rdfs:label>ObjectProperty</rdfs:label><rdfs:comment>if P is an ObjectProperty, and P(x,

y), then y is an object.</rdfs:comment> <rdfs:subClassOf rdf:resource="http://www.w3.org

/1999/02/22-rdf-syntax-ns#Property" /> </rdfs:Class>

Page 21: OWL: Web Ontologies

21

OWL: SubProperties

Subproperties again are similar to RDF Schema:

<owl:ObjectProperty rdf:ID="hasFather"><rdfs:subPropertyOf rdf:resource="#hasParent"/><rdfs:range rdf:resource="#Male"/>

</owl:ObjectProperty>

Page 22: OWL: Web Ontologies

22

OWL: Property Characteristics

Property Characteristics specify the nature of properties, which can then be used to enhance the reasoning over the property.

We can specify what they mean by considering triples, that is we consider the triples (x P y) for the property P.

Page 23: OWL: Web Ontologies

23

OWL: Symmetric Property

A symmetric property is one which can be "switched around" and still remain within the property

That is, for a symmetric property P, if triple (x,P,y) then triple (y,P,x)

<owl:SymmetricProperty rdf:ID="isMarriedTo"> <rdfs:domain rdf:resource="#Person"/><rdfs:range rdf:resource="#Person"/>

</owl:SymmetricProperty> So if we have: Mary isMarriedTo Adam Then since isMarriedTo is Symmetric, then Adam isMarriedTo Mary

Page 24: OWL: Web Ontologies

24

OWL: Transitive Property

That is P is a transitive property, if triple (x,P,y) and triple (y,P,z), then triple (x,P,z):

<owl:TransitiveProperty rdf:ID="hasAncestor">

<rdfs:label>hasAncestor</rdfs:label></owl:TransitiveProperty> <owl:TransitiveProperty rdf:ID="descendant"/

>

Page 25: OWL: Web Ontologies

25

OWL: Transitive Property

So if we have: Mary hasAncestor Anne . Anne hasAncestor Adam . Then since hasAncestor is Transitive, thenMary hasAncestor Adam. TransitiveProperty is a sub-property of Object

Property

Page 26: OWL: Web Ontologies

26

OWL: Functional Property

So P is a FunctionalProperty if triple (x,P,y) and triple (x,P,z), then (y = z).

<owl:FunctionalProperty rdf:ID="hasMother"><rdfs:subPropertyOf rdf:resource="#hasParen

t"/><rdfs:range rdf:resource="#Female"/> </owl:FunctionalProperty>

Page 27: OWL: Web Ontologies

27

OWL: Functional Property

So if we have:Mary hasMother MrsRobinson. Mary hasMother Anne. Then since hasMother is Functional, then :Anne owl:sameAs MrsRobinson.

Page 28: OWL: Web Ontologies

28

OWL: Functional Property

We can also say that Datatype properties are functional.

<owl:DatatypeProperty rdf:ID="age"><rdfs:comment> age is also a FunctionalProperty (can only ha

ve one age) </rdfs:comment> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Fun

ctionalProperty"/> <rdfs:range rdf:resource="http://www.w3.org/2000/10/XMLSc

hema#nonNegativeInteger"/></owl:DatatypeProperty>

Page 29: OWL: Web Ontologies

29

OWL: Inverse Functional Property So P is a InverseFunctionalProperty if triple (x,P,y) a

nd triple (z,P,y), then (x = z). : <owl:InverseFunctionalProperty rdf:ID="isMarriedTo"/

> We can also say that Datatype properties are inverse

functional. <owl:DatatypeProperty rdf:ID="studentNumber">

<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/>

<rdfs:range rdf:resource="http://www.w3.org/2000/10/XMLSchema#nonNegativeInteger"/>

</owl:DatatypeProperty>

Page 30: OWL: Web Ontologies

30

OWL: Inverse Functional Property

So if we have: Mary studentNumber 87324. MsSmith studentNumber 87324. Then since studentNumber is Inverse Functi

onal, then :Mary owl:sameAs MsSmith. If the Ontology demands that they are differe

nt objects, then there is a contradiction.

Page 31: OWL: Web Ontologies

31

OWL: Inverse Property if have the triple (x,P,y), then triple (y,Q,x)): <owl:ObjectProperty rdf:ID="hasChild"> <owl:inverseOf rdf:resource="#hasParent"/></owl:ObjectProperty> So if we have: Mary hasChild Adam . Then since hasChild and hasParent are inver

se properties, then : Adam hasParent Mary .

Page 32: OWL: Web Ontologies

32

OWL: Property Restrictions

A slightly tricky example - as this is recursive. <owl:Class rdf:ID="Person">

<rdfs:subClassOf rdf:resource="#Animal"/> <rdfs:subClassOf>

<owl:Restriction> <owl:onProperty rdf:resource="#hasParent"/><owl:allValuesFrom rdf:resource="#Person"/>

</owl:Restriction></rdfs:subClassOf>

</owl:Class>

Page 33: OWL: Web Ontologies

33

OWL: Property Restrictions - Some Values From

As well as using allValuesFrom, we can also construct restrictions where at least one value of a domain is from a particular class

<owl:Class rdf:ID="Carnivore"><rdfs:subClassOf rdf:resource="#Animal"/><rdfs:subClassOf>

<owl:Restriction> <owl:onProperty rdf:resource="#eats"/><owl:someValuesFrom rdf:resource="#Animal"/>

</owl:Restriction> </rdfs:subClassOf>

</owl:Class>

Page 34: OWL: Web Ontologies

34

OWL: Cardinality Restrictions Can also use restriction to set the number of t

imes a property can occur on a class instance:<owl:Class rdf:about="#Person">

<rdfs:subClassOf> <owl:Restriction>

<owl:onProperty rdf:resource="#hasFather"/><owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1

</owl:cardinality> </owl:Restriction>

</rdfs:subClassOf></owl:Class>

Page 35: OWL: Web Ontologies

35

OWL: Cardinality Restrictions Can also have minCardinality and maxCardin

ality <owl:Class rdf:about="#Person">

<rdfs:subClassOf> <owl:Restriction>

<owl:onProperty rdf:resource="#hasSpouse"/><owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteg

er">1</owl:maxCardinality></owl:Restriction>

</rdfs:subClassOf> </owl:Class>

Page 36: OWL: Web Ontologies

36

OWL: Defining Classes by Value OWL DL (not OWL Lite) allows us to specify cl

asses based on the existence of particular property values.

TallThing is within the class of things whose hasHeight has the value tall:

<owl:Class rdf:ID="TallThing"><owl:subClassOf >

<owl:Restriction> <owl:onProperty rdf:resource="#hasHeight"/><owl:hasValue rdf:resource="#tall"/>

</owl:Restriction> </owl:subClassOf>

</owl:Class>

Page 37: OWL: Web Ontologies

37

OWL: Equivalent Classes and Properties

OWL provides constructs to say that Classes and Properties can be equivalant.

We can set classes to be equivalent. <owl:Class rdf:ID="HumanBeing"> <owl:EquivalentCla

ss rdf:resource="#Person"/></owl:Class> We can declare that two properties are the same: <owl:ObjectProperty rdf:ID="hasMum"> <owl:Equival

entProperty rdf:resource="#hasMother"/></owl:ObjectProperty>

Page 38: OWL: Web Ontologies

38

OWL: Equivalent Classes and Properties

These constructs can be used to map different Ontologies together.

<owl:Class rdf:ID="MyPerson"> <owl:EquivalentClass rdf:resource="foaf:Person"/>

</owl:Class>

Page 39: OWL: Web Ontologies

39

OWL: Equivalent Classes and Properties

Also, we can combine with a property restriction to say that the new class is exactly the restricted class.

<owl:Class rdf:about="#Carnivore"><rdfs:EquivalentClass>

<owl:Restriction> <owl:onProperty rdf:resource="#eats"/> <owl:allValuesFrom

rdf:resource="#Animal"/></owl:Restriction>

</rdfs:EquivalentClass> </owl:Class>

Page 40: OWL: Web Ontologies

40

OWL: Union

Thus Unions e.g. People are made up of exactly Men and Women:

<owl:Class rdf:about="#Person"> <rdfs:comment>every person is a man or a woman</rdfs:comment>

<owl:unionOf rdf:parseType="owl:collection"> <owl:Class rdf:about="#Man"/> <owl:Class rdf:about="#Woman"/> </owl:unionOf>

</owl:Class>

Page 41: OWL: Web Ontologies

41

OWL: Intersection

Similarly for Intersection e.g. a tall man is a tall thing which is also a man:<owl:Class rdf:ID="TallMan"> <owl:intersectionOf r

df:parseType="owl:collection"> <owl:Class rdf:about="#TallThing"/> <owl:

Class rdf:about="#Man"/> </owl:intersectionOf>

</owl:Class>

Page 42: OWL: Web Ontologies

42

OWL: Complementary Classes Complements e.g. Inanimate objects are the

things which are not living: <owl:Class rdf:ID="InanimateThing"> <owl:co

mplementOf rdf:parseType="owl:collection"> <owl:Class rdf:about="#LivingThing"/> </owl:complementOf>

</owl:Class>

Page 43: OWL: Web Ontologies

43

OWL: Defining Classes using these operations

Can be used to give the necessary and sufficient condition for a class.

e.g. Married People are People who are Married:<owl:Class rdf:ID="MarriedPerson">

<owl:intersectionOf rdf:parseType="owl:collection"> <owl:Class rdf:about="#Person"/>

<owl:Restriction ><owl:onProperty rdf:resource="#hasSpouse"/><owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:card

inality> </owl:Restriction>

</owl:intersectionOf></owl:Class>

Page 44: OWL: Web Ontologies

44

OWL: Defining Classes using these operations

e.g. People are not Cats:<owl:Class rdf:ID="Cat"> <rdfs:comment>no

cat is a person</rdfs:comment> <rdfs:subClassOf>

<owl:Class><owl:complementOf rdf:resource="#Person"/>

</owl:Class> </rdfs:subClassOf>

</owl:Class>

Page 45: OWL: Web Ontologies

45

OWL: User Defined DataTypes

By combining with XML Schema DataTypes we can make more precise definitions of the values that Datatype properties can have, in the XML Schema.

<xsd:simpleType name="over17"> <xsd:restriction base="xsd:positiveInteger"> <xsd:minInclusive value="18"/> </xsd:restriction>

</xsd:simpleType>

Page 46: OWL: Web Ontologies

46

OWL: User Defined DataTypes

And in the OWL file: <owl:Class rdf:ID="Adult">

<owl:Restriction> <owl:onProperty rdf:resource="#age"/> <owl:allValues

From rdf:resource= "http://example.org/walkthru-in-owl#over17"/>

</owl:Restriction> </owl:Class>

Page 47: OWL: Web Ontologies

47

OWL: Defining Instances Thus to redefine the Individuals we had earlier, with so

me additional properties:<Person rdf:ID="Peter"> <shoesize>9.5</shoesize>

<age>46</age> <shirtsize>15</shirtsize>

</Person>

<Person rdf:ID="Ian"><shoesize>14</shoesize> <age>37</age> <shirtsize><xsd:string rdf:value="12"/></shirtsize>

</Person>

Page 48: OWL: Web Ontologies

48

OWL-QL

OWL-QL (OWL Query Language) a query language for OWL based on DQL (DAML Query Lang.) supports query-answering dialogues

Page 49: OWL: Web Ontologies

49

Basic Queries

a query pattern (required)a must-bind variables lista may-bind variables lista don’t bind variables listan answer patterna query premisean answer KB patternan answer bundle size bound

Page 50: OWL: Web Ontologies

50

A simple OWL-QL query 1

If C1 is a Seafood Course and W1 is a drink of C1, what color is W1? P: (type C1 Seafood-Course) (drink C1 W1) Q: (has-color W1 ?x) V: must-bind ?x AP: drink ?x Wine with SeafooodKB: http://somewhere.com/wine.owlA: drink White Wine with Seafood

Page 51: OWL: Web Ontologies

51

Basic Queries 1<rdfs:Class rdf:ID="SEAFOOD-COURSE">

<owl:subClassOf> <owl:Restriction>

<owl:onProperty rdf:resource="#DRINK"/> <owl:toClass> <owl:Restriction>

<owl:onProperty rdf:resource="#COLOR"/> <owl:hasValue rdf:resource="#WHITE"/>

</owl:Restriction> </owl:toClass>

</owl:Restriction> </owl:subClassOf>

</rdfs:Class>

Page 52: OWL: Web Ontologies

52

A simple OWL-QL query 2

Query: (“Who owns a red car?”)Query Pattern: (owns ?p ?c) (type ?c

Car) (has-color ?c Red)Must-Bind Variables List: (?p)May-Bind Variables List: ()Don’t-Bind Variables List: ()Answer Pattern: (owns ?p a red car)Answer KB Pattern: …

Page 53: OWL: Web Ontologies

53

Basic Queries 2<owl-ql:query xmlns:owl-ql="http://www.w3.org/2003/10/owl-ql-syntax

#"xmlns:var="http://www.w3.org/2003/10/owl-ql-variables#">

<owl-ql:queryPattern><rdf:RDF>

<rdf:Description rdf:about="http://www.w3.org/2003/10/owl-ql-variables#p"><owns rdf:resource="http://www.w3.org/2003/10/owl-ql-variables#c"/></rdf:Description><Car rdf:ID="http://www.w3.org/2003/10/owl-ql-variables#c">

<has-color rdf:resource="#Red"/></Car>

</rdf:RDF></owl-ql:queryPattern><owl-ql:mustBindVars>

<var:p/></owl-ql:mustBindVars><owl-ql:answerKBPattern>

<owl-ql:kbRef rdf:resource="http://joedata/joe.owl"/></owl-ql:answerKBPattern><owl-ql:answerSizeBound>5</owl-ql:answerSizeBound> /*… answer pattern*/

</owl-ql:query>

Page 54: OWL: Web Ontologies

54

Query patterns

specifies a collection of OWL sentences in which some URIrefs are considered to be variables

Query Pattern: (owns ?p ?c) (type ?c Car) (has-color ?c Red)

Page 55: OWL: Web Ontologies

55

OWL-QL bindings

A KB may entail the existence of a query answer, but not entail a binding for every variable in the query

A KB says-every person has exactly one father and -Joe is a person

The KB-entails that Joe has a father-but may not entail a value of property “hasFather” for Joe(i.e., the KB may not identify the father)

Page 56: OWL: Web Ontologies

56

OWL-QL bindings

Three types of OWL-QL bindings1. must-bind variables lists

-Answers must provide bindings for all the must-bind variables

2. may-bind variables lists-Answers may provide bindings for any of the may-bind variables

3. don’t-bind variables lists-Answers are not to provide bindings for any of the don’t-bind variables

Page 57: OWL: Web Ontologies

57

Answer patterns

specify the format in which answer bindings are returned

Answer Pattern: (owns ?p a red car)}

Page 58: OWL: Web Ontologies

58

Query premises

enable “if-then” queries-such as “If Joe is a person, then does Joe have a father?”-“if-then” queries cannot be stated using only a query pattern

When a premise is included in a query-it is considered to be included in the answer KB

Query: “If C1 is a Seafood Course and W1 is a drink of C1, then what color is W1?

Premise: {(type C1 Seafood-Course) (has-drink W1 C1)}

Query Pattern: {(has-color W1 ?x)}Must-Bind Variables List: (?x)

Page 59: OWL: Web Ontologies

59

Answer KB patterns specify answer KBs

-answer KB: a set of OWL sentences that are used by the server in answering a query

If a query’s answer KB pattern is -a variablethen the server is free to select or to generate an answer KB from which to answer the query -a KB (or a reference to a KB)then the answer sentences must be entailed by that KB-a list of KBsthen answer sentences must be entailed by conjunction of the KBs in that list

Page 60: OWL: Web Ontologies

60

An OWL-QL answer

Contains-answer pattern instances-an answer bundle (including process

handle)

Page 61: OWL: Web Ontologies

61

A simple OWL-QL answerQuery: (“Who owns a red car?”)Query Pattern: {(owns ?p ?c) (type ?c Car) (has-

color ?c Red)}Must-Bind Variables List: (?p)May-Bind Variables List: ()Don’t-Bind Variables List: ()Answer Pattern: (owns ?p a red car)Answer KB Pattern: …

Answer: (“Joe owns a red car.”)Answer Pattern Instance: (owns Joe a red car)Query: …Server: …

Page 62: OWL: Web Ontologies

62

A simple OWL-QL answer<owl-ql:answerBundle xmlns:owl-ql="http://www.w3.org/2003/1

0/owl-ql-syntax#"xmlns:var="http://www.w3.org/2003/10/owl-ql-variables#">

<owl-ql:queryPattern><rdf:RDF><rdf:Description rdf:about="http://www.w3.org/2003/10/owl-ql-variable

s#p"><owns rdf:resource="http://www.w3.org/2003/10/owl-ql-variables#c"/></rdf:Description><Car rdf:ID="http://www.w3.org/2003/10/owl-ql-variables#c">

<has-color rdf:resource="#Red"/></Car></rdf:RDF>

</owl-ql:queryPattern><owl-ql:answer>

<owl-ql:binding-set><var:p rdf:resource="#Joe"/></owl-ql:binding-set>

Page 63: OWL: Web Ontologies

63

A simple OWL-QL answer (Cont)<owl-ql:answerPatternInstance>

<rdf:RDF><rdf:Description rdf:about="#Joe">

<owns rdf:resource="http://www.w3.org/2003/10/owl-ql-variables#c"/>

</rdf:Description><Car rdf:ID="http://www.w3.org/2003/10/owl-ql-variables#c">

<has-color rdf:resource="#Red"/></Car></rdf:RDF>

</owl-ql:answerPatternInstance></owl-ql:answer><owl-ql:continuation><owl-ql:termination-token> <owl-ql:none/>

</owl-ql:termination-token> </owl-ql:continuation>

</owl-ql:answerBundle>

Page 64: OWL: Web Ontologies

64

Answer bundle size bounds

specify the maximum number of answers in each “bundle”-answers are delivered by the server in bundles

<owl-ql:answerSizeBound>5</owl-ql:answerSizeBound> contain at most the number of query answer

s given by the answer bundle size bound

Page 65: OWL: Web Ontologies

65

Support for OWL OWL-QL

-takes advantage of the expressive power of the OWL language itself

Q: (subclassOf ?x Person) must-bind ?xwill return the derivable subclasses of class Person

Q: (type ?x Person) must-bind ?xwill return the derivable instances of class Person

limited to concepts which can be expressed using OWLno way to express the concept of a most specific type in OWL E.g., expressivity for numerical quantities is absent and is

currently handled outside the OWL and reasoning No OWL-specific query language recommended (SPAR

QL is temporary solution)

Page 66: OWL: Web Ontologies

66

Online Demonstrations

Try OWQL Query Service at http://onto.stanford.edu:8080/owql/FrontEnd

Page 67: OWL: Web Ontologies

67

References

OWL Web Ontology LanguageGuidehttp://www.w3.org/TR/owl-guide/

OWL-QL Project for the Stanford Knowledge Systems Laboratory

http://www.ksl.stanford.edu/projects/owl-ql/

SPARQL and OWL-QL

http://dbserver.kaist.ac.kr/~mhkim/sep541-07summer.dir/sparql-owlql-(105pages).pdf