Reading:
Software:
The lab is divided into sections. You should allow aprox. 10 minutes for each section. However, note that the tasks are increasingly difficult and latter sections may be more time-consuming than the former ones.
Statements
<subject>
, <predicate>
and <object>
http://home.agh.edu.pl/~wta/foaf.rdf
. Analyze the RDF/XML code and the graphical representation. RDF document is an RDF graph (describing some objects) serialized into chosen representation/syntax. Here we will use the RDF/XML syntax for RDF.
Your task will be to create an RDF description of you multimedia library. It can contain CDs, DVDs, books etc. The documents created during this lab will be used in the subsequent labs.
a) Create a text document and save it as mylibrary.rdf
.
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <!-- Body Code Omitted --> </rdf:RDF>
NB: Note the http://www.w3.org/1999/02/22-rdf-syntax-ns#
namespace used in the document.
b) Add statements: Add RDF statements about items in your multimedia library, e.g.:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="http://example.org/mylibrary#book-semwebprimer"> <!-- Statement Code Omitted --> </rdf:Description> <rdf:Description rdf:about="http://example.org/mylibrary#cd-opeth_damnation"> <!-- Statement Code Omitted --> </rdf:Description> </rdf:RDF>
The rdf:Description
tag means you're going to describe something (a subject) and giving it a unique ID: http://example.org/mylibrary#your-book-id
.
c) Add predicates: define some properties of the items and fill in their values, e.g.:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://example.org/mylibrary#"> <rdf:Description rdf:about="http://example.org/mylibrary#book-semwebprimer"> <author>Grigoris Antoniou</author> <author>Frank van Harmelen</author> <title>A Semantic Web Primer</title> </rdf:Description> <rdf:Description rdf:about="http://example.org/mylibrary#cd-opeth_damnation"> <artist>Opeth</artist> <title>Damnation</title> </rdf:Description> </rdf:RDF>
Define your namespace (see the 3. line).
In RDF there are two ways to describe set or sequences of objects: Containters and Collections.
rdf:Bag
rdf:Seq
rdf:Alt
”MyFavouriteBooks
and fill it with the URIs of the books you like the most. (see here for hints and examples)Add the references to XML Schema datatypes to chosen information in your RDF file, e.g.:
<rdf:Description rdf:about="http://example.org/mylibrary#book-semwebprimer"> <author>Grigoris Antoniou</author> <author>Frank van Harmelen</author> <title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A Semantic Web Primer</title> <publicationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-10-09</publicationDate> </rdf:Description>
RDF Schema allows to organize objects into classes, define simple taxonomies, as well as classes' domains and ranges.
<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://example.org/mylibrary#"> <rdfs:Class rdf:ID="MultimediaItem" /> <rdfs:Class rdf:ID="MusicCD"> <rdfs:subClassOf rdf:resource="#MultimediaItem"/> <rdfs:label>Music Compact Discs class</rdfs:label> <rdfs:comment>Class of all the CDs in my library.</rdfs:comment> </rdfs:Class> <rdfs:Class rdf:ID="Book"> <rdfs:subClassOf rdf:resource="#MultimediaItem"/> </rdfs:Class> </rdf:RDF>
Add the rdf:type
statements to your RDF file, e.g.:
<rdf:Description rdf:about="http://example.org/mylibrary#cd-opeth_damnation"> <artist>Opeth</artist> <title>Damnation</title> <rdf:type rdf:resource="http://example.org/mylibrary#MusicCD"/> </rdf:Description>
Semantic vocabularies are sets of predefined properties for describing some domains. Examples include:
<rdf:Description rdf:about="http://example.org/mylibrary#book-semwebprimer"> <author>Grigoris Antoniou</author> <author>Frank van Harmelen</author> <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A Semantic Web Primer</dc:title> <dc:date rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-10-09</dc:date> <dc:publisher>The MIT Press</dc:publisher> <dc:language>en</dc:language> </rdf:Description>
FOAF (Friend-of-a-friend) is a semantic vocabulary for describing people and their connections.
student.agh.edu.pl
) so that it can be referenced with URL.piw2011
, for password ask the teacher):<foaf:knows>
section. Visualize again. Navigate to your friends' FOAF files.<rdf:Description>
<rdf:about>
<rdf:resource>
<rdf:type>
Reading:
Slides:
Tools: