Cover page images (keys)

Tutorial on Semantic Web Technologies

$Date: 2010/04/14 17:36:38 $

Ivan Herman, W3C

Introduction

Towards a Semantic Web

Towards a Semantic Web

However…

Example: Searching

Example: Digital Libraries

Example: Automatic Airline Reservation

Example: Data(base) Integration

And the problem is real

screen dump of three different Life Science databases with mutually different interfaces

Example: Semantics of Web Services

Introductory Example

The Rough Structure of Data Integration

  1. Map the various data onto an abstract data representation
    • make the data independent of its internal representation…
  2. Merge the resulting representations
  3. Start making queries on the whole!
    • queries that could not have been done on the individual data sets

A Simplifed Bookstore Data (Dataset “A”)

ID Author Title Publisher Year
ISBN 0-00-651409-X id_xyz The Glass Palace id_qpr 2000

 

ID Name Home page
id_xyz Amitav Ghosh http://www.amitavghosh.com/

 

ID Publisher Name City
id_qpr Harper Collins London

1st Step: Export Your Data as a Set of Relations

The previous table in an RDF format

Some Notes on the Exporting the Data

Another Bookstore Data (dataset “F”)

ID Titre Auteur Traducteur Original
ISBN 2020386682 Le Palais des miroirs i_abc i_qrs ISBN 0-00-651409-X

 

ID Nom
i_abc Amitav Ghosh
i_qrs Christiane Besse

2nd Step: Export Your Second Set of Data

The French data in RDF

3rd Step: Start Merging Your Data

The French and English data side by side

3rd Step: Start Merging Your Data (cont.)

The merged data with nodes with identical URI-s pointed out

3rd Step: Merge Identical Resources

The merged data with one of the nodes merged with common URI

Start Making Queries…

The merged data with one of the nodes merged with common URI

However, More Can Be Achieved…

3rd Step Revisited: Use the Extra Knowledge

The merged data with extra nodes identified as a result of identifying same as properties

Start Making Richer Queries!

The merged data with one of the nodes merged with common URI

Combine With Different Datasets

Merge with Wikipedia Data

The merged data with a reference to a Wikipedia entry on the author
The merged data with a reference to a Wikipedia entry on the author plus other books he wrote The merged data with a reference to a Wikipedia entry on the author plus other books he wrote plus a reference to Calcutta referreing to the google map entry

Is That Surprising?

What Did We Do?

It Could Become Even More Powerful

What did we do? (cont)

Three layer figure; from top to bottom: applications, graph, and all kinds of data in different formats, labelled in general terms

The Abstraction Pays Off Because…

So Where is the Semantic Web?

Basic RDF

RDF Triples

RDF Triples (cont.)

