Ontologies and Schema Languages on the Web.pdf

Ontologies and Schema
Languages on the Web
Kaveh Shahbaz
83700805
[email protected]
Outline





Abstract Introduction of ontologies and schemas
and relations
XML schema and ontology Language
RDF schema and ontology Language
Specific ontology language : OIL
Comparison between XML Schema, RDFS, OIL
Ontology in philosophy
Semantics, the meaning of meaning
 Philosophical discipline, branch of philosophy that deals with the
nature and the organization of reality
 Science of Being


Tries to answer the question


What is being?
What are the features common to all being?
Ontology in computer science

Tom Gruber :



Is a specification of conceptualization.
Is a description of the concepts and relationships that can exist for an
agent or a community of agents.
Nicola Guarino

In AI, an Ontology refers to an engineering artifacts, constituted by a
specific vocabulary used to describe a certain reality, plus a set of
explicit assumptions regarding the intended meaning of the
vocabulary words.
Ontology components

Concepts


Properties


Cardinality is at least 1
Axioms


Length, Age
Constraints


Cat, Dog
Cows are larger than dogs
Relationships

Is a, Part of
Ontology, Taxonomy, knowledge base
Ontology Example
Schema
In Particular, Those for databases, have been developed in computer
science to describe the structure and semantics of data.
 A well-known example : a relational database schema
 But it is so rigid
 Therefore, new schema languages have arisen that better fit the needs of
richer data models: XML Schema

Ontologies and the SW Languages

Most Semantic Web languages are designed explicitly for
representing ontologies





RDF Schema
DAML+OIL
SHOE
XOL
XML Schema
Ontology Languages
SW Languages

The languages differ in their

syntax


terminology




Class-concept
Instance-object
Slot-property
expressivity


We are not concerned with it here – An ontology is a conceptual
representation
What we can express in some languages, we cannot express in others
semantics

The same statements may mean different things in different
languages
)DTD )Data Type Definition
The purpose of a Document Type Definition is to define the legal building
blocks of an XML document. It defines the document structure with a list
of legal elements.
 With a DTD, independent groups of people can agree to use a common
DTD for interchanging data.
 A DTD can be declared inline in your XML document, or as an external
reference.


Internal DOCTYPE declaration
External DOCTYPE declaration
 <!DOCTYPE note SYSTEM "note.dtd">

