Transcript Document

Una piattaforma inferenziale per il
Web Semantico: Jena2
Roma, 2006
Web Semantico
RDF – Resource
Description Framework
M. Missikoff – F. Taglino
LEKS, IASI-CNR
Summary







Motivations
RDF knowledge model
RDF(S) modelling notions
XML/RDF, an XML syntax for RDF(S)
Using RDF for inferring knowledge
Extending RDF(S): OWL
Conclusions
2
Motivations



Semantic Web: Information needs to be processed
by applications, rather than being only displayed
to people (e.g., like with HTML)
Common convention about semantics, syntax, and
structure required
Define a language for representing meta-data, with
a semantic “flavor”
3
What is RDF?

The Resource Description Framework is a






Flexible language for representing knowledge over the
web
It models: conceptual knowledge (schemas) and factual
knowledge (data)
Enables the encoding, exchange, and reuse of structured
knowledge about defined entities (identified by URI)
Enables data interoperability through the design of
mechanisms that support common conventions of
semantics, syntax, and structure.
The
W3C Recommendation
http://www.w3.org/TR/rdf-syntax-grammar/
4
URI - Uniform Resource Identifier



Used to identify items on the Web
Anyone can create a URI
A URI can be associated to anything




Network-accessible things, e.g., electronic document,
image, service, …
Not network-accessible things, e.g., human beings,
corporation, book, car, …
Abstract concepts, e.g., creator, member, …
Uniform Resource Locator (URL) – one form of URI
e.g., http://www.w3.org
5
RDF (Meta)Model

Knowledge is represented as collections of Triples
resource
(subject)




property
(predicate)
value
(object)
Resource – thing that can be identified on the Web
Property – specific aspect, characteristic, attribute, or
relation used to describe a resource
Value - Property’s value: resource or literal
Connecting triples together we can represent a graph
6
RDF: abstract (graph)
representation
has_sister
mary
john
has_age
john
27
type
Person
subClassOf
Student
Prof
7
Statement (triple)

The following sentence
http://www.example.org/index.html has creator
whose_value_is John Smith
Can be expressed by an RDF statement having:
 Subject http://www.example.org/index.html
 Predicate http://purl.org/dc/creator
 Object John Smith
8
Basic RDF Model - example
http://www.example.org/index.html has creator whose value is
John Smith
http://www.example.org/
index.html
resource
(subject)
http://purl.org/dc/creator
John Smith
property
(predicate)
value
(object)
RDF Statement
Please Note: when the object is a Literal it is represented by a BOX
9
RDF Schema

The purpose is to define an XML vocabulary to:



Denote classes (subclasses) and their relationships
Define properties and associate them with classes
The benefit is that


Data are modeled according to schema (as usual in DB)
inferencing on data, and enhanced searching are
facilitated
http://www.w3.org/TR/rdf-schema/
10
Knowledge model of RDF(S)
Class
Person
John
property
has_age
has_age
range
RDF(S)
Meta-model
Int
Application
specific schema
(RDF(S) Model)
23
Application specific
actual data
(RDF Instances)
11
RDF(S) modelling notions
The following RDF(S) modelling notions are presented
 Schema definition: useful for defining new vocabularies
(i.e., names of classes, of attributes, …)
 Utility: additional notions useful to enrich the entity
definiton



Label and Comment
Complex Structures, e.g., Container
Synonyms
Note: we will present a simplified version of RDF(S). In
particular, “reification” will be omitted
12
Schema definition
(RDFS vocabulary)

rdfs:Class


rdfs:subClassOf


Constraints on properties definition
rdfs:subProperty


For defining specialisation among Classes
rdfs:domain and rdfs:range


Set of resources
For defining specialisation among Properties
rdf:Property

Borrowed from RDF (ground), but used at schema level
13
rdfs:Class


Class is a resource denoting a set of resources
(instances)
Examples:


Person
River
Person
rdfs:Class
River
<rdfs:Class rdf:ID=“River”/>
<rdfs:Class rdf:ID=“Person”/>
14
rdfs:subClassOf – Example
rdfs:subClassOf
NaturallyOccurringWaterSource
BodyOfWater
Stream
Brook
River
Tributary
Lake
Ocean
<rdfs:Class rdf:ID=“NaturallyOccurringWaterSource”/>
<rdfs:Class rdf:ID=“BodyOfWater”/>
<rdfs:subClassOf rdf:resource=“#NaturallyOccurringWaterSource”/>
</rdfs:Class>
<rdfs:Class rdf:ID=“Stream”>
<rdfs:subClassOf rdf:resource=“#NaturallyOccurringWaterSource”/>
</rdfs:Class>
<rdfs:Class rdf:ID=“River”>
<rdfs:subClassOf rdf:resource=“#Stream”/>
</rdfs:Class>
…
Sea
15
rdfs:subClassOf – Properties