(<http://…isbn…6682>, <http://…/original>, <http://…isbn…409X>)

RDF Triples (cont.)

A Simple RDF Example (in RDF/XML)

A Simple RDF Graph with full URI-s
<rdf:Description rdf:about="http://…/isbn/2020386682">
    <f:titre xml:lang="fr">Le palais des mirroirs</f:titre>
    <f:original rdf:resource="http://…/isbn/000651409X"/>
</rdf:Description>

(Note: namespaces are used to simplify the URI-s)

A Simple RDF Example (in Turtle)

A Simple RDF Graph with full URI-s
<http://…/isbn/2020386682>
    f:titre "Le palais des mirroirs"@fr;
    f:original <http://…/isbn/000651409X>.

URI-s Play a Fundamental Role

RDF/XML Principles

A Simple RDF Graph with without full URIs and namespaces
«Element for http://…/isbn/2020386682»
  «Element for original»
      «Element for http://…/isbn/000651409X»
  «/Element for original»
«/Element for http://…/isbn/2020386682»
«Element for http://…/isbn/2020386682»
  «Element for titre»
      Le palais des mirroirs
  «/Element for titre»
«/Element for http://…/isbn/2020386682»

RDF/XML Principles (cont)

A Simple RDF Graph with one single predicate
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about="http://…/isbn/2020386682">
       «Element for f:original»
           <rdf:Description rdf:about="http://…/isbn/000651409X"/>
       «/Element for f:original»
    </rdf:Description>
<rdf:RDF>

RDF/XML Principles (cont)

A Simple RDF Graph without full URI-s
<rdf:RDF
  xmlns:f="http://www.editeur.fr"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about="http://…/isbn/2020386682">
       <f:original>
           <rdf:Description rdf:about="http://…/isbn/000651409X"/>
       </f:original>
    </rdf:Description>
<rdf:RDF>

Examples of RDF/XML “Simplifications”

<rdf:Description rdf:about="http://…/isbn/2020386682">
   <f:original rdf:resource="http://…/isbn/000651409X"/>
   <f:titre>Chart</axsvg:graphicsType xml:lang="fr">
       Le palais des mirroirs
   </f:titre>
</rdf:Description>

“Internal” Nodes

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

One Solution: Define Extra URI-s

<rdf:Description rdf:about="http://…/isbn/000651409X">
   <a:publisher rdf:resource="#Thing"/>
</rdf:Description>
<rdf:Description rdf:ID="Thing">
   <a:p_name>HarpersCollins</a:p_name>
   <a:city>HarpersCollins</a:city>
</rdf:Description>

Blank Nodes

<rdf:Description rdf:about="http://…/isbn/000651409X">
   <a:publisher rdf:nodeID="A234"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A234">
   <a:p_name>HarpersCollins</a:p_name>
   <a:city>HarpersCollins</a:city>
</rdf:Description>
<http://…/isbn/2020386682> a:publisher _:A234.
_:A234 a:p_name "HarpersCollins".

Blank Nodes: the System Can Also Do It

<rdf:Description rdf:about="http://…/isbn/000651409X">
  <a:publisher>
      <rdf:Description>
          <a:p_name>HarpersCollins</a:p_name>
      </rdf:Description>
  </a:publisherA>
</rdf:Description>
A graph with a blank node in the middle

Same in Turtle

<http://…/isbn/000651409X> a:publisher [
    a:p_name "HarpersCollins";
].
A graph with a blank node in the middle

Blank Nodes: Some More Remarks

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

RDFSchemas

Need for RDF Schemas

Classes, Resources, …

Classes, Resources, … (cont.)

Classes, Resources in RDF(S)

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

Schema Example in RDF/XML

<rdf:Description rdf:ID="Novel">
  <rdf:type rdf:resource= "http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>
<rdf:Description rdf:about="http://…/isbn/000651409X">
   <rdf:type rdf:resource="http://…/bookSchema.rdf#Novel"/>
</rdf:Description>

An Aside: Typed Nodes in RDF/XML

<rdf:Description rdf:about="http://...">
    <rdf:type rdf:resource="http://..../something#ClassName>
    ...
</rdf:Description>
<yourNameSpace:ClassName rdf:about="http://...">
    ...
</yourNameSpace:ClassName>
<a:Novel rdf:about="http://…/isbn/000651409X">
    ... 
</a:Novel>

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="title">
  <rdf:domain rdf:resource="#Fiction"/>
  <rdf:range rdf:resource="http://...#Literal"/>
</rdfs:Property>

In Turtle:

:title
  rdf:type   rdf:Property;
  rdf:domain :Fiction;
  rdf:range  rdfs:Literal.

Literals

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="#Inventory">
    <a:consistsOf rdf:parseType="Collection">
        <rdf:Description rdf:about="http://.../isbn/000651409X"/>
        <rdf:Description rdf:about="http://.../isbn/XXXX"/>
        <rdf:Description rdf:about="http://.../isbn/YYYY"/>
    </axsvg:consistsOf>