DTD
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to
(#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>
XML Schema




XML Schema is an XML based alternative to DTD.
An XML schema describes the structure of an XML
document.
The XML Schema language is also referred to as XML
Schema Definition (XSD).
The purpose of an XML Schema is to define the legal
building blocks of an XML document, just like a DTD.
XML Schema








defines elements that can appear in a document
defines attributes that can appear in a document
defines which elements are child elements
defines the order of child elements
defines the number of child elements
defines whether an element is empty or can include text
defines data types for elements and attributes
defines default and fixed values for elements and
attributes
XML Schema

XML Schemas are the Successors of DTDs because:






XML
XML
XML
XML
XML
Schemas
Schemas
Schemas
Schemas
Schemas
are extensible to future additions
are richer and more useful than DTDs
are written in XML
support data types
support namespaces
XML Schema is a W3C Recommendation

XML Schema was originally proposed by Microsoft, but became an
official W3C recommendation in May 2001.
XML Schema

One of the greatest strengths of XML Schemas is the support for
data types.With the support for data types:







It
It
It
It
It
It
is easier to describe permissible document content
is easier to validate the correctness of data
is easier to work with data from a database
is easier to define data facets (restrictions on data)
is easier to define data patterns (data formats)
is easier to convert data between different data types
XML Schemas use XML Syntax





You don't have to learn another language
You can use your XML editor to edit your Schema files
You can use your XML parser to parse your Schema files
You can manipulate your Schema with the XML DOM
You can transform your Schema with XSLT
XML Schema


XML Schemas are Extensible
Well-Formed is not Enough









must begin with the XML declaration
must have one unique root element
all start tags must match end-tags
XML tags are case sensitive
all elements must be closed
all elements must be properly nested
all attribute values must be quoted
XML entities must be used for special characters
Even if documents are Well-Formed they can still contain
errors, and those errors can have serious consequences.
Think of this situation: you order 5 gross of laser printers,
instead of 5 laser printers. With XML Schemas, most of
these errors can be caught by your validating software.
XML Schema


XML documents can have a reference to a DTD or an XML
Schema
A Simple XML Schema

This is a simple XML Schema file called "note.xsd" that defines
the elements of the XML document
("note.xml"):
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XML Schema
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3schools.com">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
A Reference to an XML Schema
<?xml version="1.0"?><note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XSD Simple Elements




XML Schemas define the elements of your XML files.
A simple element is an XML element that can contain only
text. It cannot contain any other elements or attributes.
A simple element is an XML element that can contain only
text. It cannot contain any other elements or attributes.
The syntax for defining a simple element is:
<xs:element name="xxx" type="yyy"/>
<lastname>Refsnes</lastname>
<age>34</age>
<dateborn>1968-03-27</dateborn>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="age" type="xs:integer"/>
<xs:element name="dateborn" type="xs:date"/>
Common XML Schema Data Types

XML Schema has a lot of built-in data types. Here is a list
of the most common types:
 xs:string
 xs:decimal
 xs:integer
 xs:boolean
 xs:date
 xs:time
Declare Default and Fixed Values for
Simple Elements

A default value is automatically assigned to the element
when no other value is specified. In the following
example the default value is "red":
<xs:element name="color" type="xs:string" default="red"/>

A fixed value is also automatically assigned to the
element. You cannot specify another value. In the
following example the fixed value is "red":
<xs:element name="color" type="xs:string" fixed="red"/>
XSD Attributes


All attributes are declared as simple types.
Only complex elements can have attributes!
<lastname lang="EN">Smith</lastname>
<xs:attribute name="lang" type="xs:string"/>


Declare Default and Fixed Values for Attributes
Creating Optional and Required Attributes
<xs:attribute name="lang" type="xs:string"
use="optional"/>
XSD Restrictions/Facets
Restrictions are used to control acceptable values for XML
elements or attributes. Restrictions on XML elements are
called facets.
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

XSD Complex Elements



What is a Complex Element?
A complex element is an XML element that contains other
elements and/or attributes.
There are four kinds of complex elements:




empty elements
elements that contain only other elements
elements that contain only text
elements that contain both other elements and text
Examples of Complex XML Elements




<product pid="1345"/>
<employee> <firstname>John</firstname>
<lastname>Smith</lastname> </employee>
<food type="dessert">Ice cream</food>
<description> It happened on <date
lang="norwegian">03.03.99</date> .... </description>
How to Define a Complex Element


<employee> <firstname>John</firstname>
<lastname>Smith</lastname> </employee>
<xs:element name="employee"> <xs:complexType>
<xs:sequence> <xs:element name="firstname"
type="xs:string"/> <xs:element name="lastname"
type="xs:string"/> </xs:sequence> </xs:complexType>
</xs:element>
RDF


The Resource Description Framework (RDF) is a W3C
standard for describing Web resources, such as the
title, author, modification date, content, and copyright
information of a Web page.
RDF - Examples of Use






Describing properties for shopping items, such as price and
availability
Describing time schedules for web events
Describing information about web pages, such as content, author,
created and modified date
Describing content and rating for web pictures
Describing content for search engines
Describing electronic libraries
RDF Rules


RDF uses Web identifiers (URIs) to identify resources.
RDF describes resources with properties and property
values.



Resource is anything that can have a URI, such as
"http://www.w3schools.com/RDF"
A Property is a Resource that has a name, such as "author" or
"homepage"
A Property value is the value of a Property, such as "Jan Egil
Refsnes" or "http://www.w3schools.com" (note that a property value
can be another resource)
RDF Statements


The combination of a Resource, a Property, and a
Property value forms a Statement (known as the subject,
predicate and object of a Statement).
Statement: "The author of
http://www.w3schools.com/RDF is Jan Egil Refsnes".



The subject of the statement above is:
http://www.w3schools.com/RDF
The predicate is: author
The object is: Jan Egil Refsnes
RDF Basics
Motivation: Provide a standard for meta-data and for descriptions about
resources on the web
 Basics: subject S has a property P with value V (object)

hasPrice
http://books.org/ISBN123
Subject
Property
$50
Value
RDF Example
Dr. Hammer
XML for Dummies
s:hasTitle
s:hasName
s:authorOf
http://employee.org/id337
s:hasPrice
http://books.org/ISBN123
$50
RDF Example
Title
Artist
Country
Company
Price
Year
Empire
Burlesque
Bob
Dylan
USA
Columbia
10.90
1985
RDF Example
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Empire
Burlesque">
<cd:artist>Bob Dylan</cd:artist>
<cd:country>USA</cd:country>
<cd:company>Columbia</cd:company>
<cd:price>10.90</cd:price>
<cd:year>1985</cd:year>
</rdf:Description>
RDF main Elements


The main elements of RDF are the root element, <RDF>,
and the <Description> element, which identifies a
resource.
RDF Container Elements :



