RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma...

37
RDF Resource Description Framework M. Missikoff F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico

Transcript of RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma...

Page 1: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

RDF – ResourceDescription Framework

M. Missikoff – F. TaglinoLEKS, IASI-CNR

Una piattaforma inferenziale per il Web Semantico: Jena2

Roma, 2006

Web Semantico

Page 2: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

2

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

Page 3: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

3

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”

Page 4: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

4

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/

Page 5: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

5

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

Page 6: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

6

RDF (Meta)Model

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

resource(subject)

property(predicate)

value(object)

Knowledge is represented as collections of Triples

Page 7: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

7

RDF: abstract (graph) representation

johnjohn

has_age

johnjohn PersonPersontype

ProfProfStudentStudent

subClassOf

marymaryhas_sister

2727

Page 8: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

8

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

Page 9: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

9

Basic RDF Model - example

http://www.example.org/index.html has creator whose value is John Smith

http://www.example.org/index.html John SmithJohn Smith

http://purl.org/dc/creator

resource(subject)

property(predicate)

value(object)

RDF Statement

Please Note: when the object is a Literal it is represented by a BOX

Page 10: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

10

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/

Page 11: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

11

Knowledge model of RDF(S)

ClassClass rangerange

RDF(S)Meta-model

Application specific schema(RDF(S) Model)

Application specific actual data(RDF Instances)

property

PersonPerson IntInthas_age

JohnJohnhas_age

2323

Page 12: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

12

RDF(S) modelling notionsThe 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

Page 13: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

13

Schema definition (RDFS vocabulary) rdfs:Class

Set of resources rdfs:subClassOf

For defining specialisation among Classes rdfs:domain and rdfs:range

Constraints on properties definition rdfs:subProperty

For defining specialisation among Properties rdf:Property

Borrowed from RDF (ground), but used at schema level

Page 14: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

14

rdfs:Class Class is a resource denoting a set of

resources (instances) Examples:

Person River PersonPerson

rdfs:Classrdfs:Class

RiverRiver

<rdfs:Class rdf:ID=“River”/><rdfs:Class rdf:ID=“Person”/>

Page 15: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

15

rdfs:subClassOf – Example

<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>…

NaturallyOccurringWaterSourceNaturallyOccurringWaterSource

StreamStream BodyOfWaterBodyOfWater

BrookBrook RiverRiver TributaryTributary LakeLake OceanOcean SeaSea

rdfs:subClassOf

Page 16: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

16

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)

Page 17: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

17

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

Page 18: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

18

Example of definition of a Property at intensional level (1)

<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>

RiverRiver

rdfs:Literalrdfs:Literal

hasNamehasName

rdfs:domain

rdfs:range Class representingliterals (strings)

A River has a name expressed as a Literal

rdf:Property

rdfs:Class

Page 19: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

19

Example of definition of a Property at intensional level (2)

<rdf:Property rdf:ID=“emptiesInto”> <rdfs:domain rdf:resource=“#River”/> <rdfs:range rdf:resource=“#BodyOfWater”/></rdf:Property>

RiverRiver

BodyOfWaterBodyOfWater

emptiesIntoemptiesInto

rdfs:domain

rdfs:range

rdf:Property

rdfs:Class

rdfs:Class

Page 20: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

20

rdfs:subPropertyOf Allows specialisation hierararchy among

properties to be defined Multiple subPropertyOf properties for the

same property can be specified

Page 21: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

21

Example of a subProperty definition

<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>

PersonPerson hasParenthasParent

hasMotherhasMother

rdfs:domain

rdfs:rangerdfs:subPropertyOf

The hasMother property is a sub property of the hasParent property

rdfs:Classrdf:Property

rdf:Property

Page 22: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

22

Class instance definitionrdf:type Instances are defined through the rdf:type

property

YangtzeYangtze RiverRiverrdf:type

<rdf:Description rdf:ID=“Yangtze”> <rdf:type rdf:resource=“River”/></rdf:Description>

The Yangtze is an instance of the River Class

Page 23: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

23

Utility notions rdfs:label and rdfs:comment

For describing resources with human readable text

rdfs:Container Collections of resources

rdfs:seeAlso and rdfs:isDefinedBy For referring to alternative descriptions of

resources

Page 24: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

24

rdfs:label and rdfs:commentDescribe 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 YangtzeYangtze

The biggest Chinese riverThe biggest Chinese river

rdfs:label

rdfs:comment

http://www.china.org/geography/rivers/Yangtze

http://www.china.org/geography/rivers/Yangtze

<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>

Page 25: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

25

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

Page 26: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

26

How RDF can be implemented

Diagrammatic representation is an Abstract Syntax

Several Concrete Sintaxes: usually RDF/XML syntax

However, other notations possiblee.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 syntaxNote: the symbol “#” is a separator between the Prefix and the resource ID

Page 27: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

Using RDF(S) for Ontologies and Inferencing

Page 28: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

28

An extract of an RDF ontology<?xml version=“1.0”/><rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs=“http://www.w3.org/2000/01/rdf-schema#” xml:base=“http://www.geodesy.org/water/naturally-occurring”>

<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> <rdf:Property rdf:ID=“emptiesInto”> <rdfs:domain rdf:resource=“#River”/> <rdfs:range rdf:resource=“#BodyOfWater”/></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 >

</rdf:RDF>

Propertiesdefinition

Domain andRange definition

Namespacesdeclaration

Classesdefinition

Sub classesdefinition

Page 29: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

29

What inferences can be made?

NaturallyOccurringWaterSourceNaturallyOccurringWaterSource

StreamStream BodyOfWaterBodyOfWater

BrookBrook RiverRiver TributaryTributary LakeLake OceanOcean SeaSea

rdfs:subClassOf

InferenceEngine

<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

- length: Literal- emptiesInto: BodyOfWater

Page 30: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

30

How does a taxonomy facilitate searching?

NaturallyOccurringWaterSourceNaturallyOccurringWaterSource

StreamStream BodyOfWaterBodyOfWater

BrookBrook RiverRiver TributaryTributary LakeLake OceanOcean SeaSea

rdfs:subClassOf

- 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>Results:

- Yangtze is a Stream, so this document is relevant to the query

InferenceEngine“Show me all the documents that

contain info about streams”

Page 31: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

31

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

Page 32: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

32

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 Lite

OWL DL

OWL Full

Page 33: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

33

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 }

Page 34: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

34

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

Page 35: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

35

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.univ-lyon1.fr/~champin/rdf-tutorial/rdf-tutorial.pdf

A. Wilk, RDF(S) - www.ida.liu.se/labs/iislab/courses/LW/slides/RDFS.pdf

Page 36: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

36

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

Page 37: RDF – Resource Description Framework M. Missikoff – F. Taglino LEKS, IASI-CNR Una piattaforma inferenziale per il Web Semantico: Jena2 Roma, 2006 Web Semantico.

37

Passaggio a RDF/Diagramma Ugo ama Anna

Ex:Ugo Ex:AnnaEx:ama

Persona

rdf:typeStudente

Rdfs:subClassOf