32
of 32 lecture 8: owl – language I

Of 32 lecture 8: owl language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl = xmlns:rdf

Embed Size (px)

DESCRIPTION

of 32 ece 627, winter ‘133 owl:Ontology An example OWL ontology University Ontology …

Citation preview

Page 1: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32

lecture 8: owl – language I

Page 2: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 2

OWL XML/RDF syntax: header

<rdf:RDF 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/2001/XLMSchema#">

an OWL ontology may start with a collection of assertions for housekeeping purposes using owl:Ontology element

Page 3: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 3

owl:Ontology<owl:Ontology rdf:about=""> <rdfs:comment>An example OWL ontology </rdfs:comment> <owl:priorVersion

rdf:resource="http://www.mydomain.org/uni-ns-old"/> <owl:imports

rdf:resource="http://www.mydomain.org/persons"/> <rdfs:label>University Ontology</rdfs:label></owl:Ontology>

Page 4: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 4

owl:Ontologyowl:imports means an ontology O1 imports another ontology O2, and then the entire set of declarations in O2 is appended to O1

importing ontology O2 will also import all of the ontologies that O2 imports

Page 5: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 5

classesclasses are defined using owl:Class owl:Class is a subclass of rdfs:Class

<owl:Class rdf:about="#associateProfessor”/>

Page 6: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 6

classes (2)disjointness of classes is defined using owl:disjointWith

<owl:Class rdf:about="#associateProfessor"> <owl:disjointWith rdf:resource="#professor"/> <owl:disjointWith rdf:resource="#assistantProfessor"/></owl:Class>

Page 7: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 7

classes (3) owl:equivalentClass defines equivalence of classes

<owl:Class rdf:ID="faculty"> <owl:equivalentClass rdf:resource="#academicStaffMember"/></owl:Class>

Page 8: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 8

classes (4) owl:Thing is the most general class, which contains everything

owl:Nothing is the empty class

Page 9: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 9

propertiesin OWL there are two kinds of properties object properties, which relate objects to other objectsfor example, is-TaughtBy, supervises

data type properties, which relate objects to datatype valuesfor example, phone, title, age

Page 10: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 10

datatype propertiesOWL makes use of XML Schema data types, using the layered architecture of the Semantic Web

<owl:DatatypeProperty rdf:ID="age"> <rdfs:range rdf:resource= "http://www.w3.org/2001/XLMSchema

#nonNegativeInteger"/></owl:DatatypeProperty>

Page 11: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 11

object propertiesuser-defined data types

<owl:ObjectProperty rdf:ID="isTaughtBy"> <owl:domain rdf:resource="#course"/> <owl:range rdf:resource="#academicStaffMember"/> <rdfs:subPropertyOf rdf:resource="#involves"/></owl:ObjectProperty>

Page 12: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 12

property restrictionsintroduction – anonymous superclass

in OWL we can declare that the class C satisfies certain conditions all instances of C satisfy the conditions

this is equivalent to saying that C is subclass of a class C', where C' collects all objects that satisfy the conditions C' can remain anonymous

Page 13: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 13

property restrictionsintroduction – anonymous superclass

a (restriction) class is achieved through an owl:Restriction element

this element contains an owl:onProperty element and one or more restriction declarations

Page 14: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 14

property restrictionsintroduction – anonymous superclass

1 <owl:Class rdf:about=C>2 …3 <rdfs:subClassOf>4 <owl:Restriction>5 <owl:onProperty rdf:resource=P/>6 … declaration of restriction R …7 </owl:Restriction>8 </rdfs:subClassOf>9 …10 </owl:Class> in

Set Theory

Page 15: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 15

property restrictionsintroduction – anonymous superclass

lines 4 to 7 define the (unnamed) class fo all things that satisfy R

line 3 indicates that C is a sublass of such a (unnamed class)

the pattern in lines 3 to 8 may be repeated to define multiple restrictions for the same class

Page 16: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 16

property restrictions (2)

three types of restrictions: quantified restrictions value restrictions (filler information) cardinality restrictions

Page 17: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 17

property restrictions (3)quantified restrictions owl:allValuesFrom specifies universal quantification (C P.D)

