Vous êtes sur la page 1sur 38

W E L C O M E !!!

• This is The Semantic Web tutorial


• Held at XML Finland 2001
• Purpose of this Tutorial is to initiate you to RDF
and related technologies
• We will build a simple RDF database and a
”Semantic Web in A Box” to bring home
• Enjoy the show, we’re ready to launch

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Agenda
• Preface
• Introduction to The Semantic Web
(”Why do we need The Semantic Web, what is wrong with Google ?”)

• Introduction to RDF and DC


• Write your own RDF
• An easy to use RDF repository
• Your own ”Semantic Web In A Box”
• Questions and hopefully answers

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Preface
• I assume you all know XML, DTD, XSLT etc.
• I assume you all know SQL, Java or ASP and web-
architecture
• I assume you will ask questions (I will)
• I assume we all (including me) will learn something new
today
• I assume we all will enjoy this session
• tsw@zorck.dk is my Semantic mail address

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to The
Semantic Web, 1
• From fixed structures to usefull building blocks
• Build on top of XML with RDF and ontologies
• Not a defined entity itself, many interpretations
• For me it is the idea of building the ”Next
Generation” Internet, where we will not just surf the
web, but work the web.
• The Schema is the API

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to The
Semantic Web, 2
• Overview of The Semantic Web
elements

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 1
• RDF overview
• http://www.w3.org/TR/REC-rdf-syntax/
• http://www.w3.org/TR/rdf-schema/
• Next few pages will cover RDF syntax and
principles

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 1.1.e
Jens Jakob Andersen is the author of the resource
http://www.zorck.dk/tsw/intro.xml

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-
ns#" xmlns:s="http://description.org/schema/">
<rdf:Description about="http://www.zorck.dk/tsw/intro.xml">
<s:Author>Jens Jakob Andersen</s:Author>
</rdf:Description>
</rdf:RDF>

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
[1]
[2]
DC, 1.1
RDF ::= ['<rdf:RDF>'] description* ['</rdf:RDF>']
description ::= '<rdf:Description' idAboutAttr? '>' propertyElt* '</rdf:Description>'
[3] idAboutAttr ::= idAttr | aboutAttr
[4] aboutAttr ::= 'about="' URI-reference '"'
[5] idAttr ::= 'ID="' IDsymbol '"'
[6] propertyElt ::= '<' propName '>' value '</' propName '>' | '<' propName
resourceAttr '/>’
[7] propName ::= Qname
[8] value ::= description | string
[9] resourceAttr ::= 'resource="' URI-reference '"'
[10] Qname ::= [ NSprefix ':' ] name
[11] URI-reference ::= string, interpreted per [URI]
[12] IDsymbol ::= (any legal XML name symbol)
[13] name ::= (any legal XML name symbol)
[14] NSprefix ::= (any legal XML namespace prefix)
[15] string ::= (any XML text, with "<", ">", and "&" escaped)

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 1.2
[18] container ::= sequence | bag | alternative
[19] sequence ::= '<rdf:Seq' idAttr? '>' member*
'</rdf:Seq>'
[20] bag ::= '<rdf:Bag' idAttr? '>' member* '</rdf:Bag>'
[21] alternative ::= '<rdf:Alt' idAttr? '>' member+
'</rdf:Alt>'
[22] member ::= referencedItem | inlineItem
[23] referencedItem ::= '<rdf:li' resourceAttr '/>'
[24] inlineItem ::= '<rdf:li>' value '</rdf:li>'

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 1.2.e
<rdf:RDF>
<rdf:Description about="http://www.zorck.dk/rc/planes">
<s:planes>
<rdf:Bag>
<rdf:li resource="http://www.zorck.dk/rc/planes/Wingo"/>
<rdf:li resource=" http://www.zorck.dk/rc/planes/Merlin"/>
<rdf:li resource=" http://www.zorck.dk/rc/planes/Picojet"/>
</rdf:Bag>
</s:planes>
</rdf:Description>
</rdf:RDF>

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 1.3
• Meaning of tags – Semantics.
• RDF Schema

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 1.3.e
<rdf:RDF xml:lang="en"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

<rdf:Description ID="biologicalParent">
<rdf:type resource="http://www.w3.org/1999/02/22-rdf-syntax-
ns#Property"/>
</rdf:Description>

<rdf:Description ID="biologicalFather">
<rdf:type resource="http://www.w3.org/1999/02/22-rdf-syntax-
ns#Property"/>
<rdfs:subPropertyOf rdf:resource="#biologicalParent"/>
</rdf:Description>

</rdf:RDF>

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2
• http://dublincore.org/
• The next few pages will list the basic
Dublin Core meta elements.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.10
<? xml version="1.0" ?>
<RDF:RDF xmlns:RDF = "http://w3.org/TR/1999/PR-rdf-syntax-19990105#"
xmlns:DC = "http://purl.org/DC#" >
 <RDF:Description about =