</rdf:Description>
:Inventory axsvg:consistsOf (<http://.../isbn/000651409X> <http://.../isbn/XXXX> …).
Example for RDF Lists, our own abbreviated form

Sequences

A graph with a blank node in the middle with three _x predicate and a type to a Seq

Sequences Serialized

In RDF/XML

<rdf:Description rdf:about="#Inventory">
  <a:consistsOf>
      <rdf:Description>
          <rdf:type rdf:resource="http:...rdf-syntax-ns#Seq">
          <rdf:_1 rdf:resource="http://.../isbn/000651409X>
          ...
      </rdf:Description>
  </a:consistsOf>
</rdf:Description/>

In Turtle

#Inventory
  a:consistsOf [
    rdf:type <http:...rdf-syntax-ns#Seq>;
    rdf:_1   <http://.../isbn/000651409X>;
          ...
  ].

Sequences (simplified RDF/XML)

<rdf:Description rdf:about="#Inventory">
    <a:consistsOf>
        <rdf:Seq>
            <rdf:li rdf:resource="http://.../isbn/000651409X">
            ...
        </rdf:Seq>
    </a:consistsOf>
</rdf:Description/>

Other Containers

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 ?isbn ?price ?currency # note: not ?x!
WHERE { ?isbn a:price ?x. ?x rdf:value ?price. ?x p:currency ?currency. }
a simple graph with two tree like subgraphs
a simple graph with two tree like subgraphs with selected nodes highlighted

Pattern Constraints

SELECT ?isbn ?price ?currency 
WHERE { ?isbn a:price ?x. ?x rdf:value ?price. ?x p:currency ?currency. 
        FILTER(?currency == €) }
An RDF Graph showing some of the matching graphs in highlights (of the code above)

Optional Pattern

SELECT ?isbn ?price ?currency ?wiki 
WHERE { ?isbn a:price ?x. ?x rdf:value ?price. ?x p:currency ?currency. 
        OPTIONAL ?wiki w:isbn ?isbn.  }
a simple graph with two tree like subgraphs and an extra subgraph at the left one
a simple graph with two tree like subgraphs left subgraph highlighted

Other SPARQL Features

SPARQL Usage in Practice

Remote Query/Reply Example

GET /qps?&query=SELECT+:…+WHERE:+… HTTP/1.1
User-Agent: my-sparql-client/0.0
Host: my.example
        
HTTP/1.1 200 OK
Server: my-sparql-server/0.0
Content-Type: application/sparql-results+xml
        
<?xml version="1.0" encoding="UTF-8"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#>
  <head>
    <variable name="a"/>
    ...
  </head>
  <results>
    <result ordered="false" distinct="false">
      <binding name="a"><uri>http:…</uri></binding>
      ...
    </result>
    <result> ... </result>
  </results>
</sparql>

Get to RDF(S) Data

Simplest: Write your own RDF Data…

<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 Upcoming 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.)

RDFa and GRDDL

Bridge to Relational Databases

SPARQL As a Unifying Force

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

RDF(S) in Practice

Small Practical Issues

RDF/XML has its Problems

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

Ontologies (OWL)

Ontologies

Ontologies (cont.)

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

W3C’s Ontology Language (OWL)

It was a long road…

Why “OWL” and not “WOL”?

The drawing of Winnie the Pooh and OWL

Classes in OWL

OWL Resource and Thing

OWL Classes can be “Enumerated”

Showing owl:oneOf with currencies

Same Serialized

<owl:Class  rdf:ID="Currency">
  <owl:oneOf rdf:parseType="Collection">
    <owl:Thing rdf:ID="£"/>
    <owl:Thing rdf:ID="€"/>
    <owl:Thing rdf:ID="$"/>
  </owl:oneOf>
</owl:Class>
:£ rdf:type owl:Thing.
:€ rdf:type owl:Thing.
:$ rdf:type owl:Thing.
:Currency
    rdf:type owl:Class;
    owl:oneOf (:€ :£ :$).

Union of Classes

Showing unionOf with literature categories

Same Serialized

<owl:Class rdf:ID="Literature">
   <owl:unionOf rdf:parseType="Collection">
       <owl:Class rdf:about="#Novel"/>
       <owl:Class rdf:about="#Short_Story"/>
       <owl:Class rdf:about="#Poetry"/>
   </owl:unionOf>
</owl:Class>
:Novel           rdf:type owl:Class.
:Short_Story     rdf:type owl:Class.
:Poetry          rdf:type owl:Class.
:Literature rdf:type owlClass;
   owl:unionOf (:Novel :Short_Story :Poetry).

Property Restrictions

Property Restrictions in OWL

Property Restriction Example

Restriction example, using allValuesFrom

Restrictions Formally

Same Serialized

<owl:Class rdf:ID="Listed_Price">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty rdf:resource="http://…#currency"/>
        <owl:allValuesFrom rdf:resource="#Currency">
      </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>
