You are on page 1of 47

SEMANTIC WEB TECHNOLOGIES

Instructor : Amna Basharat Haider


Lecture : 9&10
Date : 10th February, 2009
RDF SCHEMA

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

Basic Ideas of RDF Schema

• RDF is a universal language that lets users


describe resources in their own
vocabularies
▫ RDF does not assume, nor does it define
semantics of any
y particular
p application
pp domain
• The user can do so in RDF Schema using:
▫ Classes and Properties
▫ Class Hierarchies and Inheritance
▫ Property Hierarchies
Semantic Web Technologies

What is RDFS ?
• RDF Schema
▫ Defines vocabulary for RDF
▫ Organizes this vocabulary in a typed hierarchy
(Class, subClassOf, type, Property,
subPropertyOf)

• Rich, web-based publication format for


declaring semantics (XML for exchange)

• Capability to explicitly declare semantic


relations between vocabulary terms
Semantic Web Technologies

RDF Schema Vocabulary


• Vocabulary can be used to define other
vocabularies for your application
domain
Person
subClassOf
subClassOf

domain range
Student S Researcher

type type
Frank S Jeen
Semantic Web Technologies

RDF Schema

• Semantic network on the Web


• Nodes are identified by
y URIs
• rdfs:Class
• rdfs:Property
• rdfs:subClassOf
Semantic Web Technologies

RDF Schema syntax in XML


<rdf:Description ID="MotorVehicle">
<rdf:type
yp resource="http://www.w3.org/...#Class"/>
p g
<rdfs:subClassOf rdf:resource="http://www.w3.org/...#Resource"/>
</rdf:Description>

<rdf:Description ID="Truck">
<rdf:type
df t resource="http://www.w3.org/...#Class"/>
"htt // 3 / #Cl "/
<rdfs:subClassOf rdf:resource="#MotorVehicle"/>
</rdf:Description>

<rdf:Description ID="registeredTo">
ID= registeredTo >
<rdf:type resource="http://www.w3.org/...#Property"/>
<rdfs:domain rdf:resource="#MotorVehicle"/>
<rdfs:range rdf:resource="#Person"/>
</rdf:Description>

<rdf:Description ID=”ownedBy">
<rdf:type resource="http://www.w3.org/...#Property"/>
p y rdf:resource="#registeredTo"/>
<rdfs:subPropertyOf g
</rdf:Description>
Semantic Web Technologies

Classes and their Instances


• We must distinguish between
▫ Concrete “things” (individual objects) in the
domain: Discrete Maths, David Billington etc.

▫ Sets of individuals sharing properties called


classes: lecturers, students, courses etc.

• Individual objects that belong to a class


are referred to as instances of that class

• The relationshipp between instances and


classes in RDF is through rdf:type
Semantic Web Technologies

Why Classes are Useful?

• Impose restrictions on what can be stated


in an RDF document using the schema

▫ As in programming languages
▫ E g A+1,
E.g. A+1 where A is an array
▫ Disallow nonsense from being stated
Semantic Web Technologies

Nonsensical Statements disallowed through the Use of


Classes
Cl

• Discrete Maths is taught by Concrete Maths


▫ We want courses to be taught by lecturers only
▫ Restriction on values of the p
property
p y “is taught
g
by” (range restriction)

• Room MZH5760 iis ttaught


R ht b
by D
David
id
Billington
▫ Only courses can be taught
▫ This imposes a restriction on the objects to
which the property can be applied (domain
restriction)
Semantic Web Technologies

Class Hierarchies

• Classes can be organised in hierarchies


▫ A is a subclass of B if every instance of A is also
an instance of B
▫ Then B is a superclass of A

• A subclass graph need not be a tree

• A class may have multiple superclasses


Semantic Web Technologies

Class Hierarchy Example


Semantic Web Technologies

Inheritance in Class Hierarchies


• Range restriction: Courses must be taught by academic
staff members only

• Michael Maher is a professor

• He inherits the ability to teach from the class of


academic staff members

• This is done in RDF Schema by fixing the semantics of “is


a subclass of”
▫ It is not up to an application (RDF processing software) to
interpret “is a subclass of

