semantic technologies in practice – introduction to part iievabl45/files/session1.pdf · den...

72
Semantic Technologies in Practice – Introduction to Part II Eva Blomqvist 2012-09-17 September 13, 2012 1

Upload: others

Post on 02-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Semantic Technologies in Practice – Introduction to Part II

Eva Blomqvist 2012-09-17

September 13, 2012 1

Page 2: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Outline

n  Course information n  Introduction to the Semantic Web and the Web of Data n  Re-engineering and publishing of linked data

September 13, 2012 2

Page 3: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Course information

September 13, 2012 3

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 4: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Course information – Web page

n  http://www.ida.liu.se/~evabl45/semtechpracticecourse.en.shtml n  Part I – if you feel you need to freshen up your background n  Part II – slides, other material n  Part III – ideas on course projects

September 13, 2012 4

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 5: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Course requirements – Part II (4hp)

n  Attendance at the seminars q  If you cannot attend, let me know and you will get some reading

material instead + write a summary q  Exercises are completed on your own q  Deadline 30/11 for all seminars

n  Completing the exercises q  Exercises can be done individually or in groups of 2 (max) q  Hand in through e-mail q  If you are not finished at the end of the session?

n  Complete the tasks and send result by e-mail n  DEADLINE for seminar exercises – 30/11 n  Firm deadline – no second chance

q  What does “complete” mean? n  Hand in your result, it does not have to be completely correct but

you have to show that you have tried and done the whole exercise!

September 13, 2012 5

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 6: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Course idea – Part II

n  Meet international researchers in the field and get an idea of the spectrum of research on applications of semantic technologies

n  Get a hands-on feeling for some of the technologies that exist and are used by practitioners today

n  Get to know some tools n  Get ideas for how to use semantic technologies

(practically) in your own projects n  Get ideas for Part III

n  What it’s not about: q  Knowing all the details of tools and formats q  Theory (at least not that much...)

September 13, 2012 6

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 7: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Schedule

n  20/9, 10-16 (John von Neumann) - Fabio Ciravegna teaches how to use semantic technologies for analyzing social media data

n  ?? – Collaborative ontology engineering using XD

n  29/10, 10-16 (John von Neumann) - Kurt Sandkuhl (topic is still under preparation)

n  31/10, 13-15 (Alan Turing) + 1/11, 9-12 (John von Neumann) - Valentina Presutti teaches how to use semantic technologies for handling and enhancing CMS content

September 13, 2012 7

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 8: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Introduction to the Semantic Web and the Web of Data

September 13, 2012 8

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 9: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Web vs. Semantic Web

Page 10: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

What do you see?

Semantik gör webben smartare Publicerad av CIO Sweden

Morgondagens internet är inte bara anpassat för människor. Nya lösningar gör att maskiner kan göra smartare sökningar.

Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än som en helt ny webb. Internet är en underbar uppfinning. Inte minst den del som kallas World Wide Web, eller webben, och som gör det möjligt att söka sig fram i en grafisk miljö via hyperlänkar. Det funkar på många sätt utmärkt – för oss människor. Vi kan presentera dokument som visas på skärmar runt om hela jordklotet och andra människor kan, förutsatt att det språk som används är begripligt för båda parter, ta del av informationen. Men för maskinen är det värre. Webben av idag är läsbar för maskiner. Men den är inte förståbar. … Av: Robert Brännström [email protected]

Page 11: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

What does a computer see?

Semantik gör webben smartare Publicerad av CIO Sweden Morgondagens internet är inte bara anpassat för människor. Nya lösningar gör att maskiner kan göra smartare sökningar.

Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än som en helt ny webb. Internet är en underbar uppfinning. Inte minst den del som kallas World Wide Web, eller webben, och som gör det möjligt att söka sig fram i en grafisk miljö via hyperlänkar. Det funkar på många sätt utmärkt – för oss människor.��Vi kan presentera dokument som visas på skärmar runt om hela jordklotet och andra människor kan, förutsatt att det språk som används är begripligt för båda parter, ta del av informationen. ��Men för maskinen är det värre. Webben av idag är läsbar för maskiner. Men den är inte förståbar. �…��Av: Robert Brännström�[email protected]

Page 12: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

But what about XML tags?