Allows specialisation hierarchy among Classes to
be defined
Multiple subClassOf properties may be specified
Transitive (i.e., any River is a
NaturallyOccurringWaterSource too)
16
Definition of a Property at intensional level
rdfs:domain and rdfs:range




Used to define properties at intentional level
rdfs:domain, restricts the set of resources that
may have a given property
rdfs:range, restricts the set of valid values for a
property.
A property may have multiple domain, and more
than one range
17
Example of definition of a Property
at intensional level (1)
A River has a name expressed as a Literal
rdfs:domain
River
rdfs:Class
rdf:Property
hasName
rdfs:range
rdfs:Literal
Class representing
literals (strings)
<rdfs:Class rdf:ID=“River”/>
<rdf:Property rdf:ID=“hasName”>
<rdfs:domain rdf:resource=“#River”/>
<rdfs:range
rdf:resource=“http://www.w3.org/2000/01/rdfschema#Literal”/>
</rdf:Property>
18
Example of definition of a Property
at intensional level (2)
rdfs:Class
rdfs:domain
River
rdf:Property
emptiesInto
rdfs:range
rdfs:Class
BodyOfWater
<rdf:Property rdf:ID=“emptiesInto”>
<rdfs:domain rdf:resource=“#River”/>
<rdfs:range rdf:resource=“#BodyOfWater”/>
</rdf:Property>
19
rdfs:subPropertyOf


Allows specialisation hierararchy among
properties to be defined
Multiple subPropertyOf properties for the same
property can be specified
20
Example of a subProperty definition
The hasMother property is a sub property of the
hasParent property
rdfs:domain
rdfs:Class
Person
rdf:Property
hasParent
rdfs:range
rdfs:subPropertyOf
hasMother
rdf:Property
<rdf:Property rdf:ID=“hasParent”>
<rdfs:domain rdf:resource=“#Person”/>
<rdfs:range rdf:resource=“#Person”/>
</rdf:Property >
<rdf:Property rdf:ID=“hasMother”>
<rdfs:subPropertyOf rdf:resource=“#hasParent”/>
</rdf:Property>
21
Class instance definition
rdf:type

Instances are defined through the rdf:type
property
The Yangtze is an instance of the River Class
Yangtze
rdf:type
River
<rdf:Description rdf:ID=“Yangtze”>
<rdf:type rdf:resource=“River”/>
</rdf:Description>
22
Utility notions

rdfs:label and rdfs:comment


rdfs:Container


For describing resources with human readable text
Collections of resources
rdfs:seeAlso and rdfs:isDefinedBy

For referring to alternative descriptions of resources
23
rdfs:label and rdfs:comment
Describe a resource with human readable text in addition to
pure RDF properties
 rdfs:label, to assign a human readable name to a resource
 rdfs:comment, to give a longer natural language
description to a resource
rdfs:label
Yangtze
http://www.china.org/geography/
rivers/Yangtze
rdfs:comment
The biggest Chinese river
<rdf:Description rdf:ID=“http://www.china.org/geography/rivers/Yangtze”>
<rdfs:label>Yangtze</rdfs:label>
<rdfs:comment>The biggest Chinese river</rdfs:comment>
</rdf:Property>
24
Summary of RDF(S) modeling constructs











rdfs:Class and rdf:type
rdfs:subClassOf
rdfs:domain and rdfs:range
rdfs:subProperty and rdf:property
rdfs:label and rdfs:comment
rdfs:Container
rdfs:seeAlso and rdfs:isDefinedBy
rdf:Resource (the generic entity)
rdf:ID (when the entity is first introduced)
rdf:about (when the entity is referred to)
rdf:Description
25
How RDF can be implemented



Diagrammatic representation is an Abstract Syntax
Several Concrete Sintaxes: usually RDF/XML syntax
However, other notations possible
e.g., Notation3 (N3):
<#pat> <#loves> <#joe>
<http://xyz.org/#a> <http://xyz.org/#b> <http://xyz.org/#c>
<http://xyz.org/#Sean> <http://xyz.org/#name> “Sean”

