Semantic Web - Computer Networks

cluckvultureInternet and Web Development

Oct 20, 2013 (3 years and 9 months ago)

78 views

Semantic Web

Department of Computer Science
Institute for System Architecture, Chair for Computer Networks

2

Classical Web approach


The classical web and its extensions are designed to present
information to human beings and not to be processed by computer
programs


Resources are connected with each other via hyperlinks


There are two main problems:

1.
Search is inefficient and results are often wrong or incomplete


(e.g. multistage search is not possible)

2.
It is not possible to automate tasks in a simple manner based on
information published in the web

web content

((X)HTML, XML,

AJAX applications …)


Search engine

presented in web browser

publisher

user

databases

. . .

3

Example for a problem…

Advertisement?

Useful information?

Advertisement?

Useful information?

There needs to be
a
universal

way to
add information
about information




Pages have to
be
annotated with
metadata

How can a computer

program “know”?

4

The Semantic Web vision


By adding additional information about data, web content becomes
machine processable and thus computer programs and especially
software agents can do special tasks based on the published
information


Resources are not only connected by hyperlinks but by semantics and
semantic links


Applications combine information from different sources and do
reasoning in order to generate additional information

annotated

website

web service

user

applications

software agent

search engine

book

annotated

website

annotated

website

person

5

Simple scenario



Hospital’s Website

1

1

Appointment

calendar

agent

2

2

“I have some problems with my
backbone
-

contact a doctor”

Check for possible dates

3

Search engine

3

Ask for a good orthopaedist in a
radius of 50 km

4

Find out the consultation hour

5

Make an appointment,
November 09, 3.00 p.m.

4

5

6

6

Notification about appointment
for user and calendar

Additional data

6

Necessary components


What is necessary to make complex data machine
processable in a standardised way?

1.
Language for data exchange


XML

2.
Identifiers for arbitrary resources


Uniform Resource Identifier Reference (URIref)

3.
Standardised data model to describe / connect resources


Resource Description Framework (RDF)

4.
Some way to define the allowed vocabulary and
restrictions for the data model


RDF Schema, Web Ontology Language (OWL)

5.
A possibility to query for resources / information


SPARQL Protocol and RDF Query Language (SPARQL)

6.
Logic and reasoning approaches to combine and deduce
information (not discussed here)


OWL, classical inference mechanisms

7

Semantic Web stack



Semantic Web specifications / standards are released by the W3C

URI

Unicode

XML

Data interchange: RDF

RDF Schema

SPARQL

OWL

Rules: RIF

Unifying logic

Signature

Encryption

Proof

Trust

User interface & applications

Unicode:


A character code that
defines every character in
most of the speaking
languages in the world;
e.g. XML uses UTF
-
8 (1
Byte encoded Unicode
characters) as default

RIF:


Rule Interchange Format

Allows uniform
representation of rule
systems for automated
inference of further
knowledge out of existing
knowledge that is
represented in RDF

8

Resource Identifier


Concept of Uniform Resource Identifier (URI) makes it
possible to identify


Individuals


Properties


Kinds of things


Values of properties etc.


URI =
scheme
:
scheme specific part






URI are extended to URI references (URIref) by the optional
use of fragment identifiers to identify a portion of resources:


URI [+ ‘#’ + fragment identifier]= URIref


E.g. http://www.hospital.org/departments#orthopaedy

http
:
//www.example.com

urn
:
3540205683

mailto
:
person@example.com

URN:

Uniform Resource Name

A special URI (with the scheme ‘urn’)
used to represent things such as
ISBNs or RFCs

9

RDF Model


RDF is a language for representing information about
resources, especially for web content metadata


A statement about a resource is in the form of a


subject
-
predicate
-
object

expression (a so called RDF triple)


Due to this it is possible to make statements like


http://www.somedomain.com/index.html has an author whose value is
Arthur Dent


http://www.hospital.org/department#orthopaedy

has consultation hour
at 03.00 p.m.

http://www.somedomain.com/index.html

Arthur Dent

http://www.somedomain.com/term#author

subject

(resource that has a special property)

object

(value of the property)

predicate


(property)

10

http://www.hospital.org/term#consultationHour

RDF Model

.


Object of one statement can be subject of another


Possibility of combining statements to more complex ones

http://www.hospital.org/department#orthopaedy

03.00 p.m.

http://www.hospital.org/staffid#2342

Juri Schiwago

“42”^^<http://www.w3.org/2001/XMLSchema#integer >

Dr.

http://www.hospital.org/term#name

http://www.hospital.org/term#title

http://www.hospital.org/term#age

http://www.hospital.org/term#hasHead

11

RDF/XML


The most common way of serialising RDF information is the use
of XML




<?xml version="1.0"?>

<!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]>