<titel> Semantik gör webben smartare</titel> Publicerad av <utgivare> CIO Sweden </utgivare>

<ingress> Morgondagens internet är inte bara anpassat för människor. Nya lösningar gör att maskiner kan göra smartare sökningar. </ingress>

<brödtext> Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än som en helt ny webb. Internet är en underbar uppfinning. Inte minst den del som kallas World Wide Web, eller webben, och som gör det möjligt att söka sig fram i en grafisk miljö via hyperlänkar. Det funkar på många sätt utmärkt – för oss människor. Vi kan presentera dokument som visas på skärmar runt om hela jordklotet och andra människor kan, förutsatt att det språk som används är begripligt för båda parter, ta del av informationen. Men för maskinen är det värre. Webben av idag är läsbar för maskiner. Men den är inte förståbar. … </brödtext> Av: <författare> Robert Brännström </författare> <e-post> [email protected] </e-post>

Page 13: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

However…

<titel> Semantik gör webben smartare</titel> Publicerad av <utgivare> CIO Sweden </utgivare>

<ingress> Morgondagens internet är inte bara anpassat för människor. Nya lösningar gör att maskiner kan göra smartare sökningar. </ingress>

<brödtext> Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än som en helt ny webb. Internet är en underbar uppfinning. Inte minst den del som kallas World Wide Web, eller webben, och som gör det möjligt att söka sig fram i en grafisk miljö via hyperlänkar. Det funkar på många sätt utmärkt – för oss människor.��Vi kan presentera dokument som visas på skärmar runt om hela jordklotet och andra människor kan, förutsatt att det språk som används är begripligt för båda parter, ta del av informationen. ��Men för maskinen är det värre. Webben av idag är läsbar för maskiner. Men den är inte förståbar. �… </brödtext> Av: <författare> Robert Brännström </författare> <e-post> [email protected] </e-post>

Page 14: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Semantic tags?

<dc:title> Semantik gör webben smartare</dc:title> Publicerad av <dc:publisher> CIO Sweden </dc:publisher>

<dc:abstract> Morgondagens internet är inte bara anpassat för människor. Nya lösningar gör att maskiner kan göra smartare sökningar. </dc:abstract>

<example:content> Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än som en helt ny webb. Internet är en underbar uppfinning. Inte minst den del som kallas World Wide Web, eller webben, och som gör det möjligt att söka sig fram i en grafisk miljö via hyperlänkar. Det funkar på många sätt utmärkt – för oss människor.��Vi kan presentera dokument som visas på skärmar runt om hela jordklotet och andra människor kan, förutsatt att det språk som används är begripligt för båda parter, ta del av informationen. ��Men för maskinen är det värre. Webben av idag är läsbar för maskiner. Men den är inte förståbar. �… </example:content> Av: <dc:creator> Robert Brännström </dc:creator> <foaf:mbox> [email protected] </foaf:mbox>

Page 15: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Resources for the Semantic Web

n  Metadata q  Resources are marked-up with descriptions of their content. q  No good unless everyone speaks the same language

n  Terminologies q  Provide shared and common vocabularies of a domain, so

search engines, agents, authors and users can communicate.

q  No good unless everyone means the same thing n  Ontologies

q  Provide a shared and common understanding of a domain that can be communicated across people and applications, and will play a major role in supporting information exchange and discovery

Page 16: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

The Semantic Web Layers

Page 17: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

RDF

n  RDF stands for Resource Description Framework

n  It is a W3C Recommendation q  http://www.w3.org/RDF

n  RDF is a graphical formalism (+XML syntax + semantics) q  for representing (meta)data q  for describing the semantics of information in a machine-

accessible way

n  Provides a simple data model based on triples

Page 18: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

RDF Data Model

n  Statements are <subject, predicate, object> triples: q  <Sean,hasColleague,Ian>

n  Can be represented as a graph:

n  Statements describe properties of resources

n  A resource is any object that can be pointed to by a URI: q  A document, a picture, a paragraph on the Web,

http://www.cs.man.ac.uk/index.html, a book in the library, a real person (?), isbn://0141184280

n  Properties themselves are also resources (URIs)

Page 19: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Linking RDF Statements

n  The subject of one statement can be the object of another

n  Such collections of statements form a directed, labeled graph

