resource description framework (rdf) lecture # 6 faculty of computer science, iba

20
Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Upload: hillary-townsend

Post on 24-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Resource Description Framework (RDF)

Lecture # 6

Faculty of Computer Science, IBA

Page 2: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

2

RDF

• Fundamental concept of RDF are– Resource– Properties– Statements

Quratulain

resource valueproperty

Page 3: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 3

RDF:resource• We can denote that two entities are the same using the rdf:resource

attribute. For example

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:xsd="http://www.w3.org/2001/XLMSchema#"xmlns:uni="http://www.mydomain.org/uni-ns">

<rdf:Description rdf:about="CSE661"><uni:courseName>Semantic Web</uni:courseName><uni:isTaughtBy rdf:resource=“FAC949"/>

</rdf:Description>

<rdf:Description rdf:about=“FAC949"><uni:name>Quratulain</uni:name><uni:title>Assistant Professor</uni:title>

</rdf:Description>

Page 4: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 4

Nested Descriptions: Example<rdf:Description rdf:about="CSE661">

<uni:courseName>Semantic Web</uni:courseName><uni:isTaughtBy>

<rdf:Description rdf:ID=“FAC949"><uni:name>Sana</uni:name><uni:title>Associate Professor</uni:title></rdf:Description>

</uni:isTaughtBy></rdf:Description>

• Although a descriptions defined within another description, its scope is global.

Page 5: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 5

Rdf:type Element<rdf:Description rdf:ID=“CSE661">

<rdf:type rdf:resource="http://www.iba.edu.pk/uni-ns#course"/><uni:courseName>Semantic Web</uni:courseName><uni:isTaughtBy rdf:resource="#FAC949"/>

</rdf:Description>

<rdf:Description rdf:ID=“FAC949"><rdf:type rdf:resource="http://www.iba.edu.pk/uni-ns#lecturer"/>

<uni:name>Sana</uni:name><uni:title>Associate Professor</uni:title>

</rdf:Description>

Page 6: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 6

Abbreviated Syntax

• Simplification rules:1. Childless property elements within description

elements may be replaced by XML attributes2. For description elements with a typing element we can

use the name specified in the rdf:type element instead of rdf:Description

• These rules create syntactic variations of the same RDF statement– They are equivalent according to the RDF data model,

although they have different XML syntax

Page 7: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 7

Abbreviated Syntax: Example of rule#1

<rdf:Description rdf:ID="CSE661"> <rdf:type rdf:resource="http://www.iba.edu.pk/uni-ns#course"/>

<uni:courseName>Semantic Web</uni:courseName><uni:isTaughtBy rdf:resource="#FAC949"/>

</rdf:Description>

<rdf:Description rdf:ID="CSE661“ uni:courseName=“Semantic Web"> <rdf:type rdf:resource="http://www.iba.edu.pk/uni-ns#course"/><uni:isTaughtBy rdf:resource="#FAC949"/>

</rdf:Description>

Page 8: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 8

Abbreviated Syntax: Example of rule#2

<rdf:Description rdf:ID="CSE661"> <rdf:type rdf:resource="http://www.iba.edu.pk/uni-ns#course"/>

<uni:courseName>Semantic Web</uni:courseName><uni:isTaughtBy rdf:resource="#FAC949"/>

</rdf:Description>

<uni:course rdf:ID="CSE661"uni:courseName=“Semantic Web">

<uni:isTaughtBy rdf:resource="#FAC949"/></uni:course>

Page 9: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 9

Syntactic variation of same RDF statement

<rdf:Description rdf:ID="CSE661"> <rdf:type rdf:resource="http://www.iba.edu.pk/uni-ns#course"/>

<uni:courseName>Semantic Web</uni:courseName><uni:isTaughtBy rdf:resource="#FAC949"/>

</rdf:Description>

<rdf:Description rdf:ID="CSE661“ uni:courseName=“Semantic Web"> <rdf:type rdf:resource="http://www.iba.edu.pk/uni-ns#course"/><uni:isTaughtBy rdf:resource="#FAC949"/>

