The Semantic Web –
WEEK 4: RDF
Tutorial/Practical: Exercises using
the Suns
Lee McCluskey
NB most examples below courtesy of
the RDF Primer WC3 document
Recap
Last week we saw how complex data structures
can be SPECIFIED in XML Schema documents.
These are then used as the validating
definitions of XML documents. The elements
defined in the Schema give us a ‘namespace’.
XML Schema are considered better than DTD’s
as they are XML docs, they are more
expressive etc
The Semantic Web
RDF - the Resource Description Framework
The web is like an enormous library with no
structure.
The purpose of RDF is to act as a uniform or
standard language for describing and
representing information about Web
resources or things identifiable on the Web.
This will mean a change from the current
‘brute force’ search engines to much more
powerful services…
The Semantic Web
RDF vs XML
Main difference between XML and RDF (and
higher level languages like OWL)
RDF/ RDFS have a FIXED and pre-defined set
of tags -XML does not.
For scalability, we need a fairly standard format
for documents (eg RDF’s list of triples).
RDF application area more specific than XML –
describing properties of ‘web resources’
The Semantic Web
RDF - basis
everything having a URI = Universal Resource
Identifier
Properties - resources with a ‘name’ such as slots in an
object frame
An RDF document is a series of Statements which are
triples -
(Resource, Property, Value)
Or (Subject, Predicate, Object)
NB the Property/Predicate is NOT functional – there can
be many values for the same resource+property
The Semantic Web
RDF example
RDF ~ set of (Resource, Property, Value)
"The Author of
http://scom.hud.ac.uk/scomtlm/Artform/planning.html
is Lee McCluskey.”
IN RDF:
<rdf:Description about=
http://scom.hud.ac.uk/scomtlm/Artform/planning.html'>
<Author> Lee McCluskey </Author>
</rdf:Description>
Resource, Property, Values can all have URI’s
The Semantic Web
RDF example
http://scom.hud.ac.uk/scomtlm/Artform/planning.html
The orange box
denotes a literal -
Author literals may not be
used as subjects or
predicates in RDF
Lee McCluskey statements, only
objects.
The Semantic Web
RDF - QNames
RDF (and XML) docs rely on short hand to keep
their size down. One mechanism is called the
Qualified Name or QName.
Example:
Start of document we might have..
fred = http://www.w3.org/1999/02/22-rdf-syntax-ns#
Then where ever we see ‘fred:subject’ we read
http://www.w3.org/1999/02/22-rdf-syntax-ns#subject
The Semantic Web
RDF - QNames
Common QNames used throughout the semantic web:
rdf: refers to namespace URI: http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: refers to namespace URI: http://www.w3.org/2000/01/rdf-schema#
owl: refers to namespace URI: http://www.w3.org/2002/07/owl#
xsd: refers to namespace URI: http://www.w3.org/2001/XMLSchema#
dc: refers to namespace URI: http://purl.org/dc/elements/1.1/
dc is the ‘Dublin Core’ – meta data convention for describing documents
The Semantic Web
RDF example
Example below shows..
Multiple property/values shorthand
Value that is a URI is an attribute
[example 1]
<rdf:Description rdf:about="http://scom.hud.ac.uk/index.html">
<exterms:creation-date>August 16, 1999
</exterms:creation-date>
<dc:language>en</dc:language>
<dc:creator
rdf:resource="http://www.hud.ac.uk/staffid/85740"/>
</rdf:Description>
Here ‘exterms’ is some pre-defined vocabulary ..
The Semantic Web
Examples - rdf:type’s
.. are properties that describe the resources as instances of specific types or classes
[example 2]
<rdf:Description rdf:ID="item10245">
<rdf:type rdf:resource="http://www.example.com/terms/Tent"/>
<exterms:model rdf:datatype="&xsd;string">Overnighter</exterms:model>
<exterms:sleeps rdf:datatype="&xsd;integer">2</exterms:sleeps>
<exterms:weight rdf:datatype="&xsd;decimal">2.4</exterms:weight>
<exterms:packedSize rdf:datatype="&xsd;integer">784</exterms:packedSize>
</rdf:Description>
OR……………………
[example 3]
<exterms:Tent rdf:ID="item10245">
<exterms:model rdf:datatype="&xsd;string">Overnighter</exterms:model>
<exterms:sleeps rdf:datatype="&xsd;integer">2</exterms:sleeps>
<exterms:weight rdf:datatype="&xsd;decimal">2.4</exterms:weight>
<exterms:packedSize rdf:datatype="&xsd;integer">784</exterms:packedSize>
</exterms:Tent>
The Semantic Web
<?xml version="1.0"?>
<rdf:RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:contact = "http://www.w3.org/2000/10/swap/pim/contact#">
<contact:Person rdf:about="http://www.w3.org/People/EM/contact#me">
from W3C RDF <contact:fullName>Eric Miller </contact:fullName>
Primer [example4]
<contact:mailbox rdf:resource="mailto:
[email protected]"/>
<contact:personalTitle>Dr. </contact:personalTitle>
</contact:Person>
The Semantic Web
</rdf:RDF>
Blank Nodes
RDF allows only Binary Predicates
This can cause problems where an object has a
property that has many facets eg
Person’s address
Person’s DoB …../:fred_bloggs
Date:month Date:year
june 1931
The Semantic Web
[example 5]
<?xml version="1.0"?> Example from “W3C RDF Primer”
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-
syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:exterms="http://example.org/stuff/1.0/">
<rdf:Description
rdf:about="http://www.w3.org/TR/rdf-
syntax-grammar">
<dc:title>
RDF/XML Syntax Specification (Revised)
</dc:title>
<exterms:editor rdf:nodeID="abc"/>
</rdf:Description>
<rdf:Description rdf:nodeID="abc">
<exterms:fullName>Dave
Beckett</exterms:fullName>
<exterms:homePage rdf:resource=http://
purl.org/net/dajobe/ />
</rdf:Description>
</rdf:RDF>
The Semantic Web
RDFS -
RDF Schema = RDF + classes, properties of
properties, etc - gives more structure to RDF
RDF is expanded by new tags such as
rdf:Class
rdf:Property
rdf:label
which allow vocabulary – schema to be written
(in a similar manner to xml schema)
The Semantic Web
Vocabularies….
RDF/RDFS allows anyone to write their own
name-space document (a ‘schema’). This
defines properties and classes in some
application domain
These form vocabularies which can be used
globally for sharing the meaning of tags
The Semantic Web
..and Ontologies
Vocabularies are like Ontologies….!
An Ontology is a
formalised conceptual structure
The Semantic Web
Summary
RDF is a standard language for describing
meta-data for the web.
It is an XML application.
It consists, basically, of sets of triples
(statements) of the form
“subject, predicate, object”
RDF Schema is a way of introducing
classes/instances of resources
The Semantic Web