<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:term="http://www.hospital.org/term#"


xml:base="http://www.hospital.org/staffid#">




<rdf:Description rdf:about="http://www.hospital.org/departments#orthopaedy">


<term:consultationHour>03.00 p.m.</term:consultationHour>


<term:hasHead rdf:resource="2342"/>


</rdf:Description>


<rdf:Description rdf:ID="2342">


<term:name>Juri Schiwago</term:name>


<term:age rdf:datatype="&xsd;integer">42</term:age>


<term:title rdf:datatype="&xsd;string">Dr.</term:title>


</rdf:Description>

</rdf:RDF>

XML declaration

namespace

declaration


RDF statements

Introduces

abbreviation

12

RDF Schema

Class

Defines a class

Property

Defines a property

subClassOf

Defines inheritance hierarchy of classes (transitive)

subPropertyOf

Defines inheritance hierarchy of properties (transitive)

domain

Any resource that has a given property is defined as
instance of one or more specified classes

range

The values of a property are defined to be instances of
one or more specified classes

Main language constructs


RDF only defines Syntax for data representation


RDFS is a language to define RDF vocabulary and to structure
RDF resources by:

1.

Defining classes

2.

Defining properties

3.

Describing class hierarchies

4.

Describing property hierarchies

5.

Specifying the domain (subjects class) and the range
(objects class) of properties

13

RDFS example

Staff
membe
r

Administratio
n staff
member

rdfs:subClassOf


Academic
staff
member

Technical
support staff
member

rdfs:subClassOf

rdfs:subClassOf

department

hasHead

rdfs:range

rdfs:domain

http://www.hospital.org/staffid#2342

Juri
Schiwago

type

hasName

rdfs:domain

&xsd;string

rdfs:range

RDFS

classes

RDF

instances

type

type

hasName

14

RDF Schema

<?xml version="1.0"?>

<!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]>


<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:rdfs="http://www.w3.org/2000/01/rdf
-
schema#">


<rdf:Description rdf:ID="StaffMember">


<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf
-
schema#Class"/>

</rdf:Description>


<rdfs:Class rdf:ID="Department"/>


<rdfs:Class rdf:ID="AcademicStaffMember">


<rdfs:subClassOf rdf:resource="#StaffMember"/>

</rdfs:Class>


<rdf:Property rdf:ID="hasHead">


<rdfs:domain rdf:resource="Department"/>


<rdfs:range rdf:resource="AcademicStaffMember"/>

</rdf:Property>


. . .


</rdf:RDF>

abbreviation

15

Instantiating RDFS classes

<?xml version="1.0"?>

<!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]>


<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:term="http://www.hospital.org/term#"




<term:Department rdf:ID="orthopaedy">


<term:hasHead rdf:ID="2342">


</term:Department>



<term:AcademicStaffMember rdf:ID="2342"/
>


<term:hasName rdf:datatype="&xsd;string">


Juri Schiwago


</term:hasName>


</term:AcademicStaffMember>


</rdf:RDF>

location of

the defined

RDF Schema

16

Shortcomings of RDFS


Although RDFS provides basic capabilities to describe RDF
vocabulary, it still lacks sufficient expressive power


It is not possible to describe e.g.:


Cardinality constraints on properties


“a department has one and
only

one head”


Disjunctive properties / classes


“a technical support staff member can not be an
academic staff member”


Inverse functions


“hasHead is the inverse function of isHeadOf”


A class by the use of other classes


