A Discussion of Some Intuitions of Defeasible Reasoning

Download Report

Transcript A Discussion of Some Intuitions of Defeasible Reasoning

Chapter 2
Describing Web Resources: RDF
Grigoris Antoniou
Paul Groth
Frank van Harmelen
Rinke Hoekstra
1
A Semantic Web Primer
Lecture Outline
2
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
Introduction
3

The success of the Web has shown the power of having
standard mechanisms to exchange and communicate
information
– HTML is the standard language for writing Web pages
– It allows anyone to publish a document

HTML and any exchange language should have three
components: a syntax(语法), a data model(数据模型),
and a semantics(语义)
– The syntax tells us how to write data down
–
The data model tells us the structure/organization of the
data
–
The semantics tells us how to interpret that data
Chapter 2
A Semantic Web Primer
A Snippet of HTML
<html>
<head>
<title>Apartments for Rent</title>
</head>
<body>
<ol>
<li>Studio apartment on Florida Ave
<li>3 bedroom Apartment on Baron Way
</ol>
<body>
</html>
4
Chapter 2
A Semantic Web Primer
Syntax, Data Model, and Semantics of
HTML
5

The syntax of HTML is text with tags written using
angle brackets

The data model of HTML is known as the Document
Object Model (DOM), and defines the organization of
these elements defined by tags into a hierarchical tree
structure

The semantics of HTML tell us how the browser
should interpret the Web page

All are defined within HTML standards
Chapter 2
A Semantic Web Primer
What does the Semantic Web need?

HTML was designed to communicate information
about the structure of documents for human readers

The Semantic Web needs a data model that
–
–
6
can be used by multiple applications
needs to be domain-independent

The Semantic Web needs a mechanism to assign
semantics to the information represented in this data
model

The Semantic Web needs a syntax
Chapter 2
A Semantic Web Primer
Resource Description Framework (RDF)

The basic building block of RDF is an entityproperty-value(实体-属性-值) triple, called a
statement(陈述)
–
7
Examples include “The Baron Way Apartment is an Apartment”,
and “The Baron Way Apartment is part of the Baron Way Building”

RDF is domain independent so it is necessary for
users to define the terminology they use in these
statement

This is where the RDF Schema (RDFS) comes in—it
allows users to precisely define how their vocabulary
should be interpreted
Chapter 2
A Semantic Web Primer
A Standard Language for Exchanging
Data


8
Together, these technologies define the components
of a standard language for exchanging arbitrary data
between machines:
–
Turtle/RDFa/RDF-XML – the syntax
–
RDF – the data model
–
RDFS – the semantics
Note that RDF is primarily the data model within this
language, it is often used as the name for the whole
of it
Chapter 2
A Semantic Web Primer
Lecture Outline
9
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
Resources

The fundamental concepts of RDF are resources
(资源), properties (属性), statements (陈述),
and graphs (图)

We can think of a resource as an object, a “thing” we
want to talk about
–

Every resource has a URI, a Uniform Resource
Identifier and a URI can be
–
10
E.g. authors, books, publishers, places, people, hotels, etc.
–
a URL (Uniform Resource Locator, or Web address) or
another kind of unique identifier
Chapter 2
A Semantic Web Primer
URI Schemes

URI schemes have been defined not only for Web
locations, but also for other unique identifiers
–
11
e.g. ISBN numbers, telephone numbers, and geographical
locations

It provides a mechanism to unambiguously identify
the “thing” we want to talk about, solving the
homonym (一词多义) problem

Using dereferencable (解引用的)URIs for
resource identifiers is considered good practice,
enabling the retrieval of a resource itself or a further
description of that resource
Chapter 2
A Semantic Web Primer
Dereferencable URI – definition from
Wikipedia




12
A dereferencable URI is a resource retrieval mechanism that
uses any of the internet protocols (e.g. HTTP) to obtain a copy or
representation of the resource it identifies.
In the context of traditional HTML web pages, a URI refers to the
page, and when requested the web server returns a copy of it.
In other non-dereferencable contexts, such as XML Schema, the
namespace identifier is still a URI, but this is simply an identifier
(i.e. a namespace name). There is no intention that this can or
should be dereferenced.
In the case of Linked Data, the representation takes the form of a
document (typically HTML or XML) that describes the resource
that the URI identifies. In either case, the mechanism makes it
possible for a user (or software agent) to "follow your nose" to find
out more information related to the identified resource.
Chapter 2
A Semantic Web Primer
Properties
13