• Properties are not encapsulated but defined globally


Semantic Web Technologies

Property Hierarchies
• Hierarchical relationships for properties
▫ E.g., “is
E “i ttaught
ht bby”
” iis a subproperty
b t off
“involves”
▫ If a course C is taught by an academic staff
member A, then C also involves Α

• The converse is not necessarily true


▫ E.g., A may be the teacher of the course C, or
▫ a tutor who marks student homework but does
not teach C

• P is a subproperty
p p y of Q,, if Q(x,y)
( ,y) is true
whenever P(x,y) is true
Semantic Web Technologies

RDF Layer vs RDF Schema Layer

• Discrete Mathematics is taught by David


Billington

• The schema is itself written in a formal


language,
g g , RDF Schema,, that can express
p
its ingredients:
▫ subClassOf, Class, Property, subPropertyOf,
Resource, etc.
Semantic Web Technologies

RDF Layer vs RDF Schema Layer (2)


ΤHE LANGUAGE OF RDF SCHEMA
Semantic Web Technologies

RDF Schema in RDF


• The modeling primitives of RDF Schema
are defined using resources and properties
(RDF itself is used!)

• To declare that “lecturer” is a subclass of


“academic staff member”
▫ Define
D fi resources lecturer,
l t
academicStaffMember, and subClassOf
▫ define property subClassOf
▫ Write triple
(subClassOf,lecturer,academicStaffMember)

• We use the XML-based syntax of RDF


Semantic Web Technologies

Core Classes

• rdfs:Resource the class of all resources


rdfs:Resource,

• rdfs:Class, the class of all classes

• rdfs:Literal, the class of all literals (strings)

• rdf:Property, the class of all properties

• rdf:Statement,
df St t t th
the class
l off all
ll reified
ifi d
statements
Semantic Web Technologies

Core Properties
• rdf:type, which relates a resource to its
class
▫ The resource is declared to be an instance of
that class

• rdfs:subClassOf,, which relates a class to


one of its superclasses
▫ All instances of a class are instances of its
superclass

• rdfs:subPropertyOf, relates a property to


one off iits superproperties
i
Semantic Web Technologies

Core Properties (2)


• rdfs:domain, which specifies the domain
off a property
t P
▫ The class of those resources that may appear
as subjects in a triple with predicate P
▫ If the domain is not specified, then any
resource can be the subject

• rdfs:range, which specifies the range of a


property P
▫ The class
Th l off those
h resources that
h may appear
as values in a triple with predicate P
Semantic Web Technologies

Examples

<rdfs:Class rdf:about="#lecturer">
<rdfs:subClassOf rdf:resource="#staffMember"/>
</rdfs:Class>
<rdf:Property rdf:ID="phone">
<rdfs:domain rdf:resource="#staffMember"/>
rdf:resource= #staffMember />
<rdfs:range rdf:resource="http://www.w3.org/
2000/01/rdf-schema#Literal"/>
</rdf:Property>
Semantic Web Technologies

Subclass Hierarchy
y of some Modelling
g primitives
p of RDFS

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

Instance Relationships
p of some Modelling
gpprimitives of RDFS

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

Relationships
p Between Core Classes and Properties
p
• rdfs:subClassOf and rdfs:subPropertyOf are
transitive by definition
transitive,

• rdfs:Class is a subclass of rdfs:Resource


▫ Because every class is a resource

• rdfs:Resource is an instance of rdfs:Class


▫ rdfs:Resource is the class of all resources, so it is a
class

• Every class is an instance of rdfs:Class


▫ For the same reason
Semantic Web Technologies

Reification and Containers


• rdf:subject, relates a reified statement to its subject

• rdf:predicate, relates a reified statement to its predicate

• rdf:object relates a reified statement to its object


rdf:object,

• rdf:Bag, the class of bags

• rdf:Seq, the class of sequences

• rdf:Alt,, the class of alternatives

• rdfs:Container, which is a superclass of all container classes,


including the three above
Semantic Web Technologies

Utility Properties
• rdfs:seeAlso relates a resource to another resource
that explains
p it

• rdfs:isDefinedBy is a subproperty of rdfs:seeAlso