“the class ‘staff member’ is defined by conjunction of
the classes ‘Administration staff member’, ‘Academic
staff member’ and ‘Technical support staff member’ ”



For more complex relationships a further layer is necessary:



Web Ontology Language (OWL)

17

OWL


OWL is a logic based language to define and instantiate formal
ontologies


Designed as extension of RDFS


An ontology describes existing entities in a special domain and
how these entities are related


OWL supports reasoning with generic tool support



syntax

semantics

XML

RDF

RDFS

structure

connected

knowledge

Data Exchange

Relational model

ontology

abstraction

OWL

18

OWL


Some important language constructs:



Ontology

Defines assertions about the ontology,
especially import of other ontologies

equivalentClass

Equivalence between classes

allValuesFrom

Universal quantification

someValueFrom

Existential quantification

functionalProperty

P(x,y) and P(x,z) implies y = z

inverseFunctionalProperty

P(y,x) and P(z,x) implies y = z

sameAs

Defines identical individuals

inverseOf

P1(x,y) iff P2(y,x)

symmetricProperty

P(x,y) iff P(y,x)

transitiveProperty

P(x,y) and P(y,z) implies P(x,z)

disjointWith

Disjointness of a set of classes

19

OWL

<?xml version="1.0"?>

<!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >]>

<rdf:RDF


xmlns:owl = "http://www.w3.org/2002/07/owl#"


xmlns:rdf = "http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:rdfs= "http://www.w3.org/2000/01/rdf
-
schema#">


<owl:Ontology rdf:about="">



<owl:priorVersion>



<owl:Ontology rdf:about="http://www.somedomain.org/oldontology"/>



</owl:priorVersion>



<owl:imports rdf:resource="http://www.somedomain.org/furtherontology"/>



<rdfs:label>Hospital Ontology</rdfs:label>


</owl:Ontology>


. . .


<owl:Class rdf:Id="AcademicStaffMember">


<rdfs:subClassOf rdf:resource="#Person" />


<owl:disjointWith rdf:resource="AdministrativeStaffMember"/>


</owl:Class>


. . .


<owl:Class rdf:Id="Department">


<rdfs:subClassOf>


<owl:Restriction>



<owl:onProperty rdf:resource="#hasHead"/>



<owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>


</owl:Restriction>


</rdfs:subClassOf>



. . .


</owl:Class>

</rdf:RDF>

20

OWL sublanguages


To fulfil different requirements OWL is divided into three sublanguages
with increasing expressive power:

1.

OWL Lite


Subset of full OWL


Supports classification hierarchies and simple constraint
features, e.g. cardinality constraints

2.

OWL Description Logic (DL)


More powerful subset of OWL


Decidable fragment of first order logic; includes all OWL
constructs but defines special restrictions such as type
separation (e.g. an individual can not be a class)

3.

OWL Full


The complete Web Ontology Language


Allows free mixing with RDF Schema


Does not enforce a strict separation of classes, properties,
individuals and data values


Language is undecidable




Computability is not guaranteed

OWL Full

OWL DL

OWL Lite

21

SPARQL


SPARQL is a query language for RDF data and reduces the
complexity of information extraction in the semantic web


Query concept is comparable to the Structured Query
Language (SQL)


A query consists of a SELECT clause and a WHERE clause


Variables have the prefix “?” or “$”


PREFIX hosp: < http://www.hospital.org/terms#>

PREFIX dep: < http://www.hospital.org/departments#

>

SELECT ?hour


FROM < http://www.hospital.org/data.rdf >



WHERE { dep:orthopaedy hosp:consultationHour ?hour}

introduction of

abbreviations

Result:

hour


3.00 pm

specifies a

RDF graph

22

Example Schema: Friend of a Friend


“Friend of a Friend” (FOAF) is a project to build social networks by
describing persons and their relationships among each other

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:rdfs="http://www.w3.org/2000/01/rdf
-
schema#"


xmlns:foaf="http://xmlns.com/foaf/0.1/">


<foaf:Person>


<foaf:name>Vincent van Gogh</foaf:name>


<foaf:mbox rdf:resource="mailto:gogh@example.com"/>