Properties are a special kind of resources

They describe relations between resources
– e.g. “written by”, “age”, “title”, etc.

Properties are also identified by URIs

We can dereference property URIs to find their
descriptions
Chapter 2
A Semantic Web Primer
Statements

Statements assert the properties of resources

A statement is an entity-attribute-value triple (we
often use the word subject to refer to the entity and
object to refer to its value)
–

Values can be resources or literals (文字)
–
14
It consists of a resource, a property, and a value
Literals are atomic values (strings, numbers, or
dates)
Chapter 2
A Semantic Web Primer
An Example RDF Statement
“Baron Way Building is located in Amsterdam.”
We can write this as:
<http://www.semanticwebprimer.org/ontology/apartments.ttl#Baron
WayBuilding>
<http://dbpedia.org/ontology/location>
<http://dbpedia.org/resource/Amsterdam>.
15
Chapter 2
A Semantic Web Primer
Graphs
Baron Way
Building
Location
Amsterdam
We can write this same statement down graphically
16
–
Labeled nodes are connected by labeled arcs
–
Arcs are directed from subject to object of the statement
–
Labels on the nodes are identifiers of subject and object
and labels on the arcs are identifiers of property
Chapter 2
A Semantic Web Primer
Graphs
17

The graphical representation highlights the notion
that RDF is graph-centric

The graph can be expanded with more information
and can be created in a distributed fashion by
multiple different participants, allowing knowledge to
be reused
Chapter 2
A Semantic Web Primer
Linked Data Principles

18
A set of best practices encourage us to reuse and
make available information to help create a global
graph
–
Use URIs as names for things
–
Use HTTP URIs so that people can look up those names
–
When someone looks up a URI, provide useful information
using the standards (RDF)
–
Include links to other URIs so that they can discover more
things
Chapter 2
A Semantic Web Primer
Pointing to Statements and Graphs

Sometimes it is useful to be able to point to particular
statements and parts of graphs
– e.g. we may want to say that the statement about
the location of the Baron Way Building was
created by a person, Frank.

One mechanism for doing so is reification (具体化
)
–
19
The key idea is to introduce an auxiliary(辅助)object and
relates it to the three components of the original statement
through the properties subject, predicate, and object
Chapter 2
A Semantic Web Primer
An Example of Reification
Frank
Creator
Location
Statement
subject
object
predicate
Baron Way
Building
20
Chapter 2
location
Amsterdam
A Semantic Web Primer
Reification
21

Only triples are allowed in RDF, so this rather
cumbersome approach is necessary

The notion of named graphs(命名图)was
introduced in newer versions of RDF

An explicit identifier can be given to a statement or a
set of statements

This identifier can then be referred to in normal
triples
Chapter 2
A Semantic Web Primer
Dealing with Richer Predicates
22

We can think of a triple (x, P, y) as a logical formula
P(x, y) where P is a binary predicate

RDF offers only binary predicates(二元谓词)

For certain cases in which we may need more than
two arguments, we can use binary predicates to
simulate such predicates
Chapter 2
A Semantic Web Primer
Binary Predicates to Simulate
Predicates with Three Arguments
23

The intuitive meaning of broker(X,Y,Z) is X is the
broker in a home sale between seller Y and buyer Z

We introduce a new auxiliary resource home-sale
and binary predicates broker, seller, and buyer

broker(X,Y,Z) can be represented as follows:
–
Broker(home-sale, X)
–
Seller(home-sale, Y)
–
Buyer(home-sale, Z)
Chapter 2
A Semantic Web Primer
Lecture Outline
24
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
RDF Syntaxes
25

We have already introduced a graphical syntax
– neither machine interpretable nor standardized

Terse RDF Triple Language (Turtle) is a standard
machine interpretable syntax
–
Text-based syntax for RDF
–
File extension used for Turtle text file is “.ttl”
Chapter 2
A Semantic Web Primer
An Example Statement in Turtle
<http://www.semanticwebprimer.org/ontology/apartments.ttl#Baron
WayBuilding>
<http://dbpedia.org/ontology/location>
<http://dbpedia.org/resource/Amsterdam>.
26

URLs are enclosed in angle brackets

The subject, predicate, and object appear in order,
followed by a period

We can write a whole RDF graph using this
approach
Chapter 2
A Semantic Web Primer
Literals
27