and relates a resource to the place where its
definition, typically an RDF schema, is found

• rfds:comment. Comments,
rfds:comment Comments typically longer text
text, can
be associated with a resource

• rdfs:label.
df l b l A human-friendly
h f i dl label
l b l (name)
( ) is
i
associated with a resource
SUMMARY

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

RDF Classes
Class name comment
rdfs:Resource The class resource, everything.

rdfs:Literal The class of literal values, e.g. textual strings and integers.

rdf:XMLLiteral The class of XML literals values.


rdfs:Class The class of classes.
rdf:Property The class of RDF properties.
rdfs:Datatype The class of RDF datatypes.
rdf:Statement The class of RDF statements.

rdf:Bag The class of unordered containers.

rdf:Seq The class of ordered containers.

rdf:Alt The class of containers of alternatives.


alternatives
rdfs:Container The class of RDF containers.
rdfs:ContainerMembershipProper The class of container membership properties, rdf:_1, rdf:_2, ..., all of
ty which are sub-properties of 'member'.
rdf:List The class of RDF Lists.

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

RDF Properties (1)

Property name comment domain range


The subject is an instance
rdf:type rdfs:Resource rdfs:Class
of a class.
The subject is a subclass
rdfs:subClassOf rdfs:Class rdfs:Class
off a class.
l
The subject is a
rdfs:subPropertyOf rdf:Property rdf:Property
subproperty of a property.
A domain of the subject
rdfs:domain rdf:Property rdfs:Class
property
property.
A range of the subject
rdfs:range rdf:Property rdfs:Class
property.
A human-readable name
rdfs:label rdfs:Resource rdfs:Literal
for the subject.
A description of the
rdfs:comment rdfs:Resource rdfs:Literal
subject resource.

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

RDF Properties (2)


Property name comment domain range
A member of the subject
rdfs:member rdfs:Resource rdfs:Resource
resource.
The first item in the
rdf:first rdf:List rdfs:Resource
subject RDF list.
The rest of the subject
rdf:rest RDF list after the first rdf:List rdf:List
item.
Further information about
rdfs:seeAlso rdfs:Resource rdfs:Resource
the subject resource.
The definition of the
rdfs:isDefinedBy rdfs:Resource rdfs:Resource
subject resource.
Idiomatic property used
for structured values (see
rdf:value rdfs:Resource rdfs:Resource
the RDF Primer for an
example of its usage).
The subject of the subject
rdf:subject rdf:Statement rdfs:Resource
RDF statement.
The predicate of the
rdf:predicate rdf:Statement rdfs:Resource
subject
bj t RDF statement.
t t t
The object of the subject
rdf:object rdf:Statement rdfs:Resource
RDF statement.
FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider
EXAMPLE : UNIVERSITY

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

Example: A University
<rdfs:Class rdf:ID="lecturer">
<rdfs:comment>
rdfs:comment
The class of lecturers. All lecturers are
academic staff members.
</rdfs:comment>
<rdfs:subClassOf
rdf:resource="#academicStaffMember"/>
</rdfs:Class>
/ df Cl
Semantic Web Technologies

Example: A University (2)


<rdfs:Class rdf:ID="course">
<rdfs:comment>The class of courses</rdfs:comment>
</rdfs:Class>

<rdf:Property rdf:ID="isTaughtBy">
<rdfs:comment>
df
Inherits its domain ("course") and range ("lecturer")
from its superproperty "involves"
</rdfs:comment>
<rdfs:subPropertyOf rdf:resource="#involves"/>
</rdf:Property>
Semantic Web Technologies

Example: A University (3)


<rdf:Property rdf:ID="phone">
<rdfs:comment>
It is a property of staff members
and takes literals as values.
</rdfs:comment>
<rdfs:domain rdf:resource="#staffMember"/>
<rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-
schema#Literal"/>
</rdf:Property>
RDF SCHEMA
Class Hierarchy Example!

FAST-NU, Islamabad Fall 2008 - Lecture 1 Instructor: Amna Basharat Haider


Semantic Web Technologies

Class Hierarchy
y for the Motor Vehicles Example
p


Semantic Web Technologies

Class Hierarchy of the RDFS


