XML RDF Rdfs Owl
XML RDF Rdfs Owl
Introduction to IRI,
XML, RDF,
RDFS, and OWL
Part1 Part2 Part3
Semantic Web (CSC751)
Ubbo Visser
Outline
Announcements
Identification of resource
Announcements
Assignment - Reading
(Mandatory) Appendix A, Ch. 2 - 2.5 [HKR09].
Outline Annon. SW stack IRI XML RDF RDFS OWL
Identification of resource
Reason
We need a unambiguous way to identify things and concepts, because machines need to
process and compose information automatically.
We borrow the Web resource identification idea from the Web.
Uniform Resource Identifier (URI): theoretically distinguishes resources in the Web.
Uniform Resource Locators (URL): these are Web addresses that are used to access
online documents.
Internationalized Resource Identifier (IRI): provides the way to encode Web addresses
with Unicode.
Therefore, URLs ⊆ URIs ⊆ IRIs
Content negotiation.
Outline Annon. SW stack IRI XML RDF RDFS OWL
URIs
Format
scheme:[//authority]path[?query][#fragment]
scheme: type of URI, e.g., http, ftp, irc etc.
[//authority]: domain name.
path: some relative path.
[?query]: this is optional and provides non-hierarchical information such as parameters for
a Web service.
[#fragment]: this is optional and it is commonly used for addressing parts of the
document relative to the base URI.
Not all characters are allowed in URIs.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Outline Annon. SW stack IRI XML RDF RDFS OWL
XML
XML is a markup language recommended by the World Wide Web Consortium (W3C) for
data exchange and electronic publishing.
It provides structure to unstructured text and annotated texts.
text is data, and
additional information about data is metadata (i.e., data about data).
HTML is a popular markup language to visualize Web pages. It has tags such as
<h2>Sam</h2> with predefined semantics for the visualization (e.g., Sam).
XML tags can be chosen freely and their general meaning is not predefined. Hence, its
whole purpose is to structure the documents.
Database view: XML as a data model for semi-structured data.
Every XML document is a text document with a declaration for which XML version and
the character encoding is used. e.g.,
<?xml version=“1.0” encoding=“utf-8”?>
Outline Annon. SW stack IRI XML RDF RDFS OWL
Tree structure
Outline Annon. SW stack IRI XML RDF RDFS OWL
XML elements:
Attribute
Root element
There is one-and-only
outermost element called root
element.
XML elements are enclosed
with matching tag-pairs.
Empty elements can
abbreviated.
Syntactically correct XML documents are
Element names are QNames.
said to be well-formed.
XML attributes:
HTML uses fixed vocabulary with fixed
Name value pairs inside of
XML elements. meaning and used for displaying
It is an alternative means to information.
sub-elements describing data. XML uses arbitrary tags and whose
meaning is not fixed.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Namespaces
Disambiguate elements or attribute names using namespaces.
Declaration: xmlns:namespace=“<URI>”
Namespace affects from the declaration and below of the sub-tree.
Multiple declarations are possible.
If we need declaration that affects the whole document, we use a mechanism so called
Document Type Definitions (DTD). We discuss this when we talk about RDF.
We are interested in XML Schema.
Outline Annon. SW stack IRI XML RDF RDFS OWL
XML Schema
XML allows a lot of degree of freedom in encoding information.
XML Schema
XML Schema itself is written in XML!
XML documents are valid if it corresponds to a XML Schema.
An XML Schema is a well-formed XML document that contains XML schema definitions.
It has the root element,
<xsd:schema xmlns:xsd=“[Link] and contains element
types, which can contain attribute types, which themselves refer to predefined or
user-defined datatypes.
Datatypes are, e.g., xsd:integer, xsd:string, xsd:time, xsd:date, xsd:anyURI, xsd:ID (a
specific kind of string used as an identifier of XML elements)
Outline Annon. SW stack IRI XML RDF RDFS OWL
XML Schema
Outline Annon. SW stack IRI XML RDF RDFS OWL
Random thoughts
“ Any damn fool could produce a better data format than XML”
- James Clark1
e.g., SOA
Service Oriented Architecture, Web Services, WSDLs, and RESTFul services.
1 [Link]
Outline Annon. SW stack IRI XML RDF RDFS OWL
Outline Annon. SW stack IRI XML RDF RDFS OWL
Motivation
Let say we have to encode these sentences,
TextBook(FOST ) (1)
Resource identification
We use URIs to represent concepts, relations, and individuals. E.g.,
FOST → [Link]
isPublishedBy → [Link]
CRC Press → [Link]
Outline Annon. SW stack IRI XML RDF RDFS OWL
2 [Link]
Outline Annon. SW stack IRI XML RDF RDFS OWL
RDF triple
[Link]
[Link] [Link]
RDF components
URIs uniquely represent resources.
Literals are for data values.
Encoded as strings.
Meaning is interpreted by the associated datatype.
Untyped literals are treated as strings.
Blank nodes for anonymously connecting sets of triples.
Outline Annon. SW stack IRI XML RDF RDFS OWL
[Link] [Link]
URIs in angle brackets, literals enclosed in quotes, and triples end with a period. All white spaces:
blank lines, line feeds are skipped.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Turtle shortcut: grouping triples with same subject, and same subject and predicate
Outline Annon. SW stack IRI XML RDF RDFS OWL
Subject Property
Object
Untyped
[Link]
[Link] [Link]
[Link] [Link]
Untyped text is taken as free text, and it is bound by XML version and character encoding.
Subject could contain multiple properties, and
Object can be used as subject for further triples.
Datatypes can contain types from XML Schema.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Datatypes
[Link]
[Link]
[Link]
"2004-02-10"^^[Link]
"RDF Primer"^^[Link]/2001/XMLSchema#string
Outline Annon. SW stack IRI XML RDF RDFS OWL
Alternative representation #1
Outline Annon. SW stack IRI XML RDF RDFS OWL
Base namespace
Outline Annon. SW stack IRI XML RDF RDFS OWL
?
Outline Annon. SW stack IRI XML RDF RDFS OWL
Alternate
Motivation
We use RDF to represent facts:
These are known as terminological axioms (T-Box) or schema knowledge, and RDFS
provides a weaker schema language for modeling.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Representing things
A concept (a.k.a. class) represents a set of things. We use URIs to represent classes.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Vocabulary
Class membership:
book:uri rdf:type ex:TextBook.
An URI could have multiple memberships:
book:uri rdf:type ex:TextBook
book:uri rdf:type ex:MustRead
Classes have hierarchies (a.k.a. taxonomy): each text book is a book
ex:TextBook rdfs:subClassOf ex:Book
Evey class URI is a member of:
ex:TextBook rdf:type rdfs:Class
and,
rdfs:Class rdf:type rdfs:Class
Outline Annon. SW stack IRI XML RDF RDFS OWL
Vocabulary
rdfs:Resource : class of all resources
rdf:Property : class of all properties
rdf:XMLLiteral : we know this
rdfs:Literal : class of all literal values
rdfs:Datatype : class of all datatypes
rdf:Bag, rdf:Alt, rdf:Seq, rdf:List, rdf:nil, and rdfs:Container : for containers; open and
close
rdfs:ContainerMembershipProperty : class of constrained properties
rdfs:Statement : class of reified triples
Outline Annon. SW stack IRI XML RDF RDFS OWL
Property hierarchies
Property restrictions
We use restrictions to provide a certain restriction to URIs of subject and object.
This is done via rdfs:domain and rdfs:range.
Restriction problems
Reification
We want to say “The detective supposes that the butler killed the gardener”.
These are unsatisfactory:
: detective : supposes : id
: id rdf : subject : butler
: id rdf : predicate : hasKilled
: id rdf : object : gardener .
Outline Annon. SW stack IRI XML RDF RDFS OWL
Example
Outline Annon. SW stack IRI XML RDF RDFS OWL
Multiple views
Look at this statement Truck ⊑ MotorVehicle. When this statement travels up the Semantic
Stack, it will be subjected to three views:
XML structure
RDF graph (triple)
RDF Schema (semantic)
Outline Annon. SW stack IRI XML RDF RDFS OWL
Outline Annon. SW stack IRI XML RDF RDFS OWL
Assignment
Assignment #2 requires a substantial amount of reading, and modeling a simple ontology.
Please start this assignment early!
Reading
(Must read) Ch. 4 [HKR09].
Protégé
We use the Protégé ontology editor and knowledge acquisition system to demonstrate
important aspects of ontology modeling.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Motivation
How do we represent these sentences:
Every project has at least one participant.
Projects are always internal or external projects.
The superior of my superior is also my superior.
All examiners of an exam must be professors.
Human ⊑ ∃[Link]
Orphan ⊑ Human ⊓ ∀hasParent.¬Alive
Orphan(HarryPotter )
hasParent(HarryPotter , JamesPotter )
∀x, y (∃(hasParent(x, z) ∧ hasBrother (z, y )) ⇒ hasUncle(x, y ))
HappyFather ≡ ≥ [Link]
Car ⊑ =4hasTyre.⊤
PersonCommittingSuicide ≡ ∃[Link]
¬hasColleague(UbboVisser , NadalRafael)
We use OWL 2 Web Ontology Language.
OWL 2 is a W3C recommendation for modeling ontologies.
OWL Lite ⊆ OWL DL ⊆ OWL Full.
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
fully supported by most software tools
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
fully supported by most software tools
worst-case computational complexity: NExpTime
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
fully supported by most software tools
worst-case computational complexity: NExpTime
OWL Lite
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
fully supported by most software tools
worst-case computational complexity: NExpTime
OWL Lite
contained in OWL Full and OWL DL
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
fully supported by most software tools
worst-case computational complexity: NExpTime
OWL Lite
contained in OWL Full and OWL DL
decidable
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
fully supported by most software tools
worst-case computational complexity: NExpTime
OWL Lite
contained in OWL Full and OWL DL
decidable
less expressive
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL sublanguages
OWL Full
contains OWL DL and OWL Lite
only sublanguage containing all of RDFS
very expressive
semantically difficult to understand and to work with
undecidable
support by hardly any software tools
OWL DL
contains OWL Lite and is contained in OWL Full
decidable
fully supported by most software tools
worst-case computational complexity: NExpTime
OWL Lite
contained in OWL Full and OWL DL
decidable
less expressive
worst-case computational complexity: ExpTime
Outline Annon. SW stack IRI XML RDF RDFS OWL
Cardinality restrictions: at most, at least and exactly. Lets understand these constructs
using [Link]
Exam ⊑≤ 2hasExaminer .⊤
Exam ⊑≥ 3hasTopics.⊤
Exam ⊑ =3hasTopics.⊤
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL Species
OWL Full:
Unrestricted OWL 2 DL plus all of RDF(S).
There is no reasoner that supports the semantics of OWL Full.
Type separation is not enforced. i.e., OWL Full individuals, classes, and roles can be mixed
freely. e.g., individual in one statement becomes a role in next statement.
OWL DL:
Description logic version of OWL.
Model-theoretic semantics of SROIQ(D) is used, called OWL 2 Direct Semantics.
Reasoner support exists.
OWL Lite:
OWL Lite is essentially difficult to deal with as OWL DL. Therefore, this has minor role in
practice.
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL 2 Profiles
There are sublanguages of OWL 2, which have polynomial inference algorithms.
OWL 2 EL (OWL 2 EL++):
Polynomial time algorithms exist for satisfiability checking, classification, and instance
checking.
e.g., SNOMED CT
Allowed : ⊓ ∃ ⊤ ⊥ ⊑ ⊓ ∃ ⊤ ⊥, closed classes must have only one member, and
property chain axioms and range restrictions under certain conditions.
Disallowed : ¬ ⊔, arbitrary universal quantification, and role inverses.
e.g.,
Human ⊑ ∃[Link],
∃married.⊤ ⊓ CatholicPriest ⊑ ⊥,
hasParent ◦ hasParent ⊑ hasGrandparent.
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL 2 Profiles
OWL 2 QL (DL LiteR ):
Answer to: what fraction of OWL 2 DL can be captured by rational database systems?
Query answering in LOGSPACE w.r.t. data via translation into SQL.
Allowed:
Domain, range, and subproperties.
Subclass statements with:
Left hand side: class name or expression of type ∃R.⊤
Right hand side: intersection of class names, expression of types ∃R.C , and negation of left
hand expressions.
No closed classes.
e.g., ∃married.⊤ ⊑ ¬Free ⊓ ∃[Link]
OWL RL (DLP) :
Answer to: what fraction of OWL 2 DL can be expressed naively by rules?
Read section [Link] of [HKR09].
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
T-Box:
E.g.,
T-Box:
A-Box:
Wizard(HarryPotter )
Wizard(DracoMalfoy )
hasFriend(HarryPotter , RonWeasley )
hasFriend(HarryPotter , HermioneGranger )
hasPet(HarryPotter , Hedwig )
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
Is DracoMalfoy a friend of HarryPotter ?
Ontology: Don’t know (OWA), Database: No!
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
Is DracoMalfoy a friend of HarryPotter ?
Ontology: Don’t know (OWA), Database: No!
How many friends does HarryPotter have?
Ontology: At least 1 (NUNA), Database: 2!
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
Is DracoMalfoy a friend of HarryPotter ?
Ontology: Don’t know (OWA), Database: No!
How many friends does HarryPotter have?
Ontology: At least 1 (NUNA), Database: 2!
A-Box: Dis(RonWeasley , HermioneGranger )
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
Is DracoMalfoy a friend of HarryPotter ?
Ontology: Don’t know (OWA), Database: No!
How many friends does HarryPotter have?
Ontology: At least 1 (NUNA), Database: 2!
A-Box: Dis(RonWeasley , HermioneGranger )
How many friends does HarryPotter have?
Ontology: at least 2, Database: 2!
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
Is DracoMalfoy a friend of HarryPotter ?
Ontology: Don’t know (OWA), Database: No!
How many friends does HarryPotter have?
Ontology: At least 1 (NUNA), Database: 2!
A-Box: Dis(RonWeasley , HermioneGranger )
How many friends does HarryPotter have?
Ontology: at least 2, Database: 2!
T-Box :
HarryPottersFriends ≡ ∀hasFriend.{RonWeasley ⊔ HermioneGranger }
Wizard ⊓ HarryPottersFriends(HarryPotter )
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
Is DracoMalfoy a friend of HarryPotter ?
Ontology: Don’t know (OWA), Database: No!
How many friends does HarryPotter have?
Ontology: At least 1 (NUNA), Database: 2!
A-Box: Dis(RonWeasley , HermioneGranger )
How many friends does HarryPotter have?
Ontology: at least 2, Database: 2!
T-Box :
HarryPottersFriends ≡ ∀hasFriend.{RonWeasley ⊔ HermioneGranger }
Wizard ⊓ HarryPottersFriends(HarryPotter )
How many friends does HarryPotter have?
Ontology: 2!, Database: 2!
Outline Annon. SW stack IRI XML RDF RDFS OWL
E.g.,
If the domain or range axioms are used correctly, they provide powerful inferences:
T-Box says: ∃hasPet.⊤ ⊑ Human, Phoenix ⊑ ∀isPetOf .Wizard
A-Box:
Wizard(Dumbledore)
Phoenix(Fawkes)
isPetOf (Fawkes, Dumbledore)
Ontology infers that Human ⊓ Wizard(Dumbledore)
Database rejects, because domain of hasPet is Human, and Dumbledore is not Human
(CWA).
Ontologies use theorem proving to answer questions.
It involves both T-Box and A-Box, and has higher worst case complexities.
Outline Annon. SW stack IRI XML RDF RDFS OWL
OWL 2 features
OWL 2 features
Acknowledgement
Acknowledgement
The majority of the slides for this course have been prepared by Saminda Abeyruwan.
Outline Annon. SW stack IRI XML RDF RDFS OWL
Tim Berners-Lee.
Artificial Intelligence and the Semantic Web.
[Link] aaai- tbl/, 2006.
Ian Horrocks.
Description Logic: A formal foundation for languages and tools. Tutorial at the Semantic Technology Conference (SemTech). San Francisco, California, USA.
[Link] 2010.