”http://www.zorck.dk/keynotes/2001.11.14.XML.Finland.xml" >
<DC:Title> The Future of The Semantic Web </DC:Title>
<DC:Creator> Jens Jakob Andersen </DC:Creator>
<DC:Date> 2001-11-14 </DC:Date>
<DC:Subject> Semantic Web, XML, RDF, Ontologies </DC:Subject>
</RDF:Description>
</RDF:RDF>

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.1
• Element: Title
Name: Title
Identifier: Title
Definition: A name given to the resource. Comment:
Typically, a Title will be a name by which the resource is
formally known.
• Element: Creator
Name: Creator
Identifier: Creator
Definition: An entity primarily responsible for making the
content of the resource.
Comment: Examples of a Creator include a person, an
organisation, or a service. Typically, the name of a Creator
should be used to indicate the entity.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.2
• Element: Subject
Name: Subject and Keywords
Identifier: Subject
Definition: The topic of the content of the resource.
Comment: Typically, a Subject will be expressed as keywords,
key phrases or classification codes that describe a topic of the
resource. Recommended best practice is to select a value from a
controlled vocabulary or formal classification scheme.
• Element: Description
Name: Description
Identifier: Description
Definition: An account of the content of the resource.
Comment: Description may include but is not limited to: an
abstract, table of contents, reference to a graphical
representation of content or a free-text account of the content.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.3
• Element: Publisher
Name: Publisher
Identifier: Publisher
Definition: An entity responsible for making the resource
available
Comment: Examples of a Publisher include a person, an
organisation, or a service. Typically, the name of a Publisher
should be used to indicate the entity.
• Element: Contributor
Name: Contributor
Identifier: Contributor
Definition: An entity responsible for making contributions to
the content of the resource. Comment: Examples of a
Contributor include a person, an organisation, or a service.
Typically, the name of a Contributor should be used to indicate
the entity.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.4
• Element: Date
Name: Date
Identifier: Date
Definition: A date associated with an event in the life cycle of the
resource. Comment: Typically, Date will be associated with the
creation or availability of the resource. Recommended best practice for
encoding the date value is defined in a profile of ISO 8601 [W3CDTF]
and follows the YYYY-MM-DD format.
• Element: Type
Name: Resource Type
Identifier: Type
Definition: The nature or genre of the content of the resource.
Comment: Type includes terms describing general categories,
functions, genres, or aggregation levels for content. Recommended
best practice is to select a value from a controlled vocabulary (for
example, the working draft list of Dublin Core Types [DCT1]). To
describe the physical or digital manifestation of the resource, use the
FORMAT element.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.5
• Element: Format
Name: Format
Identifier: Format
Definition: The physical or digital manifestation of the resource.
Comment: Typically, Format may include the media-type or dimensions of the
resource. Format may be used to determine the software, hardware or other
equipment needed to display or operate the resource. Examples of dimensions
include size and duration. Recommended best practice is to select a value from
a controlled vocabulary (for example, the list of Internet Media Types [MIME]
defining computer media formats).
• Element: Identifier
Name: Resource Identifier
Identifier: Identifier
Definition: An unambiguous reference to the resource within a given context.
Comment: Recommended best practice is to identify the resource by means of
a string or number conforming to a formal identification system. Example
formal identification systems include the Uniform Resource Identifier (URI)
(including the Uniform Resource Locator (URL)), the Digital Object Identifier
(DOI) and the International Standard Book Number (ISBN).

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.6
• Element: Source
Name: Source
Identifier: Source
Definition: A Reference to a resource from which the present resource is derived.
Comment: The present resource may be derived from the Source resource in whole
or in part. Recommended best practice is to reference the resource by means of a
string or number conforming to a formal identification system.
• Element: Language
Name: Language
Identifier: Language
Definition: A language of the intellectual content of the resource.
Comment: Recommended best practice for the values of the Language element is
defined by RFC 1766 [RFC1766] which includes a two-letter Language Code (taken
from the ISO 639 standard [ISO639]), followed optionally, by a two-letter Country
Code (taken from the ISO 3166 standard [ISO3166]). For example, 'en' for English,
'fr' for French, or 'en-uk' for English used in the United Kingdom.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.7
• Element: Relation
Name: Relation
Identifier: Relation
Definition: A reference to a related resource.
Comment: Recommended best practice is to reference the resource by means of a string
or number conforming to a formal identification system.
• Element: Coverage
Name: Coverage
Identifier: Coverage
Definition: The extent or scope of the content of the resource.
Comment: Coverage will typically include spatial location (a place name or geographic
coordinates), temporal period (a period label, date, or date range) or jurisdiction (such
as a named administrative entity). Recommended best practice is to select a value from
a controlled vocabulary (for example, the Thesaurus of Geographic Names [TGN]) and
that, where appropriate, named places or time periods be used in preference to numeric
identifiers such as sets of coordinates or date ranges.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.8
• Element: Rights
Name: Rights Management
Identifier: Rights
Definition: Information about rights held in and over the resource. Comment: Typically,
a Rights element will contain a rights management statement for the resource, or
reference a service providing such information. Rights information often encompasses
Intellectual Property Rights (IPR), Copyright, and various Property Rights. If the Rights
element is absent, no assumptions can be made about the status of these and other
rights with respect to the resource.

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Introduction to RDF and
DC, 2.9
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2001 09 20//EN"
"http://dublincore.org/documents/2001/09/20/dcmes-xml/dcmes-xml-dtd.dtd">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc ="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://dublincore.org/">
<dc:title>Dublin Core Metadata Initiative - Home Page</dc:title>
<dc:description>The Dublin Core Metadata Initiative Web
site.</dc:description>
<dc:date>1998-10-10</dc:date>
<dc:format>text/html</dc:format>
<dc:language>en</dc:language>
<dc:contributor>The Dublin Core Metadata Initiative</dc:contributor>
<!-- guesses for the translation of the above titles -->
<dc:title xml:lang="fr">L'Initiative de métadonnées du Dublin Core</dc:title>
<dc:title xml:lang="de">der Dublin-Core Metadata-Diskussionen</dc:title>
</rdf:Description> </rdf:RDF>

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Write your own RDF
• Use the RDF template from last page
• Use Dublin Core tags
• Map to a ressource of your own
• Use pen and paper
• You have 10 minutes