<foaf:homepage rdf:resource="http://www.vincentshome.net"/>


<foaf:workplaceHomepage="http://www.vincentatwork.com"/>


<foaf:weblog rdf:resource="http://www.vincentshome.org/blog"/>


<foaf:phone rdf:resource="tel:00330642623623"/>



<foaf:img rdf:resource="http://www.vincentshome.net/mypicture.jpg" />


<foaf:jabberID>vangogh@jabber.org</foaf:jabberID>


<foaf:knows>


<foaf:Person>


<foaf:name>Theo van Gogh</foaf:name>


<foaf:mbox_sha1sum>cd4236a21ea61342e62341bd2d23e42eac2313dd


</foaf:mbox_sha1sum>


<rdfs:seeAlso rdf:resource="http://theovangogh.org/foaf.rdf"/>


</foaf:Person>


</foaf:knows>



</foaf:Person>

</rdf:RDF>

23

Ontology mapping


Two different book stores have published the following RDF
data:

isbn:3257204205

isbn:3257204205

A brief history of time

A brief history of time

Stephen Hawking

http://www.hawking.org.uk

Stephen Hawking

http://www.hawking.org.uk

term:title

term:name

term:homepage

ont:name

ont:internetseite

ont:autor

ont:titel

term:author

How can software deduce that


author = autor


homepage = internetseite


title = titel?

24

Ontology mapping


Usage of (de
-
facto
-
)standards for schemes/ontologies makes
unification possible


Below “name” and “homepage” are represented by using FOAF










isbn:3257204205

isbn:3257204205

A brief history of time

A brief history of time

term:title

foaf:name

foaf:homepage

foaf:name

foaf:homepage

ont:autor

ont:titel

term:author

foaf:Person

Stephen Hawking

http://www.hawking.org.uk

Stephen Hawking

http://www.hawking.org.uk

25

1. Internally linked annotations


W3C recommends the use of a


<link>
-
tag in the (X)HTML header:



2. Externally linked annotations


RDF data and external links have


to be accessible on a server



3. Embedded annotations


RDF data can be embedded in:


the html
-
header


an <object>
-

or <script>
-
tag


an html
-
comment


by using RDFa

Web content annotation possibilities

example.html

some RDF statements

example.html

data.rdf

example.html

data.rdf

external mapping

<link rel="meta" type="application/rdf+xml" href="data.rdf"/>

26










Data integration

Logic

ontology1.owl

XML

Logic

Personal information base

Appointment

calendar

Personal

interests

Past

activities

Social

connections

Public information base

Public information base

RDBMS

RDF

Logic

ontology2.owl

arbitrary software


RDF

HTML

Document

RDF

uses

information flow

includes


By using OWL and RDF it is possible to bring data from
different data sources to an uniform representation
which can be used by arbitrary software that is aware of
the semantics (e.g. knows OWL description)

27

Further approaches


The vision of a Semantic Web has been defined more than a
decade ago


Apart from dedicated applications e.g. in the domain of
bioinformatics a full realization is not in sight


Central drawbacks of the proposed approach for a Semantic
Web:


Complex standards, lack of tool support, ontology
matching problems


Several simplified approaches have been developed and are
already applied:

Pragmatic approaches for
realizing a simplified
Semantic Web

RDFa

Microformats

Microdata

28

RDFa


RDFa adds a set of attribute level extensions to XHTML for annotation
information within Web documents


Defines a set of attributes which can be used for adding
semantic information to XHTML tags


Examples for attributes:


rel:
whitespace separated list of URIs, used for expressing
relationships between two resources (
predicates

in RDF
terminology)


href:
a URI for expressing the partner resource of a relationship
(
resource object
in RDF terminology)


about:

a URI, used for stating what the data is about (
subject

in
RDF terminology)


property:
a whitespace separated list of URIs, used for
expressing relationships between a subject and some literal text
(also a
predicate

in RDF terminology)


typeof:

a whitespace separated list of URIs that indicate the
RDF type(s) to associate with a subject

29

Example taken from:

http://www.w3.org/TR/xhtml
-
rdfa
-
primer/

RDFa

example

