resource description framework rdf - cinvestav · 2017. 7. 7. · resource description framework...

34
07/07/2017 1 1 An Introduction to Web Semantic Technologies Resource Description Framework RDF 2 An Introduction to Web Semantic Technologies Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer is still the subject of debate. For our purposes we can think of it as anything we can identify: you are a resource, as is your home page, this presentation, a book, song, student, etc.. Designed to be read and understood by computers Not designed for being displayed to people Written in XML Part of the W3C's Semantic Web Activity A W3C Recommendation: http://www.w3.org/RDF

Upload: others

Post on 21-Feb-2021

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

1

1An Introduction to Web Semantic Technologies

Resource Description Framework

RDF

2An Introduction to Web Semantic Technologies

Resource Description Framework (RDF)

� A framework for describing resources on the web

� What is a resource?

� The answer is still the subject of debate.

� For our purposes we can think of it as anything we can identify: you are a resource, as is your home page, this presentation, a book, song, student, etc..

� Designed to be read and understood by computers

� Not designed for being displayed to people

� Written in XML

� Part of the W3C's Semantic Web Activity

� A W3C Recommendation: http://www.w3.org/RDF

Page 2: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

2

3An Introduction to Web Semantic Technologies

3

RDF Components

� Formal data model

� Syntax for interchange of data

� Schema Type system (schema model)

� Syntax for machine-understandable schemas

� Query and profile protocols

4An Introduction to Web Semantic Technologies

RDF - Examples of Use

� We can describe things such as:

� Properties for shopping items, such as price and

availability

� Time schedules for web events

� Information about web pages (content, author,

created and modified date)

� Content and rating for web pictures

� Content for search engines

� Describing electronic libraries

Page 3: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

3

5An Introduction to Web Semantic Technologies

RDF and "The Semantic Web"

� The RDF language is a part of the W3C's

Semantic Web Activity. W3C's "Semantic Web

Vision" is a future where:

� Web information has exact meaning

� Web information can be understood and

processed by computers

� Computers can integrate information from the

web

6An Introduction to Web Semantic Technologies

RDF: Basic Concepts

� The fundamental concepts of RDF are resources,properties, and statements.

� Resources:

� An object, a “thing” we want to talk about.

� Authors, books, publishers, places, people, hotels, rooms,search queries, and so on.

� Every resource has a URI, a Uniform Resource Identifier. AURI can be a URL (Uniform Resource Locator, or Web address)or some other kind of unique identifier; note that anidentifier does not necessarily enable access to a resource

� URI schemes have been defined not only for Web locationsbut also for such diverse objects as telephone numbers, ISBNnumbers, and geographic locations.

Page 4: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

4

7An Introduction to Web Semantic Technologies

RDF: Basic Concepts (Cont..)

� Properties:

� Special kind of resources

� Describe relations between resources, for example

“written by”, “age”, “title”, and so on.

� Are also identified by URIs (and in practice by URLs). The

use of such a scheme greatly reduces the homonym

problem.

8An Introduction to Web Semantic Technologies

RDF: Basic Concepts (Cont..)

� Statements:

� Assert the properties of resources.

� Are a object-attribute-value triple, consisting of a

resource, a property, and a value.

� Values can either be resources or literals. Literals are

atomic values (strings).

Page 5: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

5

9An Introduction to Web Semantic Technologies

Three Views of a Statement

� An example of a statement is

David Billington is the owner of the Web pagehttp://www.cit.gu.edu.au/∼db.

The simplest way of interpreting this statement is to use the definition and consider the triple:

(http://www.cit.gu.edu.au/~db,http://www.mydomain.org/site-owner, #DavidBillington).

We can think of this triple (x, P, y) as a logical formula P(x, y), where the binary predicate P relates the object x to the object y

10An Introduction to Web Semantic Technologies

Three Views of a Statement (Cont..)

David Billington is the owner of the Web pagehttp://www.cit.gu.edu.au/∼db.

A second view is graph-based.

� It is a directed graph with labeled nodes and arcs.� the arcs are directed from the resource (the subject of

the statement) to the value (the object of thestatement).

� This kind of graph is known in the Artificial Intelligencecommunity as a semantic net.

Page 6: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

6

11An Introduction to Web Semantic Technologies

Three Views of a Statement (Cont..)

As we have said, the value of a statement may be a resource.Therefore, it may be linked to other resources. Consider thefollowing triples:(http://www.cit.gu.edu.au/~db,

http://www.mydomain.org/site-owner, #DavidBillington)

(#DavidBillington, http://www.mydomain.org/phone, "3875507")

(#DavidBillington, http://www.mydomain.org/uses, http://www.cit.gu.edu.au/~arock/defeasible/Defeasible.cgi)

(http://www.cit.gu.edu.au/~arock/defeasible/Defeasible.cgi, http://www.mydomain.org/site-owner, ‘‘Andrew Rock’’)

12An Introduction to Web Semantic Technologies

Three Views of a Statement (Cont..)

� A third representation of a Statement is possible based onXML.

� In this context, an RDF document is represented by an XMLelement with the tag rdf:RDF

� The content of this element is a number of descriptions,which use rdf:Description tags.

� Every description makes a statement about a resource,which is identified in one of three different ways:� An rdf:about attribute, referencing an existing

resource.� An rdf:ID attribute, creating a new resource.� Without a name, creating an anonymous resource.

Page 7: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

7

13An Introduction to Web Semantic Technologies

<?xml version="1.0" encoding="UTF-16"?>

<rdf:RDF

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

xmlns:mydomain="http://www.mydomain.org/my-rdf-ns">

<rdf:Description rdf:about="http://www.cit.gu.edu.au/~db">

<mydomain:site-owner rdf:resource="#DavidBillington"/>

</rdf:Description>

</rdf:RDF>

Three Views of a Statement (Cont..)

Representing a statement about the resourcehttp://www.cit.gu.edu.au/∼db in XML

14An Introduction to Web Semantic Technologies

RDF Resource, Property, and Property Value

� Recalling that RDF identifies things using Web

identifiers (URIs), and describes resources with

properties and property values.

� What are Resource, Property, and Property value?

� A 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 "Juan

Pérez" or "http://www.w3schools.com" (note that a

property value can be another resource)

Page 8: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

8

15An Introduction to Web Semantic Technologies

RDF Statements

� The combination of a Resource, a Property, and aProperty value forms a Statement (known asthe subject, predicate and object of a Statement).

� These Statements are also known as Triples

(<http://…isbn…6682>, <http://…/original>, <http://…isbn…409X>)(<http://…isbn…6682>, <http://…/original>, <http://…isbn…409X>)

16An Introduction to Web Semantic Technologies

RDF triples (cont.)

� An RDF Triple (s,p,o) is such that:

� “s”, “p” are URI-s, ie, resources on the Web; “o” is a URI

or a literal

� Here is a complete triple:

� RDF is a general model for such triples

� with machine readable formats like RDF/XML, Turtle, N3, RDFa, …

Example, Statement: "The author of http://www.w3schools.com/rdf is Jan Egil Refsnes".The subject of the statement is: http://www.w3schools.com/rdfThe predicate (or property) is: authorThe object is: Jan Egil Refsnes

Statement: "The homepage of http://www.w3schools.com/rdf is http://www.w3schools.com".

The subject of the statement above is: http://www.w3schools.com/rdfThe predicate is: homepageThe object is: http://www.w3schools.com

Page 9: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

9

17An Introduction to Web Semantic Technologies

RDF Data Model

� Directed labeled graphs

� Model elements

� Resource

� Property

� Property value

� Statement

18An Introduction to Web Semantic Technologies

RDF Model Primitives

Resource Value

Property

Statement

Page 10: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

10

19An Introduction to Web Semantic Technologies

RDF Model Example

page.html

John Smith

John’s Home Page

20An Introduction to Web Semantic Technologies

2-Nov-1998/swick

20

Basic Example

page.html

John Smith

John’s Home Page

Page 11: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

11

21An Introduction to Web Semantic Technologies

2-Nov-1998/swick

21

Basic RDF Example

<?xml version=“1.0”?>

<rdf:RDF

xmlns:rdf=“http://www.w3.org/TR/WD-rdf-syntax#”

xmlns:dc=“http://purl.org/metadata/dublin_core#”>

<rdf:Description about=“page.html”>

<dc:Creator>John Smith</dc:Creator>

<dc:Title>John’s Home Page</dc:Title>

</rdf:Description>

</rdf:RDF>

22An Introduction to Web Semantic Technologies

Structured Value

page.html

John’s Home Page

Title

Creator

John Smith [email protected]

Name Email

Page 12: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

12

23An Introduction to Web Semantic Technologies

Structured Value Example

page.html

John SmithJohn’s Home Page [email protected]

dc:Title

dc:Creator

Name Email

24An Introduction to Web Semantic Technologies

2-Nov-1998/swick

24

Structured Value Example - 1

<?xml version=“1.0”?>

<RDFxmlns=“http://www.w3.org/TR/WD-rdf-syntax#”xmlns:dc=“http://purl.org/metadata/dublin_core#”xmlns:corp=“http://mycorp.com/corpSchema/”>

. . .

Preamble:

Page 13: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

13

25An Introduction to Web Semantic Technologies

2-Nov-1998/swick

25

Structured Value Example - 2

. . .<Description about=“page.html”>

<dc:Creator><Description>

<corp:Name>John Smith</corp:Name><corp:Email>[email protected]</corp:Email>

</Description></dc:Creator><dc:Title>John’s Home Page</dc:Title>

</Description></RDF>

URI Resource 1 (R1)

Description Resource 2(value of resource 1)

Properties (R1)

Statement about page.html

26An Introduction to Web Semantic Technologies

2-Nov-1998/swick

26

Abbreviations: 1

<rdf:RDF><rdf:Description about=“page.html”>

<dc:Creator><rdf:Description

corp:Name=“John Smith”corp:Email=“[email protected]

/></dc:Creator><dc:Title>John’s Home Page</dc:Title>

</rdf:Description></rdf:RDF>

Page 14: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

14

27An Introduction to Web Semantic Technologies

2-Nov-1998/swick

27

Abbreviations: 2

<rdf:RDF><rdf:Description about=“page.html”>

<dc:Creatorcorp:Name=“John Smith”corp:Email=“[email protected]” />

<dc:Title>John’s Home Page</dc:Title></rdf:Description>

</rdf:RDF>

28An Introduction to Web Semantic Technologies

RDF:ABOUT/RDF:RESOURCE/RDF:ID

How do we introduce subject and object URIs in RDF/XML?

rdf:about sets the subject URI of a statement, which may be absolute(http://example.com/) or resolved relative to the BASE of the document(e.g. /foo/bar, #frag). (Like href in html):

<?xml version="1.0" encoding="UTF-8"?><rdf:RDF

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/elements/1.1/"xml:base="http://spam.com/foo/"

>

rdf:resource sets the object URI of a statement, once again either absolute orrelative.

rdf:ID sets the subject URI, but it can only be within this document. An ID can alsoonly be used once. Very like <a name=“anchor"> or id=“anchor" in html.rdf:ID is discouraged since you can replace it with an rdf:about or rdf:resource with afragment #anchor and it can cause xml issues if you use the same id more than once.That is, it's redundant and a potential source of errors.

Page 15: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

15

29An Introduction to Web Semantic Technologies

Reification

� In RDF it is possible to make statements aboutstatements.

� Example: Grigoris believes that David Billington is thecreator of the Web pagehttp://www.cit.gu.edu.au/∼db.

� This kind of statement can be used to describe belief ortrust in other statements, which is important in somekinds of applications.

� The solution is to assign a unique identifier to eachstatement, which can be used to refer to thestatement.

� RDF allows this using a reification mechanism

30An Introduction to Web Semantic Technologies

Reification (Cont..)

� Example: Let´s take the next Description<rdf:Description rdf:about="949352">

<uni:name>Grigoris Antoniou</uni:name></rdf:Description>

<rdf:Statement rdf:about="StatementAbout949352"><rdf:subject rdf:resource="949352"/><rdf:predicate rdf:resource="&uni;name"/><rdf:object>Grigoris Antoniou</rdf:object>

</rdf:Statement>

We can give an ID (reify) to the previous statement :

Page 16: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

16

31An Introduction to Web Semantic Technologies

Meta-description

page.htmlCost

$0.15

18-Apr-2013

ValidUntil

32An Introduction to Web Semantic Technologies

Property Reification

page.htmlCost

$0.15

18-Apr-2013

ValidUntil

ObjectSubject

type

StatementCost

Predicate

Page 17: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

17

33An Introduction to Web Semantic Technologies

2-Nov-1998/swick

33

Meta-description Example - 1

<?xml version=“1.0”?>

<RDF

xmlns:rdf

=“http://www.w3.org/TR/WD-rdf-syntax#”

xmlns:corp

=“http://mycorp.com/schema/”>

. . .

34An Introduction to Web Semantic Technologies

2-Nov-1998/swick

34

Meta-description Example - 2

. . .<rdf:Description about=“page.html”

bagID=“D_001”><corp:Cost>$0.15</corp:Cost>

</rdf:Description>

<rdf:Description aboutEach=“#D_001”><corp:ValidUntil>18-Apr-2013</corp:ValidUntil>

</rdf:Description>

</rdf:RDF>

Page 18: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

18

35An Introduction to Web Semantic Technologies

2-Nov-1998/swick

35

Meta-description Example - 3

<rdf:RDF>

<rdf:Description about=“page.html”

bagID=“D_001”

corp:Cost=“$0.15”/>

<rdf:Description aboutEach=“#D_001”

corp:ValidUntil=“18-Apr-1999”/>

</rdf:RDF>

36An Introduction to Web Semantic Technologies

Data Types

� Programs need to know how to interpret a resource

� Example, how to know that a literal represents an age:

(#DavidBillington, http://www.mydomain.org/age,"27"^^http://www.w3.org/2001/XMLSchema#integer )

To define 2 categories (course and lecturer):

<rdf:Description rdf:about="CIT1111"><rdf:type rdf:resource="&uni;course"/><uni:courseName>Discrete Mathematics</uni:courseName><uni:isTaughtBy rdf:resource="949318"/>

</rdf:Description>

<rdf:Description rdf:about="949318"><rdf:type rdf:resource="&uni;lecturer"/><uni:name>David Billington</uni:name><uni:title>Associate Professor</uni:title>

</rdf:Description>

Page 19: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

19

37An Introduction to Web Semantic Technologies

A simple RDF example (in RDF/XML)

<rdf:Description rdf:about="http://…/isbn/2020386682"><f:titre xml:lang="fr">Le palais des mirroirs</f:titre><f:original rdf:resource="http://…/isbn/000651409X"/>

</rdf:Description>

<rdf:Description rdf:about="http://…/isbn/2020386682"><f:titre xml:lang="fr">Le palais des mirroirs</f:titre><f:original rdf:resource="http://…/isbn/000651409X"/>

</rdf:Description>

(Note: namespaces are used to simplify the URI-s)

http://…isbn/2020386682

Le palais des miroirs http://…isbn/000651409X

38An Introduction to Web Semantic Technologies

A simple RDF example (in Turtle)

<http://…/isbn/2020386682>f:titre "Le palais des mirroirs"@fr ;f:original <http://…/isbn/000651409X> .

<http://…/isbn/2020386682>f:titre "Le palais des mirroirs"@fr ;f:original <http://…/isbn/000651409X> .

http://…isbn/2020386682

Le palais des miroirs http://…isbn/000651409X

Page 20: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

20

39An Introduction to Web Semantic Technologies

A simple RDF example (in RDFa)

<p about="http://…/isbn/2020386682">The book entitled“<span property="f:title" lang="fr">Le palais des mirroirs</span>” is the French translation of the “<span rel="f:original" resource="http://…/isbn/000651409X">GlassPalace</span>”</p> .

<p about="http://…/isbn/2020386682">The book entitled“<span property="f:title" lang="fr">Le palais des mirroirs</span>” is the French translation of the “<span rel="f:original" resource="http://…/isbn/000651409X">GlassPalace</span>”</p> .

http://…isbn/2020386682

Le palais des miroirs http://…isbn/000651409X

40An Introduction to Web Semantic Technologies

“Internal” nodes

� Consider the following statement:

� “the publisher is a «thing» that has a name and an

address (city)”

� Until now, nodes were identified with a URI. But…

� …what is the URI of «thing»?

London

Harper Collins

a:publisherhttp://…isbn/000651409X

Page 21: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

21

41An Introduction to Web Semantic Technologies

One solution: create an extra URI

� The resource will be “visible” on the Web

� care should be taken to define unique URI-s

<rdf:Description rdf:about="http://…/isbn/000651409X"><a:publisher rdf:resource="urn:uuid:f60ffb40-307d-…"/>

</rdf:Description><rdf:Description rdf:about="urn:uuid:f60ffb40-307d-…">

<a:p_name>HarpersCollins</a:p_name><a:city>HarpersCollins</a:city>

</rdf:Description>

<rdf:Description rdf:about="http://…/isbn/000651409X"><a:publisher rdf:resource="urn:uuid:f60ffb40-307d-…"/>

</rdf:Description><rdf:Description rdf:about="urn:uuid:f60ffb40-307d-…">

<a:p_name>HarpersCollins</a:p_name><a:city>HarpersCollins</a:city>

</rdf:Description>

42An Introduction to Web Semantic Technologies

Internal identifier (“blank nodes”)

<rdf:Description rdf:about="http://…/isbn/000651409X"><a:publisher rdf:nodeID="A234"/>

</rdf:Description><rdf:Description rdf:nodeID="A234">

<a:p_name>HarpersCollins</a:p_name><a:city>HarpersCollins</a:city>

</rdf:Description>

<rdf:Description rdf:about="http://…/isbn/000651409X"><a:publisher rdf:nodeID="A234"/>

</rdf:Description><rdf:Description rdf:nodeID="A234">

<a:p_name>HarpersCollins</a:p_name><a:city>HarpersCollins</a:city>

</rdf:Description>

<http://…/isbn/2020386682> a:publisher _:A234._:A234 a:p_name "HarpersCollins".<http://…/isbn/2020386682> a:publisher _:A234._:A234 a:p_name "HarpersCollins".

Internal = these resources are not visible outside

London

Harper Collins

a:publisherhttp://…isbn/000651409X

Page 22: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

22

43An Introduction to Web Semantic Technologies

RDF in programming practice

� For example, using Java+Jena (HP’s Bristol Lab):

� a “Model” object is created

� the RDF file is parsed and results stored in the Model

� the Model offers methods to retrieve:

� triples

� (property,object) pairs for a specific subject

� (subject,property) pairs for specific object

� etc.

� the rest is conventional programming…

� Similar tools exist in Python, PHP, etc.

44An Introduction to Web Semantic Technologies

Apache Jena ( http://jena.apache.org/ )RDF

� RDF API

� Interact with the core API to create and read Resource Description Framework (RDF) graphs. Serialise your triples using

popular formats such as RDF/XML or Turtle.

� ARQ (SPARQL)

� Query your RDF data using ARQ, a SPARQL 1.1compliant engine. ARQ supports remote federated queries and free text

search.

Triple store

� TDB

� Persist your data using TDB, a native high performance triple store. TDB supports the full range of Jena APIs.

� Fuseki

� Expose your triples as a SPARQL end-point accessible over HTTP. Fuseki provides REST-style interaction with your RDF

data.

OWL

� Ontology API

� Work with models, RDFS and the Web Ontology Language (OWL) to add extra semantics to your RDF data.

� Inference API

� Reason over your data to expand and check the content of your triple store. Configure your own inference rules or use

the built-in OWL and RDFS reasoners.

Page 23: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

23

45An Introduction to Web Semantic Technologies

Jena example

// create a modelModel model=new ModelMem();Resource subject=model.createResource("URI_of_Subject")// 'in' refers to the input filemodel.read(new InputStreamReader(in));StmtIterator iter=model.listStatements(subject,null,null);while(iter.hasNext()) {

st = iter.next();p = st.getProperty();o = st.getObject();do_something(p,o);

}

// create a modelModel model=new ModelMem();Resource subject=model.createResource("URI_of_Subject")// 'in' refers to the input filemodel.read(new InputStreamReader(in));StmtIterator iter=model.listStatements(subject,null,null);while(iter.hasNext()) {

st = iter.next();p = st.getProperty();o = st.getObject();do_something(p,o);

}

46An Introduction to Web Semantic Technologies

Another relatively simple application

� Goal: reuse of older experimental data

� Keep data in databases or XML, just export key “fact” as RDF

� Use a faceted browser* to visualize and interact with the result

*Exhibit: http://www.simile-widgets.org/exhibit/

Page 24: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

24

47An Introduction to Web Semantic Technologies

One level higher up(RDFS, Datatypes)

48An Introduction to Web Semantic Technologies

Need for RDF schemas

� First step towards the “extra knowledge”:

� define the terms we can use

� what restrictions apply

� what extra relationships are there?

� Officially: “RDF Vocabulary Description Language”

� the term “Schema” is retained for historical reasons…

Page 25: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

25

49An Introduction to Web Semantic Technologies

RDF Schema (RDFS) - The RDF Vocabulary

Description Language

� RDF Schema ‘semantically extends’ RDF to

enable us to talk about classes of resources, and

the properties that will be used with them.

� It does this by giving special meaning to certain

rdf properties and resources.

� RDF Schema provides the means to describe

application specific RDF vocabularies.

50An Introduction to Web Semantic Technologies

Describing Classes with RDFS

� To describe classes we can use built in RDF

Schema resources:

� rdfs:Class

� rdfs:subClassOf

� These are used in conjunction with the

rdf:type property.

Page 26: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

26

51An Introduction to Web Semantic Technologies

Describing Properties with RDF(S)� RDF Schema allows us to describe

properties. (Properties are instances of the

class rdf:Property!)

� We can specify a domain using

rdfs:domain.

� We can specify a range using rdfs:range.

52An Introduction to Web Semantic Technologies

Other RDFS Built-In Properties

� rdfs:subPropertyOf

� rdfs:comment

� rdfs:label

� rdfs:seeAlso

� rdfs:isDefinedBy

Page 27: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

27

53An Introduction to Web Semantic Technologies

Classes, resources, …

� Think of well known traditional vocabularies:

� use the term “novel”

� “every novel is a fiction”

� “«The Glass Palace» is a novel”

� etc.

� RDFS defines resources and classes:

� everything in RDF is a “resource”

� “classes” are also resources, but…

� …they are also a collection of possible resources (i.e., “individuals”)

� “fiction”, “novel”, …

54An Introduction to Web Semantic Technologies

Classes, resources, … (cont.)

� Relationships are defined among resources:

� “typing”: an individual belongs to a specific class

� “«The Glass Palace» is a novel”

� to be more precise: “«http://.../000651409X» is a novel”

� “subclassing”: all instances of one are also the instances

of the other (“every novel is a fiction”)

� RDFS formalizes these notions in RDF

Page 28: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

28

55An Introduction to Web Semantic Technologies

Classes, resources in RDF(S)

� RDFS defines the meaning of these terms

� (these are all special URI-s, we just use the namespace

abbreviation)

rdf:type#Novelhttp://…isbn/000651409X

rdfs:Class

56An Introduction to Web Semantic Technologies

Inferred properties

� is not in the original RDF data…

� …but can be inferred from the RDFS rules

� RDFS environments return that triple, too

(<http://…/isbn/000651409X> rdf:type #Fiction)(<http://…/isbn/000651409X> rdf:type #Fiction)

rdf:type#Novelhttp://…isbn/000651409X

#Fiction

Page 29: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

29

57An Introduction to Web Semantic Technologies

Inference: let us be formal…

� The RDF Semantics document has a list of (33)

entailment rules:

� “if such and such triples are in the graph, add this and

this”

� do that recursively until the graph does not change

� The relevant rule for our example:

If:uuu rdfs:subClassOf xxx .vvv rdf:type uuu .

Then add:vvv rdf:type xxx .

If:uuu rdfs:subClassOf xxx .vvv rdf:type uuu .

Then add:vvv rdf:type xxx .

58An Introduction to Web Semantic Technologies

Properties

� Property is a special class (rdf:Property)

� properties are also resources identified by URI-s

� There is also a possibility for a “sub-property”

� all resources bound by the “sub” are also bound by the

other

� Range and domain of properties can be specified

� i.e., what type of resources serve as object and subject

Page 30: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

30

59An Introduction to Web Semantic Technologies

Example for property characterization

:titlerdf:type rdf:Property;rdfs:domain :Fiction;rdfs:range rdfs:Literal.

:titlerdf:type rdf:Property;rdfs:domain :Fiction;rdfs:range rdfs:Literal.

60An Introduction to Web Semantic Technologies

What does this mean?

� Again, new relations can be deduced. Indeed, if

:titlerdf:type rdf:Property;rdfs:domain :Fiction;rdfs:range rdfs:Literal.

<http://…/isbn/000651409X> :title "The Glass Palace" .

:titlerdf:type rdf:Property;rdfs:domain :Fiction;rdfs:range rdfs:Literal.

<http://…/isbn/000651409X> :title "The Glass Palace" .

<http://…/isbn/000651409X> rdf:type :Fiction .<http://…/isbn/000651409X> rdf:type :Fiction .

� then the system can infer that:

Page 31: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

31

61An Introduction to Web Semantic Technologies

Literals

� Literals may have a data type

� floats, integers, booleans, etc, defined in XML Schemas

� full XML fragments

� (Natural) language can also be specified

62An Introduction to Web Semantic Technologies

Examples for datatypes

<http://…/isbn/000651409X>:page_number "543"^^xsd:integer ;:publ_date "2000"^^xsd:gYear ;:price "6.99"^^xsd:float .

<http://…/isbn/000651409X>:page_number "543"^^xsd:integer ;:publ_date "2000"^^xsd:gYear ;:price "6.99"^^xsd:float .

Page 32: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

32

63An Introduction to Web Semantic Technologies

How to get and create RDF Data?

64An Introduction to Web Semantic Technologies

Simple approach

� Write RDF/XML, RDFa, or Turtle “manually”

� In some cases that is necessary, but it really does

not scale…

Page 33: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

33

65An Introduction to Web Semantic Technologies

RDF with XHTML

� Obviously, a huge source of information

� By adding some “meta” information, the same

source can be reused for, eg, data integration,

better mashups, etc

� typical example: your personal information, like address,

should be readable for humans and processable by

machines

66An Introduction to Web Semantic Technologies

RDF with XML/(X)HTML (cont)

� Two solutions have emerged:

� use microformats and convert the content into RDF

� XSLT is the favorite approach

� add RDF-like statements directly into XHTML via RDFa

Page 34: Resource Description Framework RDF - CINVESTAV · 2017. 7. 7. · Resource Description Framework (RDF) A framework for describing resources on the web What is a resource? The answer

07/07/2017

34

67An Introduction to Web Semantic Technologies

Bridge to relational databases

� Data on the Web are mostly stored in databases

� “Bridges” are being defined:

� a layer between RDF and the relational data

� RDB tables are “mapped” to RDF graphs, possibly on the fly

� different mapping approaches are being used

� a number RDB systems offer this facility already (eg,

Oracle, OpenLink, …)

� W3C has some work on this area:

https://www.w3.org/2001/sw/rdb2rdf/

68An Introduction to Web Semantic Technologies

RDB2RDF Translation approaches and tools

� Check out this technical report:

https://credible.i3s.unice.fr/lib/exe/fetch.php?media=credible-13-2-v1-rdb2rdf.pdf

A survey of RDB to RDF translation approaches and tools.Franck Michel et al.