owl:someValuesFrom specifies existential quantification (C P.D)

Page 18: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 18

property restrictions (4)value restrictions owl:hasValue specifies a specific value

Page 19: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 19

property restrictions (5)cardinality restrictions owl:cardinality specifies the exact number of occurences of P each instance of C must have

owl:maxCardinality (owl:minCardinality)specifies the max (min) number of occurences of P each instance of C must have

Page 20: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 20

owl:someValuesFrom<owl:Class rdf:about="#academicStaffMember"><rdfs:subClassOf> <owl:Restriction>

<owl:onProperty rdf:resource="#teaches"/><owl:someValuesFrom

rdf:resource="#undergraduateCourse"/> </owl:Restriction></rdfs:subClassOf>

</owl:Class>

Page 21: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 21

owl:allValuesFrom<owl:Class rdf:about="#firstYearCourse"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#isTaughtBy"/>

<owl:allValuesFrom rdf:resource=”#professor"/> </owl:Restriction> </rdfs:subClassOf>

</owl:Class>

Page 22: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 22

owl:hasValue<owl:Class rdf:about="#mathCourse">

<rdfs:subClassOf><owl:Restriction>

<owl:onProperty rdf:resource="#isTaughtBy"/>

<owl:hasValue rdf:resource="#949352"/></owl:Restriction>

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

Page 23: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 23

cardinality restrictions

<owl:Class rdf:about="#course"> <rdfs:subClassOf><owl:Restriction><owl:onProperty rdf:resource="#isTaughtBy"/><owl:Cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:Cardinality></owl:Restriction> </rdfs:subClassOf></owl:Class>

Page 24: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 24

properties of object properties

owl:TransitivePropertyfor example, “has better grade than”, “is ancestor of”

R is transitive iff,for any x, y and z, if R(x,y) and R(y,z) then R(x,z)

Page 25: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 25

properties of object properties (2)

owl:SymmetricPropertyfor example, “has same grade as”, “is sibling of”

R is symmetric iff,for any x, y, R(x,y) iff R(y,x)

Page 26: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 26

properties of object properties (3)

owl:FunctionalProperty defines a property that has at most one value for each objectfor example, “age”, “height”, “directSupervisor”

R is functional iff,for any x, y and z, if R(x,y) and R(x,z) then y=z

Page 27: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 27

properties of object properties (4)

owl:InverseFunctionalProperty defines a property for which two different objects cannot have the same value

R is inverse functional iff,for any x, y and z, if R(y,x) and R(z,x) then y=z

(only for OWL Full)

Page 28: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 28

properties of object properties (5)

owl:InverseOf

S is the inverse of R iff,for any x, y, R(x,y) iff S(y,x)

Page 29: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 29

properties of object properties – example

<owl:ObjectProperty rdf:ID=”isTaughtBy">

<rdf:type rdf:resource="&owl;FunctionalProperty"/> <owl:domain rdf:resource="#course"/> <owl:range rdf:resource="#academicStaffMember"/></owl:ObjectProperty>

Page 30: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 30

properties of object properties – example

<owl:ObjectProperty rdf:ID="hasSameGradeAs">

<rdf:type rdf:resource="&owl;TransitiveProperty"/>

<rdf:type rdf:resource="&owl;SymmetricProperty"/>

<rdfs:domain rdf:resource="#student"/><rdfs:range rdf:resource="#student"/>

</owl:ObjectProperty>

Page 31: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 31

<owl:ObjectProperty rdf:ID="teaches"> <rdfs:range rdf:resource="#course"/> <rdfs:domain rdf:resource="#academicStaffMember"/> <owl:inverseOf rdf:resource="#isTaughtBy"/></owl:ObjectProperty>

properties of object properties – example

Page 32: Of 32 lecture 8: owl  language I. of 32 ece 627, winter 132 OWL XML/RDF syntax: header rdf:RDF xmlns:owl =  xmlns:rdf

of 32ece 627, winter ‘13 32

owl:equivalentProperty

<owl:ObjectProperty rdf:ID="lecturesIn"> <owl:equivalentProperty rdf:resource="#teaches"/></owl:ObjectProperty>

properties of object properties – example