n  Note that the object of a triple can also be a “literal”

(e.g. a string)

Page 20: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

What does RDF give us?

n  A mechanism for annotating data and resources. q  Supported by for instance RDFa as a link to “normal” web

pages

n  Single (simple) data model.

n  Syntactic consistency between names (URIs).

n  Low-level integration of data. q  E.g., through “same as”-statements

Page 21: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Querying RDF using SPARQL

<http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> "SPARQL Tutorial" .

SELECT ?title WHERE {

<http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> ?title . }

"SPARQL Tutorial"

Page 22: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Linked Data - http://linkeddata.org/

n  RDF data published on the web according to a set of principles: 1.  Use URIs as names for things 2.  Use HTTP URIs so that people can look up those names 3.  When someone looks up a URI, provide useful

information, using the standards (RDF, SPARQL) 4.  Include links to other URIs, so that they can discover more

things n  The 5-star model to grade the datasets n  Linking Open Data Project – LOD

q  An initiative to publish open linked data on the web

Page 23: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

LOD data

Page 24: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

A LOD Example: DBPedia

n  Extracts structured information (RDF) from Wikipedia n  Browsable through a number of tools

(see http://wiki.dbpedia.org/OnlineAccess) n  Queryable through SPARQL endpoint(s) n  Example query to DBPedia: “All soccer players,

who played as goalkeeper for a club that has a stadium with more than 40.000 seats and who are born in a country with more than 10 million inhabitants”

Page 25: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Microformats

n  Embedding “semantic” information directly into the (X)HTML – “semantic” in the human sense

n  Introduces new values for existing XHTML attributes

“license” is a reserved keyword, for expressing a licensing relation è there are no namespaces!

n  Drawback – no formal definition of the “keywords”

distributed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons License</a>

Page 26: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

The hCard Microformat

n  hCard is a microformat representation of the common vCard format – embedding vCards into HTML

n  http://microformats.org/wiki/hcard

<div class="vcard"> <a class="url fn" href="http://tantek.com/"> Tantek Çelik </a> </div>

BEGIN:VCARD VERSION:3.0 N:Çelik;Tantek FN:Tantek Çelik URL:http://tantek.com END:VCARD

Page 27: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Semantic Annotations - RDFa

n  Embedding RDF data in HTML pages q  RDF data is produced in a simple manner q  Can be connected to some formal interpretation (ontology)

n  Uses XML namespaces to refer to the definition of the concepts used, e.g., the Dublin Core ontology

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

<div xmlns:dc="http://purl.org/dc/elements/1.1/"> <h2 property="dc:title">The Trouble with Bob</h2> <h3 property="dc:creator">Alice</h3> </div>

Page 28: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Querying RDFa

Page 29: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Querying RDFa

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/"> <head profile="http://www.w3.org/1999/xhtml/vocab"> <title>Alice in Semantic Wonderland</title> <base href="http://example.com/alice"></base> <link rel="stylesheet" type="text/css" href="http://www.w3.org/2006/07/SWD/RDFa/primer/style.css" /> </head> <body> <h1>Alice in Semantic Wonderland</h1> <div id="meta"><a href="http://tinyurl.com/5v7jzc"> <img src="http://www.w3.org/Icons/SW/Buttons/sw-rdfa-gray.png" alt="get metadata in RDF Turtle"/></a> </div> <div about="/posts/trouble_with_bob"> <h2 property="dc:title">The trouble with Bob</h2> <h3 property="dc:creator">Alice</h3> <p>The trouble with Bob is that he takes much better photos than I do:</p> <div class="imgbox" about="http://www.w3.org/2006/07/SWD/RDFa/primer/sunset.jpg"> <img src="http://www.w3.org/2006/07/SWD/RDFa/primer/sunset.jpg" alt="sunset" /> <div><span property="dc:title">Beautiful Sunset</span> by <span property="dc:creator">Bob</span>. </div> </div> … </body> </html>

Page 30: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Querying RDFa

@prefix dc: <http://purl.org/dc/elements/1.1/>. @prefix foaf: <http://xmlns.com/foaf/0.1/>. @prefix cc: <http://creativecommons.org/ns#>. <http://example.com/alice> cc:license <http://creativecommons.org/licenses/by/3.0/>; <http://example.com/posts/trouble_with_bob> dc:creator "Alice";

dc:title "The trouble with Bob". <http://example.com/alice#me> a foaf:Person;

foaf:knows [ a foaf:Person; foaf:homepage <http://example.com/manu>; foaf:name "Manu" ], [ a foaf:Person; foaf:homepage <http://example.com/bob>; foaf:name "Bob" ], [ a foaf:Person; foaf:homepage <http://example.com/eve>; foaf:name "Eve" ]; foaf:mbox <mailto:[email protected]>; foaf:name "Alice Birpemswick"; foaf:phone <tel:+1-617-555-7332> .

</2006/07/SWD/RDFa/primer/sunset.jpg> dc:creator "Bob";

dc:title "Beautiful Sunset" . <http://example.com/posts/jos_barbecue> dc:creator "Eve";

dc:title "Jo's Barbecue" .

Page 31: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Querying RDFa

@prefix dc: <http://purl.org/dc/elements/1.1/>. @prefix foaf: <http://xmlns.com/foaf/0.1/>. @prefix cc: <http://creativecommons.org/ns#>. <http://example.com/alice> cc:license <http://creativecommons.org/licenses/by/3.0/>; <http://example.com/posts/trouble_with_bob> dc:creator "Alice";

dc:title "The trouble with Bob". <http://example.com/alice#me> a foaf:Person;

foaf:knows [ a foaf:Person; foaf:homepage <http://example.com/manu>; foaf:name "Manu" ], [ a foaf:Person; foaf:homepage <http://example.com/bob>; foaf:name "Bob" ], [ a foaf:Person; foaf:homepage <http://example.com/eve>; foaf:name "Eve" ]; foaf:mbox <mailto:[email protected]>; foaf:name "Alice Birpemswick"; foaf:phone <tel:+1-617-555-7332> .

</2006/07/SWD/RDFa/primer/sunset.jpg> dc:creator "Bob";

dc:title "Beautiful Sunset" . <http://example.com/posts/jos_barbecue> dc:creator "Eve";

dc:title "Jo's Barbecue" .

Who is the creator of the post with the title "The trouble with Bob"? PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?creator_of_post FROM <http://www.w3.org/2007/08/pyRdfa/extract?uri=

http://www.w3.org/2006/07/SWD/RDFa/primer/alice-example.html> WHERE { ?post dc:title ?post_title ;

dc:creator ?creator_of_post . FILTER regex(?post_title, "The trouble with Bob", "i") }

Page 32: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

September 13, 2012 32

Reengineering and Refactoring

Slides partly by Aldo Gangemi, STLab, ISTC-CNR, Italy

Page 33: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Why do I need transformations?

n  A scenario q  my system fetches knowledge from different sources in

LOD q  each of these sources uses its own ontology/vocabulary

n  Another scenario q  I have legacy data in a DB or in a custom XML format q  This data should be integrated with RDF data

How to arrive at a homogeneous representation of knowledge expressed with

heterogeneous schemas/vocabularies?

Page 34: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

the Web of Data is fed by “triplifiers”, tools able

to transform content to Linked Data

triplifiers implement various methods typically based on bulk recipes which allow for

no or limited customization of the process

lack of good practices for knowledge representation

and organization

the transformation relies on

predetermined implicit assumptions on the domain semantics of the

non-RDF data source

Motivations

Page 35: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

An Example

dbpedia: Bob_Marley

dbpedia: Person

foaf:name

“Bob Marley”

nyt: 65169961111056171853

skos: Concept

rdf:type

“Marley, Bob”

rdf:type

skos:prefLabel

I want to aggregate the two graphs

Page 36: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

A DB stores data and answers queries

laboratori data_di_fondazione

sede temi

STLab 2008 Italia Tecnologie Semantiche

LOA …. …. ….

‣ Aldo is 48 ‣ Aldo works in Rome ‣ Aldo does research on Semantic Web

‣ STLab was founded in 2008 ‣ STLab is in Italy ‣ STLab does research on semantic technologies

nome data di nascita

luogo_di_lavoro

temi

Aldo 08-16-962 Roma Semantic Web

Alfio …. …. ….

Persons Labs

Page 37: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Complex queries?

n  Who is interested in “Semantic Web” and is working in the same country as STLab is located?

37

workplace Rome

seat

Italy

same concept?

same country?

No  answer  

laboratori data_di_fondazione

sede temi

STLab 2008 Italia Tecnologie Semantiche

LOA …. …. ….

nome data di nascita

luogo_di_lavoro

temi

Aldo 08-16-962

Roma Semantic Web

Alfio …. …. ….

Persons Labs

Page 38: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

38

Is mapping enough?

mapped  ...  

And  this  one?  laboratori data_di_fo

ndazione sede temi

STLab 2008 Italia Tecnologie Semantiche

LOA …. …. …. ...  

...  

nome data di nascita

luogo_di_lavoro

temi

Aldo 08-16-962

Roma Semantic Web

Alfio …. …. ….

workplace Rome

seat

Italy same country?

Persons Labs

Page 39: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Publishing DB data as RDF on the Web

dbpedia:Rome

perscnr:Aldo

foaf:based_near

dbpedia:Italy

foaf:based_near

nome data di nascita

luogo_di_lavoro

temi

Aldo 08-16-962

Roma Semantic Web

Alfio …. …. ….

laboratori data_di_fondazione

sede temi

STLab 2008 Italia Tecnologie Semantiche

LOA …. …. ….

Persons Labs

labs:STLab

triplification

Page 40: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Data linking and querying on the web of data

dbpedia:Rome

perscnr:Aldo

foaf:based_near

dbpedia:Italy

foaf:based_near

dbpedia:Semantic_Web

foaf:topic_interest

labs:STLab

dbpedia:subdivisionName

•  Who is interested in “Semantic Web” and is working in the same country as STLab is located?

Page 41: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

How to answer really tough queries?

eurostat:Italien

owl:sameAs

4.8

eurostat:unemployment_rate_total

dbpedia:Rome

perscnr:Aldo

foaf:based_near

dbpedia:Italy

foaf:based_near

dbpedia:Semantic_Web

foaf:topic_interest

labs:STLab

dbpediap:subdivisionName

‣  Who is interested in “Semantic Web” and is working in a country where the unemployment rate is lower than 5%?

Page 42: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

42

Knowledge transformation issues

n  Syntactic interoperability bottleneck (platform + data model) q  e.g. rdb, eav, xml, text, prolog, N3 q  e.g. rdb with adjacency list, path enumeration

n  Semantic interoperability bottleneck (logical + conceptual level) q  e.g. rdb with: lexical, statistical, formal data q  e.g. two different databases on the same topic

n  Social, pragmatic interoperability bottleneck (privacy, sustainability, policy)

q  e.g. different requirements, organizational contexts, etc.

42  

Page 43: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Dealing with web semantics: current state n  Much enthusiasm, a lot of nice, different ideas n  Much confusion and mutual misunderstanding

between “scruffies” and “neats” q  Pushing formal semantics beyond its limits (e.g. the “owl:sameAs” dispute)

q  Doing ad-hoc apps q  Mixing up strings, classes, terms, concepts, topics,

tags, etc. q  Trivializing transformation from social to

formal semantics (e.g. when translating a syntactic frame directly to an OWL construct)

43 43  

Page 44: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Some techniques for semantic data reuse n  Virtual linked data

q  Automatic RDB schema conversion to RDFS q  RDB data browsing and on-demand automatic conversion to RDF q  Sample tools: Sparql endpoint+D2R q  Dataset example: IMDB q  +Time to usage –Flexibility

n  Ontology-based access with ad-hoc queries q  (DL-Lite) ontology to be designed separately q  Ad-hoc SQL query on RDB, “embedded” in class spec q  On demand ontology-based navigation q  Sample tools: Mastro+Quonto q  +Complexity –Flexibility –Time to usage

n  Physical linked data with custom ontologies q  Custom conversion of RDB/XML to one or more OWL ontologies q  Custom conversion of data to RDF-OWL datasets that can be published and queried q  Sample tools: Sparql endpoint+Semion q  Sample datasets: DBpedia, data.cnr.it q  +Flexibility ±Time to usage ±Complexity

n  Key aspects q  Mapping specification q  Consumable RDF data semantics 44

44  

Page 45: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Transformation patterns

n  Types of transformation patterns 1.  Direct structural morphism

:Broader rdf:type dbs:Table :Narrow_concept rdf:type dbs:Column :France rdf:type dbs:Datum

2.  Semantic interpretation

:Broader rdf:type owl:ObjectProperty :Narrow_concept rdf:type owl:Class :Paris :broader :France

45 45  

Broader Narrow concept Paris

Broad concept France

Broader Narrow concept Paris

Broad concept France

Page 46: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

46

Transformation patterns (cont.)

3.  Re-interpretation, e.g. through alignment patterns n  :Narrow_concept skos:Concept

q  also as mediated semantic interpretation q  also as revised semantic interpretation

4.  Production: new entities, vocabulary/string manipulation n  :Narrow_concept :Concept n  “plant flora plant_life” :Plant, :Flora, :PlantLife

46  

Page 47: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Semion – Example method

47 47  

Page 48: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

A common recipe

•  each table is a rdfs:Class •  each table record is an owl:Individual •  each table column is a rdf:Property

Page 49: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Example

Class: Person DatatypeProperty: firstName DatatypeProperty: lastName Individual: Person1

Type: Person Facts: firstName “Aldo” lastName “Gangemi”

Individual: Person2

Type: Person Facts: firstName “Valentina” lastName “Presutti”

Page 50: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Implications

q  Limited customization of the transformation process

q  Difficulty in adopting good practices of knowledge reengineering and ontology design

q  Limited exploitation of OWL expressivity for describing the domain

Page 51: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

just extract RDF triples!

express the domain semantics

Page 52: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

The Semion Reengineer

n  It does not add any semantics, but just the RDF format

n Semion needs the meta-model of the structure of the source (and some code)

n Currently supports RDB and XML

n Supported sources can be extended by providing new reengineering services as an OSGi bundle (not available yet)

Page 53: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Basic idea

Page 54: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

A meta-model for RDBs

Page 55: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Example of transformation of a DB Class: Table ObjectProperty: hasRecord

Domain: Table Range: Record inverseOf: isRecordOf

ObjectProperty: isRecordOf

Domain: Table Range: Record inverseOf: hasRecord

Individual: Person

Type: Table Facts: hasRecord AldoGangemi

Individual: AldoGangemi

Types: Record Facts: hasDatum AldoGangemiFirstName hasDatum AldoGangemiLastName isRecordOf Person

Page 56: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Reengineering Rules

n  Table -> individual of dbs:Table n  Column -> individual of dbs:Column n  Record -> individual of dbs:Record n  Field -> individual of dbs:Datum

Page 57: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Primary Keys

n  primary keys are used for URI generation

Individual: Person_stlab.istc-cnr1

Type: Record

Page 58: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Foreign Keys

n  Foreign keys identifies relations between tables and are mapped to relations between individuals

Individual: Person_stlab.istc-cnr1 Type: Record Facts: hasDatum Person_stlab.istc-cnr1_affiliation

Individual: Person_stlab.istc-cnr1_affiliation Type: Datum Facts: hasContent Institute_istc-cnr

Individual: Institute_istc-cnr Type: Record Facts: hasDatum Institute_istc-cnr_name

Page 59: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

…and for XML

Page 60: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

The Semion Refactorer

n  Allows to align a data set expressed with a specific vocabulary/ontology to another vocabulary/ontology

n  Is expressed as a set of rules n  Rules are expressed in a human readable syntax

called SemionRule Syntax and can be transformed into

q  SWRL rules for reasoning

q  SPARQL CONSTRUCT for pure refactoring

n  Rules realize recipes that can be saved (refactoring patterns)

Page 61: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Basic idea

ABox

TBox

Page 62: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

SemionRule Syntax

dbs = <http://ontologydesignpatterns.org/ont/iks/dbs_l1.owl#> . owl = <http://www.w3.org/2002/07/owl#> . myRule[

is(dbs:Table, ?x) . has(dbs:hasColumn, ?x, ?y) -> is(owl:Class, ?x)

]

as a SPARQL CONSTRUCT

PREFIX dbs: <http://ontologydesignpatterns.org/ont/iks/dbs_l1.owl#> . PREFIX owl: <http://www.w3.org/2002/07/owl#> . PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . CONSTRUCT{ ?x rdf:type owl:Class } WHERE{

?x rdf:type dbs:Table . ?x dbs:hasColumn ?y

}

Page 63: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

…and as a SWRL rule

<swrl:Variable rdf:ID=”x"/> <swrl:Variable rdf:ID=”y"/> <swrl:Imp> <swrl:body rdf:parseType="Collection">

<swrl:ClassAtom> <swrl:classPredicate rdf:resource="&dbs;Table"/> <swrl:argument1 rdf:resource="#x" />

</swrl:ClassAtom> <swrl:IndividualPropertyAtom>

<swrl:propertyPredicate rdf:resource=”&dbs;hasColumn"/> <swrl:argument1 rdf:resource="#x" /> <swrl:argument2 rdf:resource=”#y" /> </swrl:IndividualPropertyAtom> </swrl:body> <swrl:head rdf:parseType="Collection"> <swrl:ClassAtom>

<swrl:classPredicate rdf:resource="&owl;Class"/> <swrl:argument1 rdf:resource="#x" />

</swrl:ClassAtom> </swrl:head>

</swrl:Imp>

Page 64: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Stanbol Rule Syntax

in Stanbol a rule is defined as

ruleName[body -> head] where:

q  The ruleName identifies the rule q  The body is a set of atoms that must be satisfied when

evaluating the rule q  The head or consequent is a set of atoms that must be

true if the condition is evaluated to be true q  Both body and head consist of a list of conjunctive atoms

