Module 2
Module 2
Module 2
Knowledge Representation in Description Logic
Introduction - An Informal Example
The Family of Attributive Languages
Inference Problems.
RDF and RDF Schema
Introduction
XML Essentials
RDF- RDF Schema
A Summary of the RDF/RDF Schema Vocabulary.
OWL
Introduction
Requirements for Web Ontology Description Languages
Header Information
Versioning
Annotation Properties
Properties
Classes
Individuals
Data types
A Summary of the OWL Vocabulary.
Description Logics: Introduction
• Description Logics are a subset of first-order logic:
– Only unary predicates (called concepts) and binary
predicates (called roles, properties).
• Knowledge bases are composed of:
– T-box: defining the concepts and the roles
– A-box: including ground facts about individuals
• Complex concepts are defined by concept descriptions:
– The expressive power of the language is determined by the
set of constructors in the grammar of concept descriptions
– Complex roles can also be defined via constructors
DL Syntax - Introduction
– Concept (class) names
e.g., Cat, Animal, Doctor
• Equivalent to FOL unary predicates
– Role (property) names
e.g., sits-on, hasParent, loves
• Equivalent to FOL binary predicates
– Constants (Individual) names
e.g., Felix, John, Mary, Boston, Italy
• Equivalent to FOL constants
DL Syntax - Introduction
DL should include constructors to define :
• Complex concepts
• Complex roles
• Axioms
• Assertions
Reasoning techniques should cover :
• Concept subsumption
• Concept instantiation
DL system
Example - concepts
Concepts denote unary descriptions
Example - roles
Knowledge Base
Inference System
Tbox (schema)
Interface
Man ´ Human u Male
Happy-Father ´ Man u 9 has-child
Female u …
Abox (data)
John : Happy-Father
hJohn, Maryi : has-child
John: 6 1 has-child
XML Essentials
• An XML element is made up of a start tag, an end tag, and data in
between.
• Example:
<director> Matthew Dunn </director>
• Example of another element with the same value:
<actor> Matthew Dunn </actor>
• XML tags are case-sensitive: <CITY> <City> <city>
• XML can abbreviate empty elements, for example:
<married> </married> can be abbreviated to <married/>
• An attribute is a name-value pair separated by an equal sign (=).
• Example: <City ZIP=“94608”> Emeryville </City>
• Attributes are used to attach additional, secondary information to
an element.
• A basic XML document is an XML element that can, but might not,
include nested XML elements.
• Example:
<books>
<book isbn=“123”>
<title> Second Chance </title>
<author> Matthew Dunn </author>
</book>
</books>
• Authoring guidelines:
– All elements must have an end tag.
– All elements must be cleanly nested (overlapping elements are not allowed).
– All attribute values must be enclosed in quotation marks.
– Each document must have a unique first element, the root node.
RDF, RDFS
RDF and RDFS
• RDF stands for Resource Description Framework
• It is a W3C recommendation (http://www.w3.org/RDF)
• RDF is graphical formalism ( + XML syntax + semantics)
– for representing metadata
– for describing the semantics of information in a machine-
accessible way
• RDFS extends RDF with “schema vocabulary”, e.g.:
– Class, Property
– type, subClassOf, subPropertyOf
– range, domain
RDF Statements
• RDF Statements
– A specific resource together with a named
property plus the value of that property for that
resource
• subject, the predicate, and the object
– the object of a statement can be another resource
or it can be a literal
Representation - Triple
• Ora Lassila is the creator of the resource
http://www.w3.org/Home/Lassila
hasColleague
Ian Uli
hasHomePage
hasColleague
Carole http://www.cs.mam.ac.uk/~sattler
<Description about="some.uri/person/ian_horrocks">
<hasColleague resource="some.uri/person/uli_sattler"/>
</Description>
<Description about="some.uri/person/uli_sattler">
<hasHomePage>http://www.cs.mam.ac.uk/~sattler</hasHomePage>
</Description>
<Description about="some.uri/person/carole_goble">
<hasColleague resource="some.uri/person/uli_sattler"/>
</Description>
RDF Syntax: Triples and Graphs
ex:name ex:name
_:xxx _:yyy
ex:member-of
rdf:type rdf:type
ex:Person ex:Organisation
RDF Schema (RDFS)
• RDF gives a formalism for meta data annotation, and a way to write it
down in XML, but it does not give any special meaning to vocabulary
such as subClassOf or type
– Interpretation is an arbitrary binary relation
– I.e., <Person,subClassOf,Animal> has no special meaning
• <rdf:Property rdf:ID="hasFather">
• <rdfs:subPropertyOf rdf:resource="#hasParent"/>
• <rdfs:range rdf:resource="#Male"/>
• </rdf:Property>
RDF Core Classes and Properties 4
• rdfs:range
– An instance of rdfs:Property, used to indicate class(es) that the values of a
property will be members of.
– The value of an rdfs:range property is always a Class.
– The rdfs:range property can itself be used to express this: the rdfs:range
of rdfs:range is the class rdfs:Class. This indicates that any resource that is
the value of a range property will be a class.
– The rdfs:range property is only applied to properties. This can also be
represented in RDF using the rdfs:domain property. The rdfs:domain of
rdfs:range is the class rdf:Property. This indicates that the range property
applies to resources that are themselves properties.
RDF Core Classes and Properties 4’
• rdfs:domain
– An instance of rdf:Property that is used to indicate the
class(es) that will have as members any resource that has
the indicated property.
– The rdfs:domain of rdfs:domain is the class rdf:Property.
This indicates that the domain property is used on
resources that are properties.
– The rdfs:range of rdfs:domain is the class rdfs:Class. This
indicates that any resource that is the value of adomain
property will be a class.
RDF Container Classes and Properties 1
• rdfs:Container
– The rdfs:Container class is a super-class of the RDF Container classes, ie.
rdf:Bag, rdf:Seq, rdf:Alt.
• rdf:Bag
– The rdf:Bag class represents RDF's 'Bag' container construct, and is a
subclass of rdfs:Container.
• rdf:Seq
– The rdf:Seq class represents RDF's 'Sequence' container construct, and is
a subclass of rdfs:Container.
• rdf:Alt
– The rdf:Seq class represents RDF's 'Alt' container construct, and is a
subclass of rdfs:Container.
RDF Container Classes and Properties 2
• rdfs:ContainerMembershipProperty
– The rdfs:ContainerMembershipProperty class has as
members the property rdfs:member and the properties _1,
_2, _3 ... that can be used to indicate membership of Bag,
Seq and Alt containers.
– rdfs:ContainerMembershipProperty is a subclass of
rdf:Property. Each container membership property is a
rdfs:subPropertyOf the rdfs:member property.
• rdfs:member
– The rdfs:member property is a super-property of the
container membership properties.
– (That is, each numbered container membership property has
a rdfs:subPropertyOf relationship to the property
rdfs:member).
RDF Container Classes and Properties 3
• rdf:List
– The rdf:List class represents the class of RDF Lists. It is used
with the 'first', 'rest' and 'nil' constructs, and has special case
support in the RDF/XML syntax.
• rdf:first
– The rdf:first property represents a relationship between an
rdf:List and its first item.
• rdf:rest
– The rdf:rest property represents a relationship between an
rdf:List item and the rest of the list, or its end (ie. rdf:nil).
• rdf:nil
– The rdf:nil resource represents an empty rdf:List.
RDF Utility Classes and Properties 1
• rdfs:seeAlso
– The property rdfs:seeAlso is used to indicate a resource that might
provide additional RDF information about the subject resource.
• rdfs:isDefinedBy
– The property rdfs:isDefinedBy is a subproperty of rdfs:seeAlso, and
indicates the resource defining the subject resource.
• rdf:value
– The rdf:value property identifies the principal value (usually a string)
of a property when the property value is a structured resource.
RDF Utility Classes and Properties 2
• rdf:Statement
– The rdf:Statement class represents statements about the properties of
resources.
– rdf:Statement is the domain of the properties rdf:predicate, rdf:subject
and rdf:object.
– Different individual rdf:Statement instances may happen to have the
same values for their predicate, subject and object properties.
• rdf:subject
– The subject of an RDF statement.
– The rdf:subject property indicates a resource that is the subject of some
RDF statement.
– The rdfs:domain of rdf:subject is rdf:Statement and the rdfs:range is
rdfs:Resource. This property can be used to specify the resource
described by an RDF
RDF Utility Classes and Properties 3
• rdf:predicate
– The predicate of an RDF statement.
– The rdfs:domain of rdf:predicate is rdf:Statement and the rdfs:range is
rdfs:Resource. This property can be used to specify the predicate used
in an RDF statement.
• rdf:object
– The object of an RDF statement.
– The rdfs:domain of rdf:object is rdf:Statement. No range is defined for
this property since values of rdfs:object can include both Literals and
Resources.
– This property can be used to specify the object of anRDF statement.
Example - RDF Schema Model
RDFS
• RDFS vocabulary adds constraints on models,
e.g.:
– 8x,y,z type(x,y) and subClassOf(y,z) ) type(x,z)
ex:Person ex:Animal
rdfs:subClassOf
rdf:type
ex:John ex:Person
rdf:type
ex:Animal
Problems with RDFS
• RDFS too weak to describe resources in sufficient detail
– No localised range and domain constraints
• Can’t say that the range of hasChild is person when applied to persons and elephant
when applied to elephants
– No existence/cardinality constraints
• Can’t say that all instances of person have a mother that is also a person, or that
persons have exactly 2 parents
– No transitive, inverse or symmetrical properties
• Can’t say that isPartOf is a transitive property, that hasPart is the inverse of isPartOf
or that touches is symmetrical
–…
• Difficult to provide reasoning support
– No “native” reasoners for non-standard semantics
– May be possible to reason via FO axiomatisation
RDF Schema is now being superseded by
OWL
RDF Vocabulary
Classes:
rdf:Property, rdf:Statement, rdf:XMLLiteral
rdf:Seq, rdf:Bag, rdf:Alt, rdf:List
Properties:
rdf:type, rdf:subject, rdf:predicate,
rdf:object,
rdf:first, rdf:rest, rdf:_n
rdf:value
Resources:
rdf:nil RDFS Vocabulary
RDFS Properties
rdfs:domain
RDFS Vocabulary rdfs:range
rdfs:subPropertyOf
RDFS Classes rdfs:subClassOf
rdfs:Resource rdfs:member
rdfs:Class rdfs:seeAlso
rdfs:Literal rdfs:isDefinedBy
rdfs:Datatype rdfs:comment
rdfs:Container rdfs:label
rdfs:ContainerMembershipProperty
OWL
• Defined Concepts
– owl:Class, a subclass of rdfs:class
– owl:Restriction, the class of all restrictions
Class(SpicyPizza complete
annotation(rdfs:label "PizzaTemperada"@pt)
annotation(rdfs:comment "Any pizza that has a
spicy topping is a SpicyPizza"@en)
Pizza restriction(hasTopping
someValuesFrom(SpicyTopping))
)
OWL Syntax: N3
• Recommended for human-readable fragments
default:SpicyPizza
a owl:Class ;
rdfs:comment "Any pizza that has a spicy topping is a SpicyPizza"@en ;
rdfs:label "PizzaTemperada"@pt ;
owl:equivalentClass
[ a owl:Class ;
owl:intersectionOf (default:Pizza [ a owl:Restriction ;
owl:onProperty default:hasTopping ;
owl:someValuesFrom default:SpicyTopping
])
].
OWL Syntax: RDF/XML
• Recommended for serialisation
<owl:Class rdf:ID="SpicyPizza">
<rdfs:label xml:lang="pt">PizzaTemperada</rdfs:label>
<rdfs:comment xml:lang="en">Any pizza that has a spicy topping is a SpicyPizza</rdfs:comment>
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Pizza"/>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:about="#hasTopping"/>
</owl:onProperty>
<owl:someValuesFrom rdf:resource="#SpicyTopping"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
Abstract Syntax: Declaring classes in
OWL
• Naming a new class “plant”:
Class(pp:plant partial)
• Alternative Declaration:
Class(pp:grass partial)
Class(pp:tree partial)
SubClassOf(pp:grass pp:plant)
SubClassOf(pp:tree pp:plant)
Abstract Syntax: Declaring Properties in
OWL
• A simple property:
ObjectProperty(pp:eaten_by)
• Property Hierarchy:
SubPropertyOf(pp:has_pet pp:likes)
• Algebraic properties:
ObjectProperty(pp:married_to Symmetric)
ObjectProperty(pp:ancestor_of Transitive)
ObjectProperty(pp:passport_nr Functional)
Abstract Syntax: Individuals in OWL
• Individual(pp:Tom type(owl:Person))
• Individual(pp:Dewey type(pp:duck))
• Individual(pp:Rex type(pp:dog)
value(pp:is_pet_of pp:Mick))
• Individual(pp:Mick type(pp:male)
value(pp:reads pp:Daily-Mirror)
value(pp:drives pp:Golf-GTI)
value(pp:name „Mick"ˆxsd:string))