Class hierarchy is shown
using a "nodes and arcs"
graph representation of
the RDF data model. If
one class
l is
i a subset
b t off
another, then there is an
rdfs:subClassOf arc from
the node representing
p g the
first class to the node
representing the second.

If a resource is an instance of a class, then there is an rdf:type


arc from
f th resource tto th
the the node
d representing
ti th
the class.
l
Semantic Web Technologies

Example (1)

Example expresses the following class hierarchy. We first define a class


MotorVehicle. We then define three subclasses of MotorVehicle, namely
PassengerVehicle Truck and Van.
PassengerVehicle, Van We then define a class Minivan which is a
subclass of both Van and PassengerVehicle.
Semantic Web Technologies

Example (2)

<rdf:RDF xml:lang="en"
xmlns:rdf="http://www
xmlns:rdf= http://www.w3.org/1999/02/22-rdf-syntax-ns#
w3 org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<!-- Note: this RDF schema would typically be used in RDF instance data by
referencing it with an XML namespace declaration, for example
xmlns:xyz="http://www.w3.org/2000/03/example/vehicles#". This allows us to
use abbreviations such as xyz:MotorVehicle to refer unambiguously to the RDF
class 'MotorVehicle'. -->
<rdf:Description ID="MotorVehicle">
<rdf:type resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf
rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
</rdf:Description>
...
Semantic Web Technologies

Example (3)

<rdf:Description ID="PassengerVehicle">
<rdf:type resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
< df
<rdfs:subClassOf
bCl Of rdf:resource="#MotorVehicle"/>
df "#M t V hi l "/>
</rdf:Description>

<rdf:Description
p ID="Truck">
<rdf:type resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf rdf:resource="#MotorVehicle"/>
</rdf:Description>

...
Semantic Web Technologies

Example (4)


<rdf:Description ID="Van">
<rdf:type resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf rdf:resource="#MotorVehicle"/>
</rdf:Description>
<rdf:Description ID="MiniVan">
<rdf:type resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf rdf:resource="#Van"/>
<rdfs:subClassOf rdf:resource="#PassengerVehicle"/>
</rdf:Description>
</rdf:RDF>
DUBLIN CORE
Semantic Web Technologies

Dublin Core
• A set of fifteen basic properties for describing
generalised Web resources
• ISO Standard 15836-2003 (February 2003):
http://www niso org/international/SC4/n515
http://www.niso.org/international/SC4/n515.
pdf

The Dublin Core Metadata Initiative is an open forum engaged in the development of
interoperable online metadata standards that support a broad range of purposes and business
models.

http://dublincore.org/
Semantic Web Technologies

Dublin Core (15 basic properties):


• Title • Type
• Creator • Format
• Subject • Identifier
• Description • Source
• Publisher
• Language
• Contributor
• Relation
• Date
• C
Coverage
• Rights
Semantic Web Technologies

Dublin Core Example


<?xml version="1.0"?>
<rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns:dc="http://purl org/dc/elements/1 0/">
xmlns:dc="http://purl.org/dc/elements/1.0/">
<rdf:Description rdf:about="http://www.ukoln.ac.uk/metadata/resources/dc/
datamodel/WD-dc-rdf/">
<dc:title> Guidance on expressing the Dublin Core within the Resource
D
Description
i i Framework
F k (RDF) </dc:title>
/d i l
<dc:creator> Eric Miller </dc:creator>
<dc:creator> Paul Miller </dc:creator>
<dc:creator> Dan Brickley </dc:creator>
<dc:subject> Dublin Core; Resource Description Framework; RDF; eXtensible
Markup Language; XML </dc:subject>
<dc:publisher> Dublin Core Metadata Initiative </dc:publisher>
<dc:contributor> Dublin Core Data Model Working Group </dc:contributor>
<dc:date> 1999-07-01 </dc:date>
<dc:format> text/html </dc:format>
<dc:language> en </dc:language>
</rdf:Description>
</rdf:RDF>
Semantic Web Technologies

Where to look next?

• RDF:
http://www.w3.org/RDF/
• RDF Schema:
http://www.w3.org/TR/rdf-schema/

You might also like