In Turtle, we can write literals down by simply
enclosing the values in quotes and appending it with
the data type of the value

The data type tells us how to interpret a value

Data types are expressed as URLs

It is recommended to use the data type defined by
XML Schema
Chapter 2
A Semantic Web Primer
Common Data Types Expressed using
Turtle
string — “Baron Way”
integers — “1”^^<http://www.w3.org/2001/XMLSchema#integer>
decimals — “1.23”^^<http://www.w3.org/2001/XMLSchema#decimal>
dates — “1982-08-30 ”^^<http://www.w3.org/2001/XMLSchema#date>
time — “11:24:00” ^^<http://www.w3.org/2001/XMLSchema#time>
date with a time — “1982-08-30T11:24:00”
^^<http://www.w3.org/2001/XMLSchema#dateTime>
28
Chapter 2
A Semantic Web Primer
Using Data Types in Statement
Suppose we want to add to our graph that the Baron
Way Apartment has three bedrooms
<http://www.semanticwebprimer.org/ontology/apartments.ttl#Bar
onWayApartment>
<http://www.semanticwebprimer.org/ontology/apartments.ttl#has
NumberOfBedrooms>
“3”^^<http://www.w3.org/2001/XMLSchema#integer>.
29
Chapter 2
A Semantic Web Primer
Abbreviations

In our example, we define resources Baron Way
Apartment and Baron Way Building at the same URL
http://www.semanticwebprimer.org/ontology/apartme
nts.ttl

This URL is the namespace(命名空间)of those
resources

Turtle takes advantage of this convention(约定)to
allow URLs to be abbreviated
–
30
introducing @prefix syntax to define short stand-ins
(qualified names) for particular namespaces
Chapter 2
A Semantic Web Primer
Abbreviations
@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource/>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
swp:BaronWayApartment swp:hasNumberOfBedrooms “3”^^<xsd:integer>.
swp:BaronWayApartment swp:isPartOf swp:BaronWayBuilding.
swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam.
31
Chapter 2
A Semantic Web Primer
Abbreviations
Turtle allows us not to repeat particular subjects when they are
used repeatedly
@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource/>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
swp:BaronWayApartment swp:hasNumberOfBedrooms “3”^^<xsd:integer>;
swp:isPartOf swp:BaronWayBuilding.
swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam.
32
Chapter 2
A Semantic Web Primer
Abbreviations
If both a subject and predicate are used repeatedly,
@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource/>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
swp:BaronWayApartment swp:hasNumberOfBedrooms “3”^^<xsd:integer>;
swp:isPartOf swp:BaronWayBuilding.
swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam,
dbpedia:Netherlands.
33
Chapter 2
A Semantic Web Primer
Abbreviations
Turtle allows us to abbreviate common data types
@prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource/>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
swp:BaronWayApartment swp:hasNumberOfBedrooms 3;
swp:isPartOf swp:BaronWayBuilding.
swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam,
dbpedia:Netherlands.
34
Chapter 2
A Semantic Web Primer
Named Graphs
35

For example, we might want to say that our
statements about the Baron Way Apartments
were created by a person, Frank,identified by the
URL http://www.cs.vu.nl/~frankh

We can put brackets around the set of statements
we want and assign a URL to that set of
statements
Chapter 2
A Semantic Web Primer
An Example of Name Graphs
@prefix swp:
<http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix dbpedia: <http://dbpedia.org/resource/>.
@prefix dbpedia-owl: <http://dbpedia.org/ontology/>.
@dc: <http://purl.org/dc/terms/>.
default
graph
{
<http://www.semanticwebprimer.org/ontology/apartments.ttl#>
dc: creator <http://www.cs.vu.nl/~frankh>.
}
36
Chapter 2
A Semantic Web Primer
An Example of Name Graphs
named
graph
<http://www.semanticwebprimer.org/ontology/apartments.ttl#>
{
swp:BaronWayApartment swp:hasNumberOfBedrooms 3;
swp:isPartOf swp:BaronWayBuilding.
swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam,
dbpedia:Netherlands.
}
37
Chapter 2
A Semantic Web Primer
RDF/XML

RDF/XML is an encoding of RDF in XML language
–

Subjects are denoted by the rdf:about within an rdf:Description
element
–