</rdf:Description>

<uni:course rdf:ID="CSE661"uni:courseName=“Semantic Web">

<uni:isTaughtBy rdf:resource="#FAC949"/></uni:course>

Page 10: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 10

Container Elements

• Represents a group of resources or literals E.g., we may wish to talk about the courses given by a particular lecturer

• The content of container elements are named rdf:_1, rdf:_2, etc. or alternatively rdf:li

Page 11: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 11

Three Types of Container Elements

• rdf:Bag an unordered container, allowing multiple occurrences – E.g. members of the faculty board, documents in a folder

• rdf:Seq 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)• rdf:Alt a set of alternatives

– E.g. the document home and mirrors, translations of a document in various languages

Page 12: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 12

Example for a Bag <uni:lecturer rdf:ID= "FAC949" uni:name=« Atif"

uni:title="Professor"><uni:coursesTaught>

<rdf:Bag><rdf:_1 rdf:resource="#CSE101"/><rdf:_2 rdf:resource="#CSE206"/>

</rdf:Bag></uni:coursesTaught>

</uni:lecturer>

Page 13: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 13

Example for Alternative<uni:course rdf:ID=“CSE206"

uni:courseName=“Data Structures"><uni:lecturer>

<rdf:Alt><rdf:li rdf:resource="#FAC949"/><rdf:li rdf:resource="#FAC318"/>

</rdf:Alt></uni:lecturer>

</uni:course>

Page 14: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 14

Rdf:ID Attribute for Container Elements<uni:lecturer rdf:ID= "FAC949" uni:name="Asif">

<uni:coursesTaught><rdf:Bag rdf:ID="DBcourses">

<rdf:_1 rdf:resource="#CSE101"/><rdf:_2 rdf:resource="#CSE102"/>

</rdf:Bag></uni:coursesTaught>

</uni:lecturer>

Page 15: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 15

Question

Describe it using container?Referee(X,Y,Z) :

X is the referee in a chess game between players Y and Z

Page 16: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 16

RDF Collections• A limitation of these containers is that

there is no way to close them– “these are all the members of the container”

• RDF provides support for describing groups containing only the specified members, in the form of RDF collections – list structure in the RDF graph – constructed using a predefined collection

vocabulary: rdf:List, rdf:first, rdf:rest and rdf:nil

Page 17: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 17

RDF Collections • Shorthand syntax:– "Collection" value for the rdf:parseType

attribute:

<rdf:Description rdf:about="#CSE101"><uni:isTaughtBy rdf:parseType="Collection">

<rdf:Description rdf:about=“#FAC491"/><rdf:Description rdf:about="#FAC493"/><rdf:Description rdf:about="#FAC498"/>

</uni:isTaughtBy></rdf:Description>

Page 18: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 18

Reification

• In RDF it is possible to make statement about statement such as

Ahmed belief that hassan is the creator of the web page http://www.xyz.com

How would you do this?try.

RDF allow this using reification mechanism.

Page 19: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 19

Reification

pers05 ISBN...Author-of

NYT claims

<rdf:Description rdf:about=“#NYT”> <claims> <rdf:Description rdf:about=“#pers05”> <authorOf>ISBN...</authorOf> </rdf:Description> </claims></rdf:Description>

Any statement can be an objectgraphs can be nested - reification

Page 20: Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA

Quratulain 20

Reification

• RDF turns a statement into resource.

<rdf:Statement rdf:about=“Statementaboutpers05”> <rdf:subject rdf:resource=“#pers05”/> <rdf:predicate rdf:resource=“#authorOf”/> <rdf:object>ISBN</rdf:object></rdf:Statement>

<rdf:Description rdf:about=“#NYT”> <claims> <rdf:Description rdf:resource=“#Statementaboutpers05”/> </claims></rdf:Description>

<rdf:Description rdf:about=“#NYT”> <claims> <rdf:Description rdf:about=“#pers05”> <authorOf>ISBN...</authorOf> </rdf:Description> </claims></rdf:Description>