Más contenido relacionado
La actualidad más candente (19)
Similar a Pal gov.tutorial2.session5 1.rdf_jarrar (14)
Más de Mustafa Jarrar (20)
Pal gov.tutorial2.session5 1.rdf_jarrar
- 1. أكاديمية الحكومة اإللكترونية الفلسطينية
The Palestinian eGovernment Academy
www.egovacademy.ps
Tutorial II: Data Integration and Open Information Systems
Session 5.1
RDF
Resource Description Framework
Prof. Mustafa Jarrar
Sina Institute, University of Birzeit
mjarrar@birzeit.edu
www.jarrar.info
Reviewed by
Prof. Marco Ronchetti, Trento University, Italy
PalGov © 2011 1
- 2. About
This tutorial is part of the PalGov project, funded by the TEMPUS IV program of the
Commission of the European Communities, grant agreement 511159-TEMPUS-1-
2010-1-PS-TEMPUS-JPHES. The project website: www.egovacademy.ps
Project Consortium:
Birzeit University, Palestine
University of Trento, Italy
(Coordinator )
Palestine Polytechnic University, Palestine Vrije Universiteit Brussel, Belgium
Palestine Technical University, Palestine
Université de Savoie, France
Ministry of Telecom and IT, Palestine
University of Namur, Belgium
Ministry of Interior, Palestine
TrueTrust, UK
Ministry of Local Government, Palestine
Coordinator:
Dr. Mustafa Jarrar
Birzeit University, P.O.Box 14- Birzeit, Palestine
Telfax:+972 2 2982935 mjarrar@birzeit.eduPalGov © 2011
2
- 3. © Copyright Notes
Everyone is encouraged to use this material, or part of it, but should
properly cite the project (logo and website), and the author of that part.
No part of this tutorial may be reproduced or modified in any form or by
any means, without prior written permission from the project, who have
the full copyrights on the material.
Attribution-NonCommercial-ShareAlike
CC-BY-NC-SA
This license lets others remix, tweak, and build upon your work non-
commercially, as long as they credit you and license their new creations
under the identical terms.
PalGov © 2011 3
- 4. Tutorial Map
Topic h
Intended Learning Objectives
Session 1: XML Basics and Namespaces 3
A: Knowledge and Understanding
Session 2: XML DTD’s 3
2a1: Describe tree and graph data models.
Session 3: XML Schemas 3
2a2: Understand the notation of XML, RDF, RDFS, and OWL.
Session 4: Lab-XML Schemas 3
2a3: Demonstrate knowledge about querying techniques for data
models as SPARQL and XPath. Session 5: RDF and RDFs 3
2a4: Explain the concepts of identity management and Linked data. Session 6: Lab-RDF and RDFs 3
2a5: Demonstrate knowledge about Integration &fusion of Session 7: OWL (Ontology Web Language) 3
heterogeneous data. Session 8: Lab-OWL 3
B: Intellectual Skills Session 9: Lab-RDF Stores -Challenges and Solutions 3
2b1: Represent data using tree and graph data models (XML & Session 10: Lab-SPARQL 3
RDF). Session 11: Lab-Oracle Semantic Technology 3
2b2: Describe data semantics using RDFS and OWL. Session 12_1: The problem of Data Integration 1.5
2b3: Manage and query data represented in RDF, XML, OWL. Session 12_2: Architectural Solutions for the Integration Issues 1.5
2b4: Integrate and fuse heterogeneous data. Session 13_1: Data Schema Integration 1
C: Professional and Practical Skills Session 13_2: GAV and LAV Integration 1
2c1: Using Oracle Semantic Technology and/or Virtuoso to store Session 13_3: Data Integration and Fusion using RDF 1
and query RDF stores. Session 14: Lab-Data Integration and Fusion using RDF 3
D: General and Transferable Skills
2d1: Working with team. Session 15_1: Data Web and Linked Data 1.5
2d2: Presenting and defending ideas. Session 15_2: RDFa 1.5
2d3: Use of creativity and innovation in problem solving.
2d4: Develop communication skills and logical reasoning abilities. Session 16: Lab-RDFa 3
PalGov © 2011 4
- 6. What is XML
• Provides a common syntax for marking up documents.
• Easy to exchange between computers (web)
• Data model: an XML Document is an ordered labeled tree
(/collection of trees).
• W3C standard since 1997.
bookinfo
<bookInfo>
<title>Orientalism</title>
<author> title author
<persName>
<title>Prof.</title>
<foreName>Edward</foreName>
<surName>Said</surName> persNam
<roleName>University Professor e
<placeName>Columbia University
</placeName>
</roleName> title foreName surName roleName
</persName>
</author>
</bookInfo>
placeName
PalGov © 2011 6
- 7. XML Example
<address>
<name>Universsity of Birzeit</name>
<street>Almarj 435</street>
<town>Birzeit</town>
</address>
PalGov © 2011 7
- 8. Address Example: XML to XML
XML Markup 1:
<address>
<name>University of Birzeit</name>
<street>Almarj 435</street>
<town>Birzeit</town>
</address> XML stylesheets are
XML Markup 2: also usable to transform
<address> XML representations
<name>University of Birzeit</name>
<place>
<street>Almarj 435</street>
<town>Birzeit</town>
</place>
</address>
PalGov © 2011 8
- 9. Why XML is Not Enough
• It provides syntax, but not semantics, which is important when
exchanging/representing data over the Web.
<aaaa>
<bbbb>Universsity of Birzeit</aaaa>
<cccc>Almarj 435</cccc>
<dddd>Birzeit</dddd>
</aaaa>
• Not primitive. Same data can be represented in many ways, which is a
problem when exchanging/representing data over the Web.
<address> <address name=“University of Birzeit”>
<name>University of Birzeit</name> <street>Almarj 435</street>
<street>Almarj 435</street> <town>Birzeit</town>
<town>Birzeit</town> </address>
</address>
PalGov © 2011 9
- 10. What is RDF?
• RDF stands for Resource Description Framework.
• It is used for describing resources on the web.
• Makes use of URIs to identify web resources and is
written in XML.
• It is not a language but a framework
• You see it as a way of writing XML making it meaningful and more
primitive.
• You may see it independent, RDF data might never occur in XML form
• W3C standard since 1999
PalGov © 2011 10
- 11. Designed to be read by Computers
• RDF was designed to provide a common way to describe
information so it can be read (and understood) by
computer applications.
• RDF descriptions are not designed to be displayed on the
web.
PalGov © 2011 11
- 12. Makes use of URIs
• RDF uses a URI (Uniform Resource Identifier) to identify a
web resource, and properties to describe the resource
• Unlike URLs, URIs are not limited to identifying things that
have a network location.
• A URI reference (URIref) is a URI, together with an
optional fragment identifier at the end.
http://www.example.org/index.html#section2
PalGov © 2011 12
- 13. Example
:Author
http://www.amazon.com/Orientalism-Edward-W-Said/dp/039474067Xc Edward Said
11$ Orientalism
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#
xmlns:a="http://www.example.com"
xmlns:w="http://en.wikipedia.org/wiki/">
<rdf:Description rdf:about="http://www.amazon.com/Orientalism-Edward-W-Said/dp/039474067X">
<a:Title>Orientalism</a:Title>
<a:Price>11$</a:Price>
<a:Author>Edward_Said</a:Author>
</rdf:Description>
</rdf:RDF>
PalGov © 2011 13
- 14. Example
a:Author http://en.wikipedia.org/wiki/Edward_Said
http://www.amazon.com/Orientalism-Edward-W-Said/dp/039474067Xc
a:BirthCity
25/9/2003
11$ Orientalism Edward Saïd
1/11/1935
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# Jerusalem
xmlns:a="http://www.example.com/"
xmlns:w="http://en.wikipedia.org/wiki/">
<rdf:Description rdf:about="http://www.amazon.com/Orientalism-Edward-W-Said/dp/039474067X">
<a:Title>Orientalism</a:Title>
<a:Price>11$</a:Price>
<a:Author>
<rdf:Description rdf:about="w:Edward_Said">
<a:BirthCity>Jerusalem</a:BirthCity>
<a:BornAt>1/11/1935</a:BornAt>
<a:DiedA>25/9/2003</a:DiedA>
</rdf:Description>
</a:Author>
</rdf:Description>
</rdf:RDF>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
PalGov © 2011 14
- 15. Example
:Author http://en.wikipedia.org/wiki/Edward_Said
http://www.amazon.com/Orientalism-Edward-W-Said/dp/039474067Xc
:BirthCity
25/9/2003
<?xml version="1.0"?>
Orientalism
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
11$ Edward Saïd
xmlns:dc="http://purl.org/dc/elements/1.1/" 1/11/1935
xmlns:a="http://www.example.com#"
xmlns:w="http://en.wikipedia.org/wiki/"> http://en.wikipedia.org/wiki/Jerusalem
<rdf:Description rdf:about="http://www.amazon.com/Orientalism-Edward-W-Said/dp/039474067X">
<a:Title>Orientalism</a:Title>
<a:Price>11$</a:Price>
<a:Author>
<rdf:Description rdf:about="w:Edward_Said">
<a:BornAt>1/11/1935</a:BornAt>
<a:DiedA>25/9/2003</a:DiedA>
<a:BirthCity> 760800 Palestine
<rdf:Description rdf:about="http://en.wikipedia.org/wiki/Jerusalem">
<a:Population>760800</a:Population>
<a:CapitalOf>Palestine</a:CapitalOf>
</rdf:Description>
</a:BirthCity>
</rdf:Description>
</a:Author>
</rdf:Description>
</rdf:RDF>
PalGov © 2011 15
- 19. Example Explained
• In the example:
– the URI "http://www.w3schools.com/-default.asp" is
used to identify a web page,
– the property "author" describes the author of the page,
– the property value is "Jan Egil Refsnes".
– The property "created" tells when the page was
created, and the property "modified" when it was last
modified.
PalGov © 2011 19
- 20. Subject, Predicate & Object
• RDF terminology also use the words subject,
predicate and object.
• The resource http://www.w3schools.com/default.asp is
the subject
• The property "author" is the predicate
• The value "Jan Egil Refsnes" is the object
PalGov © 2011 20
- 21. RDF Important Concepts
• Data is represented in RDF as a directed labeled graph.
• An RDF graph is a set of triples, of the form <Subject, Predicate, Object>
Each Subject and each Predicate must be a URI; that is, it has to be a
unique identifier, not a literal. An Object can be either a URI or a literal.
PalGov © 2011 21
- 22. Example 2
<rdf:RDF>
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax ns#"
xmlns:cd="http://www.recshop.fake/cd">
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Empire Burlesque">
<cd:artist>Bob Dylan</cd:artist>
<cd:country>USA</cd:country>
<cd:company>Columbia</cd:company>
<cd:price>10.90</cd:price>
<cd:year>1985</cd:year>
</rdf:Description>
............
PalGov © 2011 22
- 23. Example 2 (cont)
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Hide your heart">
<cd:artist>Bonnie Tyler</cd:artist>
<cd:country>UK</cd:country>
<cd:company>CBS Records</cd:company>
<cd:price>9.90</cd:price>
<cd:year>1988</cd:year>
</rdf:Description>
</rdf:RDF>
PalGov © 2011 23
- 24. List of Triples (Table Representation)
Subject Predicate Object
http://www.recshop.fake/cd/Empire "Bob
http://www.recshop.fake/cdartist
Burlesque Dylan"
http://www.recshop.fake/cd/Empire http://www.recshop.fake/cdcount
"USA"
Burlesque ry
http://www.recshop.fake/cd/Empire http://www.recshop.fake/cdcomp
"Columbia"
Burlesque any
http://www.recshop.fake/cd/Empire
http://www.recshop.fake/cdprice "10.90"
Burlesque
http://www.recshop.fake/cd/Empire
http://www.recshop.fake/cdyear "1985"
Burlesque
PalGov © 2011 24
- 25. Details of the Example
• The first line in the XML file is the XML declaration, telling the version of
XML.
• The rdf:RDF element indicates that the content is RDF.
• The xmlns:rdf namespace, specifies that tags with the rdf: prefix are
from the namespace defined by "http://www.w3.org/1999/02/22-rdf-syntax-ns#".
• The xmlns:cd namespace, specifies that tags with the cd: prefix are
from the namespace defined by "http://www.recshop.fake/cd".
• The rdf:Description element contains the description of a resource
identified by the rdf:about attribute.
• The cd:artist element describes a property of the resource, and so
does cd:country, etc.
PalGov © 2011 25
- 26. Main RDF Properties and Attributes
Main RDF Properties
• rdf:subject The subject of the resource in an RDF Statement
• rdf:predicate The predicate of the resource in an RDF Statement
• rdf:object The object of the resource in an RDF Statement
• rdf:type The resource is an instance of a class
Main RDF Attributes
• rdf:RDF The root of an RDF document
• rdf:about Defines the resource being described
• rdf:Description Container for the description of a resource
• rdf:resource Defines a resource to identify a property
• rdf:datatype Defines the data type of an element
PalGov © 2011 26
- 27. RDF Validator
• Check the correctness of an RDF document:
http://www.w3.org/RDF/Validator/
• Result shows the subject, predicate and object of each
element of the document and a graph of the model.
PalGov © 2011 27
- 28. XML into RDF (Eaxmple)
<Article ID=B2 Year=“2005”> <Article ID=B3 Year=“2007”>
XML <XML> ID=B1 Year=“2000”>
<Article <Author href=“#A1”/> <Author ID=A3>
<Author ID=A1> <Author ID=A2> <email>ps@uoc</email>
<Name>Tom</Name> <Name>Bob</Name> <Affiliation href=“#UoC”/>
<Affiliation ID=UoM> <Affiliation ID=UoC> <Author>
<Name>University of Malta</Name> <Name>University of Cyprus</Name> </Article>
<Country ID=mt> <Country ID=cy> <Article ID=B4 Year=“2008”>
<Name> Malta</Name> <Name> Cyprus</Name> <Publisher ID=ACM/>
<Capital>Valletta</Capital> <Capital>Nicosia</Capital> </Article>
</Country> </Country> </XML>
</Affiliation> </Affiliation>
<Author> <Author>
</Article> </Article>
2000 Employs “University of Malta”
“Malta”
Author Affiliation County
B1 A1 UoM mt
“Tom” “Valletta”
Root
“Bob”
“Cyprus”
RDF
Article
B2 Affiliation County
A2 UoC cy
Employs
2005 “Nicosia”
B4 B3
A3 “University of Cyprus”
2008 ACM 2007 p3@uoc
PalGov © 2011 28
- 29. Database into RDF (Example)
RDF
S P O
:B1 rdf:Type :Article
:B1 :Title “Data Web”
Article
:B1 :Year 2007
ID Tile Year :B2 rdf:Type :Article
B1 Data Web 2007 :B2 :Title “Semantic Web”
Author B2 Semantic Web 2005
:B2 :Year 2005
Article Person
:B1 :Author :A1
Person :B1 :Author :A2
B1 A1 ID Name Affiliation :B2 :Author :A1
B1 A2 A1 Tom Lara UoM
:A1 rdf:Type :Person
B2 A2
:A1 :Name “Tom Lara”
A2 Bob Hacker UoC :A1 :Affiliation :UoM
Country Affiliation :A2 :Type :Person
ID Country
:A2 :Name “Bob Hacker”
ID Name :A2 :Affiliation :UoC
UoM mt
mt Malta :UoM :Type :University
UoC cy :UoM :Country :mt
cy Cyprus
:mt :Type :Country
:mt :Name “Malta”
:UoC :Type :University
:UoC :Country :cy
:cy :Type :Country
:cy :Name “Cyprus”
PalGov © 2011 29