<div xmlns:foaf="http://xmlns.com/foaf/0.1/" about="#me" rel="foaf:knows">


<ul>


<li typeof="foaf:Person">


<a property="foaf:name" rel="foaf:homepage" href="http://example.com/bob">Bob</a>


</li>


<li typeof="foaf:Person">


<a property="foaf:name" rel="foaf:homepage" href="http://example.com/eve">Eve</a>


</li>


<li typeof="foaf:Person">


<a property="foaf:name" rel="foaf:homepage" href="http://example.com/manu">Manu</a>


</li>


</ul>

</div>

30

Microformats


Microformats = approach to semantic markup reusing existing
(X)HTML tags to describe metadata and to make recognizable data
items capable of automated processing by software


No responsible standardization organization for formats; defined by
an open community


Microformats are available for various different areas such as for
events (hCalendar), for contact information (hCard), for products
(hProduct), for reviews (hReview) or for news content (hNews)


Formats are listed at: http://microformats.org/


Most important (X)HTML attribute:
class
for describing the type of
information

<ul class="vcard">


<li class="fn">Smith</li>


<li class="org">ACME Company</li>


<li class="tel">1234
-
4321</li>


<li><a class="url„ href="http://example.com/">



http://example.com/


</a>


</li>

</ul>

Name

Associated
organization

Website
associated to
entity

31

Microdata


Microdata

is a simple approach to embed semantics directly
into HTML pages proposed by the W3C and embedded into
HTML5


Two core concepts:


Item
: Entity that is described; content of HTML tag is
marked as item using the
attribute

itemscope


Property
: name
-
value pair describing concrete
characteristics of an item; content of HTML tag is marked
as property using the attribute
itemprop






<div itemscope><p>The first customer is called


<span itemprop="name">Elizabeth</span>.</p>

</div>

<div itemscope><p>The second customer is called


<span itemprop="name">Daniel</span>.</p>

</div>

Defines a
new item

Defines a
property with
key
"
name
"

of
the item

32

Microdata


Three further attributes have been intoduced:


itemid
: specifies
unique identifier of the item


itemtype
:
valid URL of a vocabulary used for items and properties


itemref

:

associates properties that are not descendants of the
element with the itemscope attribute with the item (via item id)


Vocabulary is described informally

<div itemscope
itemtype
=
"
http://data
-
vocabulary.org/Person
"


itemid
="urn:uuid:f3373a7b
-
4958
-
4e55
-
8820
-
d03a191fb76a">



The name of the customer is


<span
itemprop
="name">Bob Michael</span>


His homepage is available here:


<a href="http://www.example.com"
itemprop
="url">

www.example.com</a>


He has got a <span
itemprop
="title">Phd</span> title from

<span itemprop="affiliation">ACME University</span>.

</div>

<p itemscope


itemref
="
urn:uuid:f3373a7b
-
4958
-
4e55
-
8820
-

d03a191fb76a
">The customer works at




<span
itemprop
="
affiliation
">ACME Company</span>.

</p>


33

Conclusion…

extraction of

(semi)structured

data

regular web content

extraction of

unstructured

data

ontology and scheme design

and editing tools

semantic web repository

OWL

data

RDFS

data

RDF

information

<html>



</html>

reference

include

information access

sharing

browsing

searching

visualising

summarising

human

software agent

arbitrary program

SPARQL

. . .

Knowledge engineer

frameworks

(de
-
facto
-
)standard ontologies

and schemes

personalised

information

<html>



</html>

<html>



</html>

<html>



</html>

<html>



</html>

RDFa

Microdata

Microformats

34

References

Links at W3C:



RDF Primer

http://www.w3.org/TR/rdf
-
primer/


OWL Guide

http://
www.w3.org/TR/owl
-
guide

OWL 2


http://www.w3.org/TR/owl2
-
overview/

SPARQL


http://www.w3.org/TR/rdf
-
sparql
-
query/

OWL
-
S


http://www.w3.org/Submission/OWL
-
S/

RDFa

Primer

http://www.w3.org/TR/xhtml
-
rdfa
-
primer/


Microdata


http://www.w3.org/TR/microdata/

specification