38
allows RDF to be used with existing XML processing tools
<rdf:Description
rdf:about=“http://www.semanticwebprimer.org/ontology/apartments
.ttl#BaronWayApartment”>
Predicates and objects related to that subject are enclosed in
the rdf:Description element
Chapter 2
A Semantic Web Primer
An Example of RDF/XML
<?xml version=“1.0” encoding=“utf-8”?>
<rdf:RDF xmlns:dbpedia-owl=“http://www.dbpedia.org/ontology/”
xmlns:dbpedia=“http://dbpedia.org/resource/”
xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns:swp=“http://www.semanticwebprimer.org/ontology/apartments.ttl#”>
<rdf:Description
rdf:about=“http://www.semanticwebprimer.org/ontology/apartments.ttl#Baro
nWayApartment”>
39
Chapter 2
A Semantic Web Primer
An Example of RDF/XML
<swp:hasNumberOfBedrooms
rdf:datatype=“http://www.w3.org/2001/XMLSchema#integer”> 3
</swp:hasNumberOfBedrooms>
</rdf:Description>
<rdf:Description
rdf:about=“http://www.semanticwebprimer.org/ontology/apartments.ttl#Ba
ronWayApartment”>
<swp:isPartOf
rdf:resource=“http://www.semanticwebprimer.org/ontology/apartments.ttl#
BaronWayBuilding”/>
</rdf:Description>
40</rdf:RDF>
Chapter 2
A Semantic Web Primer
RDFa

One use case of RDF is to describe or mark up the
content of HTML Web pages

RDFa syntax was introduced to make it easier
–

41
embeds RDF within the attributes of HTML tags
We will use an example of advertisement for the
Baron Way Apartment
Chapter 2
A Semantic Web Primer
Web page without any machine
readable description
<html>
<body>
<H1> Baron Way Apartment for Sale </H1>
The Baron Way Apartment has three bedrooms and is located
in the family friendly Baron Way Building. The Building is
located in the north of Amsterdam.
</body>
</html>
42
Chapter 2
A Semantic Web Primer
Mark up Web page with RDFa
<html xmlns:dbpediaowl=“http://www.dbpedia.org/ontology/”
xmlns:dbpedia=“http://dbpedia.org/resource/”
xmlns:swp=“http://www.semanticwebprimer.org/ontology/apartm
ents.ttl#”
xmlns:geo=“http://www.geonames.org/ontology#”
>
<body>
<H1> Baron Way Apartment for Sale </H1>
43
Chapter 2
A Semantic Web Primer
Mark up Web page with RDFa
<<div
div about=“[BaronWayApartment]”>
about=“[swp:BaronWayApartment]”>
The
The Baron
Baron Way
Way Apartment
Apartment has
has <span
<span
property=“swp:hasNumberOfBedrooms”>3</span>
property=“swp:hasNumberOfBedrooms”>3</span> three
three
bedrooms
bedrooms and
and is
is located
located in
in the
the family
family friendly
friendly <span
<span
rel=“swp:isPartOf”
rel=“swp:isPartOf” resource=“[swp:BaronWayBuilding]”>Baron
resource=“[swp:BaronWayBuilding]”>Baron
Way
Way Building</span>.
Building</span>.
44
Chapter 2
A Semantic Web Primer
Mark up Web page with RDFa
<div about=“[swp:BaronWayBuilding]”>
The Building is located in the north of Amsterdam.
<span rel=“dbpediaowl:location” resource=“[dbpedia:Amsterdam]”></span>
<span rel=“dbpediaowl:location” resource=“[dbpedia:Netherlands]”></span>
</div>
</div>
</body>
</html>
45
Chapter 2
A Semantic Web Primer
RDFa
46

RDFa will produce the same RDF as expressed
previously

RDF is encoded in tags so will not be rendered by
browsers

In some cases, we use brackets to inform the
parser prefixes are being used

How to identify the subject, predicate, and object?
Chapter 2
A Semantic Web Primer
Lecture Outline
47
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
RDF Schema: Adding Semantics

RDF is a universal language that lets users describe
resources in their own vocabularies
–

48
RDF does not make assumption about any particular
domain, nor does it define semantics of any domain
The user can do so in RDF Schema using:
–
classes and properties
–
class hierarchies and inheritance
–
property hierarchies
Chapter 2
A Semantic Web Primer
Classes and their Instances

When describing a particular domain, we must
distinguish between
–
–
49
Concrete “things” (individual objects,个体对象) in the
domain: Discrete Maths, David Billington etc.
Classes that define the type of objects: lecturers, students,
courses, etc.