n  body = atom1 . atom2 . … . atomN n  head = atom1 . atom2 . … . atomM

q  The conjunction ∧ in Stanbol Rules is expressed with the symbol “ . ”

Page 65: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Sample rule

Considering Stanbol Rules, the FOL formula hasFather(x,y) ∧ hasBrother(y,z) ⇒ hasUncle(x,z)

becomes

myRule[ has(<http//myont.org/hasFather>, ?x, ?y) .

has(<http/myont.org/hasBrother>, ?y, ?z) ->

has(<http//myont.org/hasUncle>, ?x, ?z) ]

Page 66: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Namespace Prefixes

n  URIs are useful, but sometime too long for humans n  We can use namespace prefixes instead of full URIs in

rule atoms n  e.g: myont = <http://myont.org/> . myRule[ has(myont:hasFather, ?x, ?y) . has(myont:hasBrother, ?y, ?z) ->

has(myont:hasUncle, ?x, ?z) ]

Page 67: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Define a refactoring recipe

we want to use the FOAF vocabulary instead of SKOS

nyt: 65169961111056171853

skos: Concept

rdf:type

“Marley, Bob” skos:prefLabel

Page 68: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Define a refactoring recipe

skos = <http://www.w3.org/2004/02/skos/core#> .

foaf = <http://xmlns.com/foaf/0.1/> . conceptToPerson[ is(skos:Concept, ?x) ->

is(foaf:Person, ?x) ] . labelRule[ values(skos:prefLabel, ?x, ?y) ->

values(foaf:name, ?x, ?y) ]

Page 69: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

69

Exercise

n  Download Semion and launch it as follows:

q  (Mac) java -jar -Xmx512m -XstartOnFirstThread /LocalPathname/it.cnr.istc.semion.tool-0.6-SNAPSHOT.one-jar.jar

q  (Win) java -jar -Xmx512m \LocalPathname\it.cnr.istc.semion.tool-0.6-SNAPSHOT.one-jar.jar

n  Connect to the indicated database and perform reengineering first, and alignment (refactoring) second

Page 70: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

What about consuming data?

September 16, 2012 70

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 71: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

Linked Data and Ontologies

n  Tools listing: http://www.w3.org/2001/sw/wiki/Tools

n  APIs for handling ontologies q  Jena q  The OWL API

n  Communicating with an OWL reasoner: OWLlink protocol

n  Triple stores q  Usually provide SPARQL endpoints q  Data storage could be RDB

n  Linked data browsers and query interfaces

n  ...but end-users should not see the technology behind!

September 16, 2012 71

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden

Page 72: Semantic Technologies in Practice – Introduction to Part IIevabl45/files/Session1.pdf · Den semantiska webben är tänkt som en förlängning av den befintliga webben snarare än

September 13, 2012 72

Department of Computer and Information Science (IDA) Linköpings universitet, Sweden