The <rdf:Bag> Element .
The <rdf:Seq> Element
The <rdf:Alt> Element
Rdf containers



Bag: (A resource having type rdf:Bag)
 Represents an unordered list of resources or literals
 Duplicated values are prermitted
Sequence: (A resource having type rdf:Seq)
 Represents ordered list of resources or literal
 Duplicated values are permitted
Alternatives: (A resource having type rdf:Alt)
 Represents group of resources or literals that are alternatives
Linking Statements


The subject of one statement can be the object of
another
Such collections of statements form a directed,
labeled graph
Knuth
hasColleague
hasColleague
Carole

STU
hasHomePage
http://www.stanford.edu
Note that the object of a triple can also be a
“literal” (a string)
How can RDF be implemented


Usally RDF/XML syntax
However other notations are possible

e.g. Notation3
<http://xyz.org/#Sean> <http://xyz.org/#name> "Sean"
<http://xyz.org/#a> <http://xyz.org/#b> <http://xyz.org/#c>
RDF Syntax




RDF has an XML syntax that has a specific meaning:
Every Description element describes a resource
Every attribute or nested element inside a Description is a
property of that Resource
We can refer to resources by using URIs
<Description about="some.uri/person/knuth">
<hasColleague resource="some.uri/STU/Math"/>
</Description>
<Description about="some.uri/STU/Math">
<hasHomePage>http://www.stanford.edu/~Math</hasHomePage>
</Description>
<Description about="some.uri/person/carole">
<hasColleague resource="some.uri/STU/Math"/>
</Description>
Rdf type



RDF predifined property
Its value – a resource that represent a category or class
Its subject – Instance of that category or class
prefix ex:, URI: http://www.example.org/terms
Bag example
RDF and RDFS

RDF is graphical formalism ( + XML syntax +
semantics)



for representing metadata
for describing the semantics of information in a machineaccessible way
RDFS extends RDF with “schema vocabulary”, e.g.:



Class, Property
type, subClassOf, subPropertyOf
range, domain
)RDF Schema )RDFS




RDF data model does not define relationships between
properties and resources but is provided by RDF Schema.
RDFS offers primitives for defining knowledge models.
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
RDF Schema allows you to define vocabulary terms and the
relations between those terms

it gives “extra meaning” to particular RDF predicates and
resources

this “extra meaning”, or semantics, specifies how a term should
be interpreted
RDF and RDFS Properties
Property name
Comment
domain
range
rdfs:isDefinedBy
Indicates the namespace of a resource
Resource
Resource
rdf:subject
The subject of an RDF statement.
Statement
Resource
rdf:predicate
the predicate of an RDF statement.
Statement
Property
rdf:object
The object of an RDF statement.
Statement
Not specified
rdf:type
Indicates membership of a class
Resource
Class
rdfs:member
a member of a container
Container
Not specified
rdfs:subClassOf
Indicates membership of a class
Class
Class
rdf:value
Identifies the principal value (usually a string) of a property when the property
value is a structured resource
Resource
Not specified
rdfs:subPropertyOf
Indicates specialization of properties
Property
Property
rdfs:comment
Use this for descriptions
Resource
Literal
rdfs:label
Provides a human-readable version of a resource name.
Resource
Literal
rdfs:domain
A domain class for a property type
Property
Class
rdfs:range
A range class for a property type
Property
Class
rdfs:seeAlso
A resource that provides information about the subject resource
Resource
Resource
RDFS Examples

RDF Schema terms (just a few examples):







Class
Property
type
subClassOf
range
domain
These terms are the RDF Schema building blocks
(constructors) used to create vocabularies:
<Person,type,Class>
<hasColleague,type,Property>
<Professor,subClassOf,Person>
<Carole,type,Professor>
<hasColleague,range,Person>
<hasColleague,domain,Person>
RDFS is about creating taxonomies
Problems with RDFS

RDFS too weak to describe resources in sufficient
detail

No localised range and domain constraints


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 the range of hasChild is person when applied to
persons and elephant when applied to elephants
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
)OIL )Ontology Inference Layer