Individual objects that belong to a class are referred
to as instances(实例)of that class

The relationship between instances and classes in
RDF is defined through rdf:type
Chapter 2
A Semantic Web Primer
Why Classes are Useful

50
An important use of classes is to impose restrictions
on what can be stated in an RDF document using the
schema
– As in programming languages, typing(类型)is
used to disallow nonsense from being stated
–
e.g. A + 1, where A is an array
–
The same is needed in RDF
Chapter 2
A Semantic Web Primer
Nonsensical Statements disallowed
through the Use of Classes

Baron Way Apartment rents Jeff Meyer
–
–

Amsterdam has the number of bedrooms 3
–
–
51
Buildings do not rent people
Restriction on values of the property “rents”
(range restriction)
Cities do not have bedrooms
This imposes a restriction on the objects to which
the property can be applied (domain restriction)
Chapter 2
A Semantic Web Primer
Class Hierarchies



52
Classes can be organized 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, e.g. class A
is a subclass of both B1 and B2
Chapter 2
A Semantic Web Primer
Class Hierarchy Example
Unit
Commercial
Unit
Office
53
Residential
Unit
Apartment
Chapter 2
House
A Semantic Web Primer
Inheritance in Class Hierarchies
54

Range restriction: People can only rent residential
units

Baron Way Apartment is an apartment and does not
qualify as a Residential unit --- no statement
specifies that it is a residential unit

Baron Way Apartment inherits the ability to be rented
from the class of residential units

This is done in RDF Schema by fixing the semantics
of “is a subclass of”
Chapter 2
A Semantic Web Primer
Property Hierarchies

Hierarchical relationships for properties
–
–

The converse is not necessarily true
–
–

55
e.g., “rents” is a subproperty of “resides at”
If a person p rents a residential unit r, then p also resides at
r
e.g., p may be a child living with a family and not paying rent,
or
a visitor
P is a subproperty(子属性)of Q, if Q(x,y) is true
whenever P(x,y) is true
Chapter 2
A Semantic Web Primer
RDF Layer vs RDF Schema Layer



56
Consider the RDF statement
– Jeff Meyer rents the Baron Way Apartment
The schema for this statement contain classes such
as person, apartments, houses, and units, properties
such as rents, resides at, or address
The schema is itself written in a formal language,
RDF Schema, that can express its ingredients:
– subClassOf, Class, Property, subPropertyOf,
Resource, etc.
Chapter 2
A Semantic Web Primer
Literal
range
address
domain
residesAt
range
domain
subPropertyOf
subClassOf
range
Person
rents
domain
Unit
subClassOf
Apartment
Residential
Unit
subClassOf
House
RDFS
RDF
Jeff Meyer
57
rents
Baron Way
Apartment
Lecture Outline
58
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
RDF Schema: The Language

The modeling primitives(建模原语)of RDF Schema
are defined using resources and properties (RDF itself
is used!)

To declare that “apartment” is a subclass of
“residential unit”
–
–
–
59

Define resources apartment, residential unit, and subClassOf
Define property subClassOf
Write triple (apartment, subClassOf, residential unit)
We use one of the standard syntaxes for RDF
Chapter 2
A Semantic Web Primer
Core Classes
60

rdfs:Resource, the class of all resources

rdfs:Class, the class of all classes

rdfs:Literal, the class of all literals (strings)

rdf:Property, the class of all properties

rdf:Statement, the class of all reified statements
Chapter 2
A Semantic Web Primer
Core Properties for Defining
Relationships

rdf:type, which relates a resource to its class
–

rdfs:subClassOf, which relates a class to one of its
superclasses
–

61
The resource is declared to be an instance of that
class
All instances of a class are instances of its
superclass
rdfs:subPropertyOf, relates a property to one of its
superproperties
Chapter 2
A Semantic Web Primer
Core Properties for Restricting
Properties

rdfs:domain, which specifies the domain of a
property P
–
–

rdfs:range, which specifies the range of a property P
–
62
and states that any resource that have a given property is an
instance of the domain classes
If the domain is not specified, then any resource can be the
subject
and states that the value of a given property is an instance
of the range classes
Chapter 2
A Semantic Web Primer
Examples
swp:address rdfs:domain swp:Unit.
swp:address rdfs:range rdf:Literal.
63
Chapter 2
A Semantic Web Primer
Relationships Between Core Classes
and Properties

