Introduction to the Semantic Web

Kjetil Kjernsmo <>.

NUUG Meeting, 2011-01-11.

Creative Commons Attribution-Sharealike 3.0 Norway License.



Connolly's Bane

The bane of my existence is doing things that I know the computer could do for me.

If the Web page with your personal calendar says you'll be in New York next Thursday, and the page with your workgroup calendar says you'll be in London all week, shouldn't the computer be able to warn you about the conflict? And shouldn't it go ahead and ask you if it's OK to cancel your flight to London and purchase this other ticket to New York?

Dan Connolly, 1998


Simple use cases


Distinguishing features

  • Economy of arbitrary combination.
  • The value of links.
  • ...and a dash of reasoning.

Where are we?

1996 of the Web

  • Lots of data.
  • Some mature standards, others in the works.
  • Big players coming on board. Governments (UK, Norway, US, etc), Yahoo, IBM, BestBuy, etc.)
  • Large deployment (e.g. Sindice, Garlik).
  • Tool support is somewhat lacking.
  • More developer training needed.

Available data

Open Data vs Linked Open Data

Available on the web (whatever format), but with an open licence
★★ Available as machine-readable structured data (e.g. excel instead of image scan of a table)
★★★ as (2) plus non-proprietary format (e.g. CSV instead of excel)
★★★★ All the above plus, Use open standards from W3C (RDF and SPARQL) to identify things, so that people can point at your stuff
★★★★★ All the above, plus: Link your data to other people's data to provide context

Tim Berners-Lee

Resource Description Framework (RDF)

404 Building not found
  1. From two documents to a triple.
    • Subject - Predicate - Object
  2. Add semantics to the link.
  3. Generalize the URI to identify anything.
  4. The object can be a string (with language or datatype).


Turtle syntax:

<> a foaf:Person ;
    foaf:name "Kjetil Kjernsmo" ;
    rel:parentOf <> .

<> a foaf:Person ;
    foaf:givenName "Synne" ;
    bio:event [ bio:date "2008-11-25"^^xsd:date ;
                a bio:Birth ] .

Describing and organizing your world

Continuum of technologies for building ontologies.

Ontology Spectrum

Originally from AAAI 1999- Ontologies Panel by Gruninger, Lehmann, McGuinness, Uschold, Welty; – updated by McGuinness.

Simple Knowledge Organization System (SKOS)

  • "Anything goes"-modelling
  • Defines broader and narrower relations (taxonomy)
  • Transitive and non-transitive relations
  • cross-links is built-in but any extension is accomodated for.
  • ABC Startsiden's catalog available as SKOS under CC license.

SKOS Example

@base <> . 
<> dc:title 
     "The world according to Synne, aged 1,
       as recorded by her parents"@en ;
     foaf:maker <> .

<#vovv> a skos:Concept ;
     skos:prefLabel "Vovv-vovv" ;
     skos:narrower <#fur> . 

<#fur> a skos:Concept ;
     skos:prefLabel "Fur"@en ;
     owl:sameAs <> .

Web Ontology Language (OWL)

@base <> . 
<> dc:title 
     "The world according to Synne, as recorded 
       by her parents, take two"@en ;
     foaf:maker <> .

<#gakk> a owl:Class
     rdfs:label "Gakk-gakk" ;
     owl:unionOf <#badeand>, <#real-duck> .

<#badeand> a owl:Class ;
     rdfs:label "Badeand"@no .

OWL continued

<#real-duck> a owl:Class ;
     rdfs:label "Ender, gjess, svaner"@no ;
     rdfs:label "Duck, geese, swans"@en ;
     owl:sameAs <>

<#vovv> a owl:Class ;
     rdfs:label "Vovv-vovv" ;
     owl:disjointWith <#gakk> .

<#tux> a <#vovv> ;
     rdfs:label  "Tux, the Linux penguin"@en ;
     foaf:page <> .

Build your world

Don't let anyone force their ontology on you!


Economy makes it wise to adopt when you can

Unexpected reuse makes it wise to map when you can


A query language for the Semantic Web

Hides complexity

SELECT ?childname WHERE {
  ?parent a foaf:Person ;           
          rel:parentOf ?child .
  ?child  foaf:givenName ?childname .
  ?parent a foaf:Person ;           
          rel:parentOf ?child .

Real, big SPARQL example

PREFIX geo: <>
PREFIX foaf: <>
PREFIX mo: <>

SELECT ?name ?homepage ?place ?population 
{ ?artisturi a mo:MusicArtist ; 
     foaf:based_near ?placeuri ; 
     foaf:name ?name .
  OPTIONAL { ?artisturi foaf:homepage ?homepage . }
     geo:name ?place ; 
     geo:inCountry <> .
  OPTIONAL {?placeuri geo:population ?population .   }
ORDER BY ?population

RDF classes in Object Oriented Programming

High object-relational impedance mismatch

Schema migration is usually painful

RDF and the Metaobject protocol is an interesting topic!

  • Chris Prather's Class::OWL - Class::MOP-based. Master thesis available!
  • Clark & Parsia's Empire

Bridging technologies

RDFa - embedding RDF in (X)HTML

  • A collection of attributes and processing rules for extending XHTML to support RDF
  • W3C Recommendation 14 October 2008
<div xmlns:dc="">
   <h2 property="dc:title">The trouble with Bob</h2>
   <h3 property="dc:creator">Alice</h3>
  • RDFa 1.1 is needed
  • HTML5 may get a "microdata" syntax.

GoodRelations ontology

<div typeof="product:Product gr:ProductOrServicesSomeInstancesPlaceholder" about="">
  <span rel="rdfs:seeAlso" resource=""></span>
  <div id="proddetails">
    <h2 property="rdfs:label">Mac OS X v10.6 Snow Leopard: Mac</h2>

<div rel="gr:hasPriceSpecification" id="price">
  <h3>Reg. Price:</h3>
  <span typeof="gr:UnitPriceSpecification" about="">
    $<span property="gr:hasCurrencyValue" datatype="xsd:float">29.99</span>
    <span property="gr:hasCurrency" datatype="xsd:string">USD</span>
    <span property="gr:priceType" content="SRP" datatype="xsd:string"></span>
    <span property="gr:hasUnitOfMeasurement" datatype="xsd:string" content="C62"></span>
    <span property="gr:valueAddedTaxIncluded" datatype="xsd:boolean" content="true"></span>

Further Semantic Web standards

Also WebID ("OpenID done right").

Practical shortcomings

  • Lack of complete stack
  • Immaturity
  • Performance problems
  • RDF itself:
    • Ordered lists
    • Units of numbers
    • "who said that"
    • graph naming

Software you can try