Introduction to the Semantic Web

Ivan Herman, World Wide Web Consortium
WWW2006, Edinburgh, UK, 2006-05-24

Pipers on the streets of Edinburgh

Introduction to the Semantic Web

WWW2006 conference logo

Slides of the tutorial given at the WWW2006 Conference, Edinburgh, Scotland, United Kingdom, on the 24th of May, 2006.


 

Introduction

Towards a Semantic Web

Towards a Semantic Web

However…

Example: Searching

Example: Automatic Airline Reservation

Example: Data(base) Integration

Example: Image Annotation

W3C Membership Evolution

What Is Needed?

What Is Needed (Technically)?

 

Basic RDF

RDF Triples

RDF Triples (cont.)

(http://www.ivan-herman.net, http://…/myCalendar, http://…/calendar)

RDF Triples (cont.)

An Example for URI Usage

W3C Membership Evolution

Possible Statements Example:

(URI For Slide, URI for Predicate, URI for SVG Text Element)

RDF is a Graph

A Simple RDF Example (in RDF/XML)

A Simple RDF Graph with full URI-s
<rdf:Description rdf:about="http://.../membership.svg#FullSlide">
    <axsvg:graphicsType>Chart</axsvg:graphicsType>
    <axsvg:labelledBy>
        <rdf:Description rdf:about="http://...#BottomLegend"/>
    </axsvg:labelledBy>
    <axsvg:chartType>Line</axsvg:chartType>
</rdf:Description>

A Simple RDF Example (in Turtle)

A Simple RDF Graph with full URI-s
<http://.../membership.svg#FullSlide>
    axsvg:graphicsType "Chart";
    axsvg:labelledBy <http://...#BottomLegend>;
    axsvg:chartType "Line".

URI-s Play a Fundamental Role

URI-s: Merging

What Merge Can Do…

See the “tabulator” example…

RDF in Programming Practice

Jena Example

   // create a model
  Model model=new ModelMem();
  Resource subject=model.createResource("URI_of_Subject")
  // 'in' refers to the input file
  model.read(new InputStreamReader(in));
  StmtIterator iter=model.listStatements(subject,null,null);
  while(iter.hasNext()) { 
     st = iter.next();
     p = st.getProperty();
     o = st.getObject();
     do_something(p,o);
  }

Merge in Practice

“Internal” Nodes

A graph with a blank node in the middle (labelled with '?')

One Solution: Define Extra URI-s

<rdf:Description rdf:about="#FullSlide">
   <axsvg:isA rdf:resource="#Thing"/>
</rdf:Description>
<rdf:Description rdf:ID="Thing">
   <axsvg:consistsOf rdf:resource="#Axes"/>
   <axsvg:consistsOf rdf:resource="#Legend"/>
   <axsvg:consistsOf rdf:resource="#Datalines"/>
</rdf:Description>

Blank Nodes

<rdf:Description rdf:about="#FullSlide">
   <axsvg:isA rdf:nodeID="A234"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A234">
   <axsvg:consistsOf rdf:resource="#Axes"/>
</rdf:Description>
:FullSlide axsvg:isA _:A234.
_:A234 axsvg:consistsOf :Axes".

Blank Nodes: the System Can Also Do It

<rdf:Description rdf:about="#FullSlide">
  <axsvg:isA>
      <rdf:Description>
          <axsvg:consistsOf rdf:resource="#Axes"/>
      </rdf:Description>
  </axsvg:isA>
</rdf:Description>
A graph with a blank node in the middle

Same in Turtle

:FullSlide axsvg:isA [
    axsvg:consistsOf :Axes;
].
A graph with a blank node in the middle

Blank Nodes: Some More Remarks

 

RDF Vocabulary Description Language

(a.k.a. RDFS)

Need for RDF Schemas

Classes, Resources, …

Classes, Resources, … (cont.)

Classes, Resources in RDF(S)

A slide showing the Flipper with its own Schema and the RDFS entitites, all merged

Schema Example in RDF/XML

<rdf:Description rdf:ID="Dolphin">
  <rdf:type rdf:resource=
    "http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>
<rdf:Description rdf:about="#Flipper">
   <rdf:type rdf:resource="animal-schema.rdf#Dolphin"/>
</rdf:Description>

Further Remarks on Types

Inferred Properties

A slide showing an inferred property

Inference: Let Us Be Formal…

If:
  uuu rdfs:subClassOf xxx .
  vvv rdf:type uuu .
Then add:
  vvv rdf:type xxx .

Properties

Properties (cont.)

Property Specification Example

A slide showing the Fullslide (in appl. space) with its own Schema and the RDFS entitites, all merged

Property Specification Serialized

In XML/RDF:

<rdfs:Property rdf:ID="name">
  <rdf:domain rdf:resource="#TV_Actor"/>
  <rdf:range rdf:resource="http://...#Literal"/>
</rdfs:Property>

In Turtle:

:name
  rdf:type   rdf:Property;
  rdf:domain :TV_Actor;
  rdf:range  rdfs:Literal.

Literals

Literals Serialized

In RDF/XML

<rdf:Description rdf:about="#Flipper">
   <animal:is_TV_Star
      rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">
         True
   </animal:is_TV_Star>
</rdf:Description/>

In Turtle

:Flipper
   animal:is_TV_Star 
         "True"^^<http://www.w3.org/2001/XMLSchema#boolean>.

XML Literals in RDF/XML

<rdf:Description rdf:about="#Path">
   <axsvg:algorithmUsed rdf:parseType="Literal">
      <math xmlns="...">
        <apply>
          <laplacian/>
          <ci>f</ci>
        </apply>
      </math>
   </axsvg:algorithmUsed>
</rdf:Description/>

A Bit of RDFS Can Take You Far…

 

Some Predefined Classes (Collections, Containers)

Predefined Classes and Properties

Collections (Lists)

Collections (Lists) (cont.)

Example for RDF Lists

The Same in RDF/XML and Turtle

<rdf:Description rdf:about="#FullSlide">
    <axsvg:consistsOf rdf:parseType="Collection">
        <rdf:Description rdf:about="#Axes"/>
        <rdf:Description rdf:about="#Legend"/>
        <rdf:Description rdf:about="#Datalines"/>
    </axsvg:consistsOf>
</rdf:Description>
:FullSlide axsvg:consistsOf (:Axes, :Legend, :Datalines).

 

RDF(S) in Practice

Small Practical Issues

Binding RDF to an XML Resource

<svg ...>
  ...
  <metadata>
    <rdf:RDF xmlns:rdf="http://../rdf-syntax-ns#">
      ...
    </rdf:RDF>
  </metadata>
    ...
</svg>

RDF/XML with XHTML

RDF Can Also Be Extracted/Generated

Formalizing the Scraper Approach: GRDDL

<html xmlns="http://www.w3.org/1999/">
  <head profile="http://www.w3.org/2003/g/data-view">
    <title>Some Document</title>
    <link rel="transformation" href="http:…/dc-extract.xsl"/>
    <meta name="DC.Subject" content="Some subject"/>      
    ...
  </head>
  ...
  <span class="date">2006-01-02</span>
  ...
</html>
<rdf:Description rdf:about="…">
  <dc:subject>Some subject</dc:subject>
  <dc:date>2006-01-02</dc:date>
</rdf:Description>

GRDDL (cont)

Another Future Solution: RDFa

RDFa (cont.)

<div about="http://uri.to.newsitem">
  <span property="dc:date">March 23, 2004</span>
  <span property="dc:title">Rollers hit casino for £1.3m</span>
  By <span property="dc:creator">Steve Bird</span>. See
  <a href="http://www.a.b.c/d.avi" rel="dcmtype:MovingImage">
  also video footage</a>…
</div>
<http://uri.to.newsitem>
  dc:date             "March 23, 2004";
  dc:title            "Rollers hit casino for £1.3m;
  dc:creator          "Steve Bird";
  dcmtype:MovingImage <http://www.a.b.c/d.avi>.

RDFa (cont.)

 

RDF Data Access, a.k.a. Query (SPARQL)

Querying RDF Graphs/Repositories

StmtIterator iter=model.listStatements(subject,null,null);
while(iter.hasNext()) {
    st = iter.next(); 
    p = st.getProperty(); o = st.getObject();
    do_something(p,o);

Analyze the Jena Example

StmtIterator iter=model.listStatements(subject,null,null);
while(iter.hasNext()) {
    st = iter.next(); 
    p = st.getProperty(); o = st.getObject();
    do_something(p,o);
A slide showing the simple RDFLib pattern as graph pattern

General: Graph Patterns

Our Jena Example in SPARQL

SELECT ?p ?o
WHERE {subject ?p ?o}
A slide showing the simple RDFLib pattern as graph pattern

Simple SPARQL Example

SELECT ?cat ?val # note: not ?x!
WHERE { ?x rdf:value ?val. ?x category ?cat }
A simple RDF Graph, with some matching patterns highlighted

Pattern Constraints

SELECT ?cat ?val
WHERE { ?x rdf:value ?val. ?x category ?cat. FILTER(?val>=200). }
An RDF Graph showing some of the matching graphs in highlights (of the code above)

More Complex Example

SELECT ?cat ?val ?uri
WHERE { ?x rdf:value ?val. ?x category ?cat.
        ?al contains ?x.  ?al linkTo ?uri }
An RDF Graph showing some of the matching graphs in highlights (of the code above)

Optional Pattern

SELECT ?cat ?val ?uri
WHERE    { ?x rdf:value ?val. ?x category ?cat. 
           OPTIONAL ?al contains ?x. ?al linkTo ?uri }
An RDF Graph showing some of the matching graphs in highlights (of the code above)

Other SPARQL Features

SPARQL Usage in Practice

SPARQL Usage in Practice

diagram showing a sparql that can be connected to an rdf datafile, a document via grddl, and to a database via an sparql/sql bridge

 

Programming Practice

We have seen Jena

   // create a model
  Model model=new ModelMem();
  Resource subject=model.createResource("URI_of_Subject")
  // 'in' refers to the input file
  model.read(new InputStreamReader(in));
  StmtIterator iter=model.listStatements(subject,null,null);
  while(iter.hasNext()) { 
     st = iter.next();
     p = st.getProperty();
     o = st.getObject();
     do_something(p,o);
  }

Jena (cont)

Lots of Other tools

SPARQL as the only interface to RDF data?

SELECT ?translator ?translationTitle ?originalTitle ?originalDate
FROM <http://…/TR_and_Translations.rdf>
WHERE {
   ?trans rdf:type trans:Translation;
          trans:translationFrom ?orig;
          trans:translator      [ contact:fullName ?translator ];
          dc:language           "fr";
          dc:title              ?translationTitle.
   ?orig  rdf:type rec:REC;
          dc:date               ?originalDate;
          dc:title              ?originalTitle.
}
ORDER BY ?translator ?originalDate

 

Ontologies (OWL)

Ontologies

Ontologies (cont.)

“defines the concepts and relationships used to describe and represent an area of knowledge”

W3C’s Ontology Language (OWL)

Classes in OWL

OWL Resource and Thing

Need for Enumeration

Simplified version for property specification

(OWL) Classes can be Enumerated

Showing owl:oneOf with chart types

Same Serialized

<rdf:Property rdf:ID="name">
   <rdf:range>
       <owl:Class>
           <owl:oneOf rdf:parseType="Collection">
               <owl:Thing rdf:ID="Flipper"/>
               <owl:Thing rdf:ID="Joe"/>
               <owl:Thing rdf:ID="Mary"/>
           </owl:oneOf>
       </owl:Class>
   </rdf:range>
</rdf:Property>
:Flipper rdf:type owl:Thing.
:Joe     rdf:type owl:Thing.
:Mary    rdf:type owl:Thing.
:name rdf:type rdf:Property;
   rdf:range [
       rdf:type owl:Class;
       owl:oneOf (:Flipper, :Joe, :Mary).
  ].

Union of Classes

Showing unionOf with marine mammals

Same Serialized

<owl:Class rdf:ID="MarineMammal">
   <owl:unionOf rdf:parseType="Collection">
       <owl:Class rdf:about="#Dolphin"/>
       <owl:Class rdf:about="#Orca"/>
       <owl:Class rdf:about="#Whale"/>
   </owl:unionOf>
</owl:Class>
:Dolphin  rdf:type owl:Class.
:Orca     rdf:type owl:Class.
:Whale    rdf:type owl:Class.
:MarineMammal rdf:type owlClass;
   owl:unionOf (:Dolphin, :Orca, :Whale).

Property Restrictions

Property Restrictions in OWL

Property Restriction Example

Restriction example, using allValuesFrom

Restrictions Formally

Same Serialized

<owl:Class rdf:ID="Dolphin">
    <rdfs:subClassOf rdf:resource="#Mammal"/>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty rdf:resource="#livingIn"/>
        <owl:allValuesFrom rdf:resource="#UnionOfSeaAndAmazonas">
      </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>
:Dolphin rdf:type owl:Class;
    rdfs:subClassOf :Mammal;
    rdfs:subClassOf [ 
      rdf:type          owl:Restriction;
      owl:onProperty    :livingIn;
      owl:allValuesFrom :UnionOfSeaAndAmazonas.
   ]
.

allValuesFrom could be replaced by someValuesFrom, cardinality, minCardinality, or maxCardinality

Cardinality Constraint Example

<owl:Class rdf:ID="Beluga">
    . . .
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty rdf:resource="#typeOfDorsalFins"/>
        <owl:cardinality rdf:datatype=".../nonNegativeInteger">
          0
        </owl:cardinality>
      </owl:Restriction>
    </rdfs:subClassOf>
    . . .
</owl:Class>
:Beluga rdf:type owl:Class
    . . .
    rdfs:subClassOf [
      rdf:type        owl:Restriction;
      owl:onProperty  :typeOfDorsalFins;
      owl:cardinality "0"^^<.../nonNegativeInteger>.
    ];
    . . .
.

Property Characterization

The top level OWL property definitions

Characterization Example

Restriction example, using cardinality

Same Serialized

<owl:ObjectProperty rdf:ID="order">
   <rdf:type rdf:resource="...../#FunctionalProperty"/>
</owl:ObjectProperty>
:order 
   rdf:type owl:ObjectProperty;
   rdf:type owl:FunctionalProperty.

OWL: Additional Requirements

Term Equivalence/Relations

Example: Connecting to Hungarian

Example of equivalence between English and Hungarian terms

Versioning, Annotation

However: Ontologies are Hard!

OWL Full

Example for a Possible Problem (in OWL Full)

:A rdf:type owl:Class;
   owl:equivalenClass [
      rdf:type          owl:Restriction;
      owl:onProperty    rdf:type;
      owl:allValuesFrom :B.
   ].
:B rdf:type owl:Class;
   owl:complementOf :A.
:c rdf:type :A.

OWL Description Logic (DL)

Goal: maximal subset of OWL Full against which current research can assure that a decidable reasoning procedure is realizable

OWL Lite

Goal: provide a minimal useful subset, easily implemented

Note on OWL layers

Ontology Development

Ontology Examples

 

Simple Knowledge Organization System (SKOS)

Simple Knowledge Organization System

Example: Entries in a Glossary (1)

“Assertion”
“(i) Any expression which is claimed to be true. (ii) The act of claiming something to be true.”
“Class”
“A general concept, category or classification. Something used primarily to classify or categorize other things.”
“Resource”
“(i) An entity; anything in the universe. (ii) As a class name: the class of everything; the most inclusive category possible.”

(from the RDF Semantics Glossary)

Example: Entries in a Glossary (2)

A slide for a simple SKOS glossary

Example: Entries in a Glossary (3)

A slide for a simple SKOS glossary

Example: Taxonomy (1)

Illustrates “broader” and “narrower”

General
  • Travelling
  • Politics
SemWeb
  • RDF
    • OWL

(From MortenF’s weblog categories. Note that the categorization is arbitrary!)

Example: Taxonomy (2)

A slide for a simple SKOS taxonomy

Example: Thesaurus (1)

Term
Economic cooperation
Used For
Economic co-operation
Broader terms
Economic policy
Narrower terms
Economic integration, European economic cooperation, …
Related terms
Interdependence
Scope Note
Includes cooperative measures in banking, trade, …

(from UK Archival Thesaurus)

Example: Thesaurus (2)

A slide for a simple SKOS thesaurus

SKOS Core Overview

Why Having SKOS and OWL?

SKOS Documents

“Core” Vocabularies

 

What is Coming?

Semantic Web Activity Phases

Rules

Rules Interchange Format Working Group

RIF Phase 1 Goals

RIF Use Cases and Requirements

RIF Phase 2 Goals

Lots of Theoretical Questions to Solve

Beyond Rules: Trust

Other Issues…

 

Available Documents, Tools

Available Specifications: Primers, Guides

Available Specifications (cont)

Available Specifications (cont)

Some Books

Further Information

SWBP Working Group Documents

Further Information (cont)

Public Fora at W3C

Semantic Web Interest Group
a forum for discussions on applications
RDF Logic
public (archived) mailing list for technical discussions

Some Tools

(Graphical) Editors
Further info on RDF/OWL tools at:
SemWebCentral (see also previous links…)
Programming environments
We have already seen some;
but Jena 2 and SWI-Prolog do OWL reasoning, too!

Some Tools (Cont.)

Validators
For RDF: W3C RDF Validator; For OWL-DL: WonderWeb, Pellet (can also be downloaded as a reasoner tool)
Reasoners that can be built into an application
Pellet, KAON2
Ontology converter (to OWL)
at the Mindswap project
Relational Database to RDF/OWL converter
D2R Map
Schema/Ontology/RDF Data registries
e.g., SchemaWeb, SemWeb Central, Ontaria, rdfdata.org,
Metadata Search Engine
Swoogle

Oracle's Spatial RDF Data Model

Oracle's announcement drawing

IBM – Life Sciences and Semantic Web

IBM screen dump

 

Some Application Examples

SW Applications

Data integration

MuseoSuomi Application dump DOPE Application dump

Portals

Vodafone screen dump

Adobe's XMP

XMP Application dump

Improved Search via Ontology: GoPubMed

GoPubMed Application dump

Further Information

These slides are at:
http://www.w3.org/2006/Talks/0524-Edinburgh-IH/
http://www.w3.org/2006/Talks/0524-Edinburgh-IH/Overview.pdf
Semantic Web homepage
http://www.w3.org/2001/sw/
More information about W3C:
http://www.w3.org/
Mail me:
ivan@w3.org