rdfs:subClassOf and rdfs:subPropertyOf are
transitive(传递的), by definition

rdfs:Class is a subclass of rdfs: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
–
64
Because every class is a resource
For the same reason
Chapter 2
A Semantic Web Primer
Useful Properties for Reification
65

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
Chapter 2
A Semantic Web Primer
Container Classes

rdf:Bag, the class of bags, an unordered container
(无序容器), allowing multiple occurrences
–

66
e.g. members of the faculty board, documents in
a folder
rdf:Seq, the class of sequences, an ordered(有序)
container, which may contain multiple occurrences
– e.g. modules of a course, items on an agenda, an
alphabetized list of staff members (order is
imposed)
Chapter 2
A Semantic Web Primer
Container Classes


67
rdf:Alt, the class of alternatives(可选项)
– e.g. the document home and mirrors, translations
of a document in various languages
rdfs:Container, which is a superclass of all
container classes, including the three above
Chapter 2
A Semantic Web Primer
Example for a Bag
<rdf:Description rdf:ID="949352">
<rdf:type rdf:resource="http://www.mydomain.org/unins#Professor"/>
<uni:name>Grigoris Antoniou</uni:name>
<uni:coursesTaught>
<rdf:Bag>
<rdf:_1 rdf:resource="#CIT1112"/>
<rdf:_2 rdf:resource="#CIT3116"/>
</rdf:Bag>
</uni:coursesTaught>
</rdf:Description>
68
Chapter 2
A Semantic Web Primer
Example for Alternative
<rdf:Description rdf:ID="CIT1111">
<uni:courseName>Discrete Mathematics
</uni:courseName>
<uni:lecturer>
<rdf:Alt>
<rdf:li rdf:resource="#949352"/>
<rdf:li rdf:resource="#949318"/>
</rdf:Alt>
</uni:lecturer>
</rdf:Description>
69
Chapter 2
A Semantic Web Primer
Utility Properties
70

rdfs:seeAlso relates a resource to another
resource that explains 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

rdfs:comment. Comments, typically longer text,
can be associated with a resource

rdfs:label. A human-friendly(用户友好) label
(name) is associated with a resource
Chapter 2
A Semantic Web Primer
Example: Housing
@prefix swp:
<http://www.semanticwebprimer.org/ontology/apartments.ttl#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
swp:Person rdf:type rdfs:Class.
swp:Person rdfs:comment “The class of people”.
swp:Unit rdf:type rdfs:Class.
swp:Unit rdfs:comment “A self-contained section of
accommodations in a larger building or group of buildings.”.
71
Chapter 2
A Semantic Web Primer
Example: Housing
swp:ResidentialUnit rdf:type rdfs:Class.
Swp:ResidentialUnit rdfs:subClassOf swp:Unit.
swp:Unit rdfs:comment “The class of all units or places where
people live.”.
…
swp:residesAt rdf:type rdfs:Property.
swp:resideAt rdfs:comment “Relates persons to their residence.”.
swp:resideAt rdfs:domain swp:Person.
swp:resideAt rdfs:range swp:ResidentialUnit.
72
Chapter 2
A Semantic Web Primer
Example: Housing
swp:rents rdf:type rdfs:Property.
swp:rents rdfs:comment “It inherits its domain (swp:Person) and
range (swp:ResidentialUnit) from its superproperty
(swp:resideAt).”.
swp:rents rdfs:subPropertyOf swp:resideAt.
…
73
Chapter 2
A Semantic Web Primer
Class Hierarchy for the Motor Vehicles
Example
74
Chapter 2
A Semantic Web Primer
A Simple Ontology of Motor Vehicles
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
<#miniVan> rdf:type rdfs:Class;
rdfs:subClassOf <#passengerVehicle>, <#van>.
<#motorVehicle> rdf:type rdfs:Class.
<#passengerVehicle> rdf:type rdfs:Class;
rdfs:subClassOf <#motorVehicle>.
…
75
Chapter 2
A Semantic Web Primer
Lecture Outline
76
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
The Namespace of RDF
<rdfs:Class rdf:ID="Statement"
rdfs:comment="The class of triples consisting of a
predicate, a subject and an object (that is, a
reified statement)"/>
<rdfs:Class rdf:ID="Property"
rdfs:comment="The class of properties"/>
<rdfs:Class rdf:ID="Bag"
rdfs:comment="The class of unordered collections"/>
77
Chapter 2
A Semantic Web Primer
The Namespace of RDF
<rdf:Property rdf:ID="predicate"
rdfs:comment="Identifies the property of a
statement in reified form"/>
<rdfs:domain rdf:resource="#Statement"/>
<rdfs:range rdf:resource="#Property"/>
</rdf:Property>
78
Chapter 2
A Semantic Web Primer
The Namespace of RDF Schema
<rdfs:Class rdf:ID="Resource"
rdfs:comment="The most general class"/>
<rdfs:Class rdf:ID="Class"
rdfs:comment="The concept of classes.
All classes are resources"/>
<rdfs:subClassOf rdf:resource="#Resource"/>
</rdfs:Class>
79
Chapter 2
A Semantic Web Primer
The Namespace of RDF Schema
<rdf:Property rdf:ID="subPropertyOf">
<rdfs:domain rdf:resource="&rdf;Property"/>
<rdfs:range rdf:resource="&rdf;Property"/>
</rdf:Property>
<rdf:Property rdf:ID="subClassOf">
<rdfs:domain rdf:resource="#Class"/>
<rdfs:range rdf:resource="#Class"/>
</rdf:Property>
80
Chapter 2
A Semantic Web Primer
Namespace versus Semantics