:Listed_Price rdf:type owl:Class;
    rdfs:subClassOf [
      rdf:type          owl:Restriction;
      owl:onProperty    <http://…#currency>;
      owl:allValuesFrom :Currency.
   ].

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

Property Characterization

The top level OWL property definitions

Characterization Example

definition of inverse functional

Same Serialized

<owl:DatatypeProperty rdf:ID="email">
   <rdf:type rdf:resource="...../#InverseFunctionalProperty"/>
</owl:DatatypeProperty>
:email 
   rdf:type owl:DatatypeProperty;
   rdf:type owl:InverseFunctionalProperty.

OWL: Additional Requirements

Term Equivalence/Relations

Example: Connecting to French

Example of equivalence between English and Hungarian terms

Versioning, Annotation

OWL and Logic

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 owl:Thing; 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

“Description Logic”

“Description Logic” (cont.)

OWL-DL “Abstract Syntax”

Class(Novel)
Class(Short_Story)
Class(Poetry)
Class(Literature) (  
  unionOf(Novel Poetry Short_Story …)
)

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: 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?

Rules

Rules

Some Typical Use Cases

In an Ideal World…

diagram showing star-like format of ellipses representing rule systems, all with dual arrows connected to a box stating 'full RIF format'

In the Real World…

RIF “core”: Only Partial Interchange

diagram showing star-like format of ellipses each with a yellow box core, and a separate core box in the middle to which all connect

RIF “Variants”

like the core diagram, but each core is surrounded by different sized rectangles

Possible variants: F-logic, production rules, fuzzy logic systems, …; none of these have been finalized yet

Role of Variants

core figure
core figures plus a cloud of rule systems core figures plus a cloud of rule systems clustered around variants with exchange arrows core figures plus a cloud of rule systems clustered around variants with exchange arrows

What Have We achieved?

Remember the integration example?

Three layer figure; from top to bottom: applications, graph, and all kinds of data in different formats, labelled in general terms

Same With What We Learnt

Three layer figure; from top to bottom: applications, graph, and all kinds of data in different formats,  labelled with SW technology names

What is Coming?

Beyond Rules: Trust

Other Issues…

Available Documents, Tools

Available Specifications: Primers, Guides

“Core” Vocabularies

Some Books

See the separate Wiki page collecting books

Further Information

SWBP Working Group Documents

Further Information (cont)

Public Fora and Resources at W3C

Semantic Web Interest Group
a forum developers with archived (and public) mailing list, and a constant IRC presence on freenode.net#swig; anybody can sign up on the list
Semantic Web Education and Outreach Interest Group
public archives of the Interest Group (although only members can sign up on the list directly)
Semantic Web Deployment Working Group
public archives of the Working Group (although only members can sign up on the list directly)

Tools

Some Application Examples

Semantic Web an academic research only!

May start with small communities

Some RDF deployment areas

Library metadata Defense Life sciences
Problem to solve? single-domain integration yes, serious data integration needs yes, connections among genetics, proteomics, clinical trials, regulatory, …
Willingness to adopt? yes: OCLC push and Dublin Core Initiative(*) yes: funded early DAML (OWL) work yes: intellectual level high, much modeling done already.
Motivation light strong very strong
Links to other library data phone calls records, etc chemistry, regulatory, medical, etc
Showcase? limited not at all yes, model for other industries.

(*) note that the Dublin Core Initiative’s work go way beyond digital libraries these days

Some RDF deployment areas (cont)

The “corporate” landscape is moving

Applications are not always very complex…

The Active Semantic Doc picture: a doctor's file with annotations

Data Integration R&D

MuseoSuomi Application dump Traditional Chinese medicine example dump

Example: antibodies demo

Antibodies' demo screen dump

Example: ontology controlled annotation

Pfizer's application

Portals

Vodafone screen dump

OKAR Fujitsu's and Ricoh's OKAR

Okar structural image

Adobe's XMP

XMP Application dump

Improved Search via Ontology: GoPubMed

GoPubMed Application dump

Creative Commons

CC logos

Baby CareLink

XMP Application dump

Other Application Areas Come to the Fore

 

Thank you for your attention!

These slides are publicly available on:

http://www.w3.org/People/Ivan/CorePresentations/RDFTutorial/

in XHTML and PDF formats; the XHTML version has active links that you can follow