RDF/XML Abreviated syntax
Note: the symbol “#” is a separator between the Prefix and the resource ID
26
Using RDF(S) for Ontologies and
Inferencing
An extract of an RDF ontology
<?xml version=“1.0”/>
<rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#”
Namespaces
declaration
xmlns:rdfs=“http://www.w3.org/2000/01/rdf-schema#”
xml:base=“http://www.geodesy.org/water/naturally-occurring”>
<rdfs:Class rdf:ID=“NaturallyOccurringWaterSource”/>
Classes
definition
<rdfs:Class rdf:ID=“BodyOfWater”/>
<rdfs:subClassOf rdf:resource=“#NaturallyOccurringWaterSource”/>
</rdfs:Class>
Sub classes
<rdfs:Class rdf:ID=“Stream”>
definition
<rdfs:subClassOf rdf:resource=“#NaturallyOccurringWaterSource”/>
</rdfs:Class>
<rdfs:Class rdf:ID=“River”>
<rdfs:subClassOf rdf:resource=“#Stream”/>
Properties
definition
</rdfs:Class>
<rdf:Property rdf:ID=“emptiesInto”>
<rdfs:domain rdf:resource=“#River”/>
Domain and
<rdfs:range rdf:resource=“#BodyOfWater”/>
Range definition
</rdf:Property>
<rdf:Property rdf:ID=“length”>
<rdfs:domain rdf:resource=“#River”/>
<rdfs:range rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Literal”/>
</rdf:Property >
28
</rdf:RDF>
What inferences can be made?
rdfs:subClassOf
NaturallyOccurringWaterSource
Brook
River
Inference
Engine
BodyOfWater
Stream
Tributary
Lake
Ocean
Sea
- length: Literal
- emptiesInto: BodyOfWater
<River
rdf:ID=“http://www.china.org/geography/rivers/Yangtze”
xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns=“http://www.geodesy.org/river#”>
<lenght>6300 kilometers</lenght>
<emptiesInto rdf:resource=“http://www.china.org/EastChinaSea”/>
</River>
Inferences:
- Yangtze is a Stream
- Yangtze is a NaturallyOccurringWaterSource
- http://www.china.org/EastChinaSea is a BodyOfWater
29
How does a taxonomy facilitate
searching?
rdfs:subClassOf
NaturallyOccurringWaterSource
BodyOfWater
Stream
Brook
River
Tributary
Lake
Ocean
Sea
- length: Literal
- emptiesInto: BodyOfWater
“Show me all the documents that
contain info about streams”
Inference
Engine
<River
rdf:ID=“http://www.china.org/geography/rivers/Yangtze”
xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns=“http://www.geodesy.org/river#”>
<lenght>6300 kilometers</lenght>
<emptiesInto rdf:resource=“http://www.china.org/EastChinaSea”/>
</River>
Results:
- Yangtze is a Stream, so this document is relevant to the query
30
Desire more expressiveness

Two classes, same concept


Equivalent classes: Airplane and Plane
Cardinality constraints

Ocean has one maxDepth
OWL
RDF(S)
RDF Schema: Building Block to more
expressive Ontology Languages like OWL
31
OWL (Ontology Web Language)

Provides three increasingly expressive languages



OWL Full maximum expressiveness with no
computational guarantees
OWL DL, expressiveness of Description Logics without
losing computational completeness
OWL Lite, simple constraint features. E.g., cardinality
constraints
OWL Full
OWL DL
OWL Lite
32
Rules

Allows for derivations, by introducing a “special”
binary predicate:



log:implies
=>
Subject and Object are RDF triples, called formulae
Derivation (n3 syntax):

{X :parent Y; :brother Z } => {Z :uncle Y }
33
Conclusions







RDF has potential to make web contents machine
readable
RDF describes resources and anything can be
seen as a Resources
RDF(S) comprises vocabulary for describing also
the intentional level
Several serializations (i.e., RDF/XML, N3)
Suitable for applying inference
Limited features (i.e., no cardinality constraints)
OWL for a more expressiveness
34
Sources





http://www.w3.org/TR/rdf-primer/
http://www.w3.org/TR/rdf-syntax-grammar/
http://www.w3.org/TR/rdf-schema/
P.A. Champin, RDF Tutorial - http://www710.univlyon1.fr/~champin/rdf-tutorial/rdf-tutorial.pdf
A. Wilk, RDF(S) -
www.ida.liu.se/labs/iislab/courses/LW/slides/RDFS.p
df
35
Qualche esercizio rapido

Rappresentare in RDF alcune frasi di linguaggio
naturale






Ugo ama Anna
Il treno parte alle 10:40
Il treno è partito in ritardo
Le auto vecchie inquinano
Il corso di Knowledge Extraction è interessante
La prima domenica del mese c’è il mercatino in Piazza
Dante
36
Passaggio a RDF/Diagramma

Ugo ama Anna
Persona
Rdfs:subClassOf
rdf:type
Ex:Ugo
Studente
Ex:ama
Ex:Anna
37