Consider rdfs:subClassOf
–
–

The namespace specifies only that it applies to classes and
has a class as a value
The meaning of being a subclass not expressed
The meaning cannot be expressed in RDF document
–
If it could RDF Schema would be unnecessary
 External definition of semantics required
– Respected by RDF/RDFS processing software
81
Chapter 2
A Semantic Web Primer
Lecture Outline
82
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
Semantics based on Inference Rules
83

RDF has been given a semantics in terms of RDF
triples instead of restating RDF in terms of first-order
logic

… and a sound and complete inference system

This inference system consists of inference rules of
the form:
IF E contains certain triples
THEN add to E certain additional triples
where E is an arbitrary set of RDF triples
Chapter 2
A Semantic Web Primer
Examples of Inference Rules
IF E contains the triple (?x,?p,?y)
THEN E also contains (?p,rdf:type,rdf:Property)
IF E contains the triples (?u,rdfs:subClassOf,?v) and
(?v,rdfs:subclassOf,?w)
THEN E also contains the triple (?u,rdfs:subClassOf,?w)
84
IF E contains the triples (?x,rdf:type,?u) and
(?u,rdfs:subClassOf,?v)
THEN E also contains the triple (?x,rdf:type,?v)
Chapter 2
A Semantic Web Primer
Examples of Inference Rules
IF E contains the triples (?x,?p,?y) and
(?p,rdfs:range,?u)
THEN E also contains the triple (?y,rdf:type,?u)

Any resource ?y which appears as the value of a
property ?p can be inferred to be a member of the
range of ?p
–
85
This shows that range definitions in RDF Schema are not
used to restrict the range of a property, but rather to infer
the membership of the range
Chapter 2
A Semantic Web Primer
Lecture Outline
86
1.
Introduction
2.
RDF: Data Model
3.
RDF Syntaxes
4.
RDFS: Adding Semantics
5.
RDF Schema: The Language
6.
RDF and RDF Schema in RDF Schema
7.
A Direct Inference System for RDF and RDFS
8.
Summary
Chapter 2
A Semantic Web Primer
Summary
87

RDF provides a foundation for representing and
processing machine readable metadata

RDF has a graph-based data model

RDF has three standard syntaxes (Turtle, RDF/XML,
and RDFa) to support syntactic interoperability

RDF has a decentralized philosophy and allows
incremental building of knowledge, and its sharing
and reuse
Chapter 2
A Semantic Web Primer
Summary

RDF is domain-independent
- RDF Schema provides a mechanism for describing specific
domains

RDF Schema is a primitive ontology language
–

88
It offers certain modeling primitives with fixed meaning
Key concepts of RDF Schema are class, subclass
relations, property, subproperty relations, and
domain and range restrictions
Chapter 2
A Semantic Web Primer
Points for Discussion in Subsequent
Chapters
89

RDF Schema is quite primitive as a modeling
language for the Web

Many desirable modeling primitives are missing

Therefore we need an ontology layer on top of RDF
and RDF Schema
Chapter 2
A Semantic Web Primer