European research community activities resulted in OIL (
http://img.cs.man.ac.uk/oil)
OILEd is a tool developed to ease creation of OIL
ontologies
It is a frame-based language with well defined semantics
in DL
Serialization to RDF is specified
As other frame based systems, concepts are represented
as Frames whose main components consists of a list of
super classes (more general concepts) and a list of
slot/filler pairs.
A frame corresponds to a Concept in DL
A slot corresponds to a role in a DL
A slot/filler pair corresponds to either a value restriction
or an existential quantification
OIL

Arbitrary class expressions can be formed, and used
anywhere that a class name can be used. In
particular, class expressions can be used as slot
fillers, whereas in typical frame languages slot fillers
are restricted to being class (or individual) names.

A slot-filler pair can itself be treated as a class: it can
be used anywhere that a class name can be used, and
can be combined with other classes in class
expressions.

Class definitions (frames) have an (optional)
additional field that specifies whether the class
definition is primitive (a subsumption axiom) or nonprimitive (an equiv-alence axiom). If omitted, this
defaults to primitive.
Three roots of OIL
An example OIL ontology
).An example OIL ontology )cont
OIL Syntax and Semantics

Class definitions

Examples
).OIL Syntax and Semantics )cont

Slot constraint

Examples
).OIL Syntax and Semantics )cont

Slot definitions

Examples
OIL to XML Schema

Translating OIL specifications into an XML Schema
definition






First, materialize the hierarchy.
Second, create a complexType definition for each slot
definition in OIL.
Third, also create a complexType definition for each class
definition in OIL.
Fourth, create an element definition for each slot and class.
Fifth, define a grammar for each entity, associate basic
Datatypes with built-in datatypes if desired, add lexical
constraints on datatypes if desired
Sixth, replace the module concept of OIL with the namespace
and inclusion concept of XML Schema.
.Materializing the hierarchy
animal
carnivore <= animal
herbivore <= animal
lion <= carnivore, animal
giraffe <= herbivore, animal
plant <= plant-or-is-part-of(plant)
tree <= plant <= plant-or-is-part-of(plant)
tasty-plant <= plant <= plant-or-is-part-of(plant)
[,,,]
eats <= slot
is-eaten-by <= slot
has-part <= slot
is-part-of <= slot
.Type definitions for slots
<complexType name="slotType"/>
<complexType name="eatsType" base="slotType" derivedBy="extension"/>
<complexType name="is-eaten-byType" base="slotType" derivedBy="extension"/>
<complexType name="carnivore-eatsType" base="eatsType"
derivedBy="extension">
<element name="domain" minOccurs="0">
<complexType>
<element ref="animal" />
</complexType>
</element>
<element name="range" minOccurs="0">
<complexType>
<element ref="animal" />
</complexType>
</element>
</complexType>
.Type definitions for a classes
<complexType name="carnivoreType" base="animalType" derivedBy="extension" content="mixed">
<element name="eats" minOccurs="0">
<complexType base="eatsType" derivedBy="extension">
<element ref="animal" />
</complexType>
</element>
</complexType>
<complexType name="herbivoreType" base="animalType" derivedBy="extension" content="mixed">
<element name="eats" minOccurs="0">
<complexType base="eatsType" derivedBy="extension">
<element ref="plant-or-is-part-of(plant)" />
</complexType>
</element>
</complexType>
<complexType name="giraffeType" base="herbivoreType" derivedBy="restriction" content="mixed">
<element name="eats" minOccurs="0">
<complexType base="eatsType" derivedBy="extension">
<element ref="leaf" />
</complexType>
</element>
</complexType>
Element definitions for classes and slots
<element name="carnivore" type="carnivoreType"/>
<element name="herbivore" type="herbivoreType"/>
<element name="eats" type="eatsType"/>
<element name="giraffe" type="giraffeType"/>
<element name="leaf" type="leafType"/>
Results for concepts
Results for Taxonomies
Results for Relations and Functions
Results for Axioms
Results for Instances
Comparison-Language to Language

XML vs RDF.



XMLs vs RDFs.



RDF is an application of XML.
RDF has fixed set of primitives plus standard way to represent
metadata while XML use results in different syntaxes.
RDFs allows basic definition of ontologies while XMLs does
not, plus information on interpretation statements.
XMLs prescribes order and combination of tags.
XMLs vs OIL.


Main common goal to provide vocabulary and structure for
exchanging information sources.
OIL much richer modeling primitives (slots + classes). XMLs
richer built in data types and grammar for structuring the
content of elements
Comparison-Language to Language

RDFs vs OIL.


RDFs can be used as representation format of OIL.
OIL uses RDFs primitives.
Valid OIL document is a valid RDFs document
Strength and Weakness

RDF(s).







Definition of mapping rules
Weak reasoning capabilities only suitable for constraint checking
Limited expressive power
Many tools and examples available
Support for different natural languages
Community is active developing and improving
OIL.





Much richer expressive power than RDF(s)
Good reasoning, atomic consistency checking, cross linking of
relations and implied relations checking
Support for different natural languages
Vast amount of documentation, tools and examples available
Good compatibility, design based on DL, FL and Web Standards
(RDFs and XML)