• The Semantic Web is quite easy, isn’t it ?

© Jens Jakob Andersen


http://www.zorck.dk/tsw
An easy to use RDF
repository, 1
• RDF usage:
– Add ”annotations” for web-pages ?
– Add ”annotations” for web-services ?
– Instead of building a menu for a web-site, declare
the content in RDF, and let the user-agent build the
menu dynamically ?
– Describe all images on your website ?
– Market the web.service your web.site provides ?

© Jens Jakob Andersen


http://www.zorck.dk/tsw
An easy to use RDF
repository, 1.e
Example – Inline RDF tag in HTML document:
<html>
<head>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/metadata/dublin_core#">
<rdf:Description about="">
<dc:Creator>
Jens Jakob Andersen
</dc:Creator>
</rdf:Description>
</rdf:RDF>
</head>
<body> <P>This is a nice RDF tagged document.</P> </body> </html>

© Jens Jakob Andersen


http://www.zorck.dk/tsw
An easy to use RDF
repository, 2
• Properties of a RDF Reposity
– Make RDF’s searchable
– Make RDF’s manageable
– Can scale up and scale out
– Provide support for RDF authoring
– Handle RDF integrity ?
– Handle namespaces
– Easily integrated with existing systems ?

© Jens Jakob Andersen


http://www.zorck.dk/tsw
An easy to use RDF
repository, 3
• http://citeseer.nj.nec.com/context/10321
39/0
Many good thoughts on XML and RDBMS
• A RDF Repository modelled in SQL
• RDF is basically an Entity Relation (ER)
model
• Think of the URL’s as primary keys, and
everything else as relations

© Jens Jakob Andersen


http://www.zorck.dk/tsw
An easy to use RDF
repository, 4
• Create Table RDF_Description(ndx long,
URI varchar(255))
• Create Table NS (ndx long,
URI_FK long,
ns varchar(20),
ns_uri varchar(255))
• Create Table property (URI_FK long,
ns_fk long,
property varchar(255),
pvalue varchar(255))

© Jens Jakob Andersen


http://www.zorck.dk/tsw
An easy to use RDF
repository, 5
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/metadata/dublin_core#">
<rdf:Description about=”http://www.zorck.dk/tsw">
<dc:Creator> Jens Jakob Andersen</dc:Creator>
<dc:language>en </dc:language>
<dc:format>text/html </dc:format>
</rdf:Description>
</rdf:RDF>

© Jens Jakob Andersen


http://www.zorck.dk/tsw
An easy to use RDF
repository, 6

CT DISTINCT RDF_Description_1.URI, property.property, property.pvalue, NS.ns, N


(RDF_Description AS RDF_Description_1 LEFT JOIN property ON
Description_1.ndx = property.URI_FK) LEFT JOIN NS ON property.ns_fk = NS.ndx;
© Jens Jakob Andersen
http://www.zorck.dk/tsw
An easy to use RDF
repository, 7
Which URI’s are created by Jens Jakob Andersen ?

select URI from RDF_Description


where ndx in
(Select URI_FK from Property
where Property="Creator" and PValue="Jens Jakob
Andersen")

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Your own ”Semantic Web
In A Box”
• Let’s put things together
• A Semantic Web in A Box
Architecture
• Prototype

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Your own ”Semantic Web
In A Box”,1
• A Semantic Web in A Box Architecture

RDF enhanced Website


Search View Update
Manage
Internet
Internet

RDF Repository Agents

*.jpg
*.html
*.gif *.asp *.jsp

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Your own ”Semantic Web
In A Box”,2
• Prototype – Setup searchform

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Your own ”Semantic Web
In A Box”,3
• Prototype

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Wrapup
Hopefully you experienced in this session:
• What can The Semantic Web be
• What is RDF and DC
• How do these fit in TSW
• An example of a RDF Repository
• A ”Semantic Web in a Box” template
• Nice people, interesting thoughts and good
karma

© Jens Jakob Andersen


http://www.zorck.dk/tsw
Questions
• and hopefully answers
• http://www.zorck.dk/tsw
• mailto:tsw@zorck.dk

© Jens Jakob Andersen


http://www.zorck.dk/tsw