SEMANTIC WEB TECHNOLOGIES: FUNDAMENTALS TOOLS FUNDAMENTALS, - - PowerPoint PPT Presentation

semantic web technologies fundamentals tools fundamentals
SMART_READER_LITE
LIVE PREVIEW

SEMANTIC WEB TECHNOLOGIES: FUNDAMENTALS TOOLS FUNDAMENTALS, - - PowerPoint PPT Presentation

SEMANTIC WEB TECHNOLOGIES: FUNDAMENTALS TOOLS FUNDAMENTALS, TOOLS, CASES AND BEST PRACTICES Luka Pavli University of Maribor Faculty of Electrical Engineering and Computer Science Johannes Kepler Universitt Linz , October 2010 Luka


slide-1
SLIDE 1

SEMANTIC WEB TECHNOLOGIES: FUNDAMENTALS TOOLS FUNDAMENTALS, TOOLS, CASES AND BEST PRACTICES

Luka Pavlič University of Maribor

Faculty of Electrical Engineering and Computer Science

Johannes Kepler Universität Linz , October 2010

slide-2
SLIDE 2

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 2

slide-3
SLIDE 3

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 3

slide-4
SLIDE 4

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 4

slide-5
SLIDE 5

Semantic web “success stories” Semantic web success stories

Oracle 10g Plugin

Inte g rira n re pozitorij Inte g rira n re pozitorij storite v

takso no mije + o nto lo gije + fo lkso no mije

L

  • c ira nje

L

  • c ira nje ,

pove zova nje , kla sific ira nje

sto ritev / viro v / po datko v / upo rabniko v

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 5

slide-6
SLIDE 6

Semantic web “success stories” Semantic web success stories

WWDot

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 6

slide-7
SLIDE 7

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 7

slide-8
SLIDE 8

Semantic web “success stories” Semantic web success stories

OBDPR

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 8

slide-9
SLIDE 9

Semantic web “success stories” Semantic web success stories

OBDPR

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 9

slide-10
SLIDE 10

Semantic web “success stories” Semantic web success stories

OSSP

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 10

slide-11
SLIDE 11

Semantic web “success stories” Semantic web success stories

OSSP

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 11

slide-12
SLIDE 12

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 12

slide-13
SLIDE 13

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 13

slide-14
SLIDE 14

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 14

slide-15
SLIDE 15

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 15

slide-16
SLIDE 16

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 16

slide-17
SLIDE 17

Agenda Agenda

  • F

d t l

  • Fundamentals

Web as we know it – concepts and technologies Semantics: how to present knowledge Ontologies and metadata: how to organize knowledge Ontologies and metadata: how to organize knowledge Standard XML-based technologies (XML, XML schema, XPath, XSLT…)

  • Typical scenarios, positives, negatives of using SW
  • How to build SW application ABC
  • How to build SW application: ABC
  • Core Technologies: RDF, OWL, SPARQL
  • Frameworks: overview
  • Using semantic web technologies in Java
  • KM and Integration examples
  • Current successful semantic web applications
  • Obstacles, Solutions
  • Future Trends
  • Project work: semantic applications

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 17

j pp

slide-18
SLIDE 18

Semantic web?!? Semantic web?!?

http://www.w3.org/2001/sw/ http://www.w3.org/standards/semanticweb/ http://www.w3.org/standards/semanticweb/ http://semanticweb.org/wiki/Main_Page

// / /

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 18

http://www.w3schools.com/semweb/default.asp

slide-19
SLIDE 19

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 19

slide-20
SLIDE 20

Data (usage) Data (usage)

W

We are pretty good at generating data.

Modern IT enables generating and storing HUGE

f d amount of data.

WWW anables that data to be globaly accessible.

What about using it?

Do people want more data? NO! They want more

services! E i d k l d b d d

Easier way to produce knowledge based on data =

“hard to find things”.

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 20

slide-21
SLIDE 21

Data (usage) Data (usage)

Ask Google about weather in Linz! What is the answer?

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 21

slide-22
SLIDE 22

Solution: use data wisely! Solution: use data wisely!

Example: domain oriented searching

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 22

slide-23
SLIDE 23

What seems to be the problem? What seems to be the problem?

Most data is represented as humen readable

documents.

Data organization: anarchy, URI based (WWW) Hard to find access mantain data Hard to find, access, mantain data So: is having data enough?

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 23

slide-24
SLIDE 24

What seems to be the solution? What seems to be the solution?

The idea: WHAT IF the machines would “know” the

meaning of the data?

Semantic web: let the data be understandable to

humans AND computers! p D t ith i !

Data with meaning! Data + meaning knowledge

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 24

slide-25
SLIDE 25

What if… ;) What if… ;)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 25

slide-26
SLIDE 26

Knowledge?!? Knowledge?!?

How to use knowledge? Infering! Explicitly stated knowledge implicit knowledge Examples:

All A are B. All B are C. All A are C. John is Jane’s son. ? ? ?

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 26

slide-27
SLIDE 27

Knowledge representation Knowledge representation

We need a formal way to represent knowledge. Options:

p

“IF…THEN” rules frameworks frameworks semantic nets

  • t

concepts predicate logic …

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 27

slide-28
SLIDE 28

Rules Rules

Useful when we need automated infering. IF condition THEN goal

g

goal IF condition Example:

IF (specie has hair) THEN (specie is a mamal) Specie is a mamal IF specie has hair

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 28

slide-29
SLIDE 29

Frameworks Frameworks

To represent structure and hierarchy.

Person:

Name Name Surname

A

Age Address Education …

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 29

slide-30
SLIDE 30

Semantic nets Semantic nets

Concepts and relationships. Subject Predicate Object.

j j

W “li k”

k t t k !

We “link” unknown concepts to known ones! Semantic nets, supported by ontologies, are used in

semantic web.

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 30

slide-31
SLIDE 31

Semantic nets Semantic nets

Mamal Mark Is a Has a Dog Is a Tom Has a Is kind of Sheepdog Is a

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 31

slide-32
SLIDE 32

Linking unknown concepts Linking unknown concepts

konyhai asztal konyhai asztal

WTF…

Let’s link unknown concept with knows ones

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 32

Let’s link unknown concept with knows ones

slide-33
SLIDE 33

Linking unknown concepts Linking unknown concepts

Kitchen Leg konyhai asztal

has

Leg konyhai asztal W ood Table Tablew are

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 33

slide-34
SLIDE 34

Automatic linking Automatic linking

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 34

slide-35
SLIDE 35

Is it useful? Well… it depends! Is it useful? Well… it depends!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 35

slide-36
SLIDE 36

Semantic web is… Semantic web is…

i ll b t METADATA

…is all about METADATA

M t d t = d t b t d t !

Metadata = data about data! John is person John is person. John likes to smoke. John is married to Jane John is married to Jane. John owns Tom Tom is a Cat Tom is a Cat. …

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 36

slide-37
SLIDE 37

Semantic web is… Semantic web is…

Web of Data Giant Global Graph

p

Data Web W b 3 0 Web 3.0 Linked Data Web Semantic Data Web … …

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 37

slide-38
SLIDE 38

Semantic web is… Semantic web is…

WWW l b ll d l b f d WWW: globally connected library of documents. vs. Semantic web: globally connected database.

Machine should “understand” data: formal knowledge

representation → semantics → semantic nets

We need applications that uses knowledge →

(intelligent)(web) services.

Semantics + web + intelligent services

→ semantic web

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 38

slide-39
SLIDE 39

Semantic web is… Semantic web is…

According to the original vision, the availability of machine-readable metadata would enable automated agents and other software to access the Web more intelligently. Web more intelligently.

Be aware: one can use semantic web even on closed enterprises!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 39

slide-40
SLIDE 40

When to use semantic web? When to use semantic web?

D ibi / t ti h d bl t t

Describing/annotating human readable content, Describing web services,

D ibi b b d i

Describing web-based services, EIA – data level integration, Easier searching for KNOWLEDGE Easier searching for KNOWLEDGE, IS upgrade, Knowledge integration in knowledge systems Knowledge integration in knowledge systems

Basically: Basically: IS Integration & knowledge management

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 40

slide-41
SLIDE 41

Bussiness case Bussiness case

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 41

slide-42
SLIDE 42

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 42

slide-43
SLIDE 43

Ontologies Ontologies

In semantic web, ontologies are used to define

meaning.

To Annotate. To enable infering To enable infering.

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 43

slide-44
SLIDE 44

Classification Classification

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 44

slide-45
SLIDE 45

Classification approaches in KM* Classification approaches in KM

Difference between:

Contolled Vocabulary Taxonomy Thesaur Ontology Ontology

Wh t i F lk ?

What is Folksonomy?

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 45

* Knowledge Management

slide-46
SLIDE 46

Example Example

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 46

slide-47
SLIDE 47

Example Example

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 47

slide-48
SLIDE 48

Example Example

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 48

slide-49
SLIDE 49

Example Example

Que stion

hasAnswe r

Answe r T e stCase

S l ti answe r isR e late dT

  • mayBe Alte r

native T

  • Answe rRe le va nc e

c ase Solution l T applysT

  • Pa tte rnContaine r

Pa tte r n

isMe mbe r Of [tr ansitive ] isPar tOf applysT

  • isSubPatte r

nOf [tr ansitive ] isMe mbe r Of [tr ansitive ] [ ]

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 49

[tr ansitive ]

slide-50
SLIDE 50

Example Example

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 50

slide-51
SLIDE 51

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 51

slide-52
SLIDE 52

To sum up To sum up

O

Ontologies are also semantic nets! They can also be formally represented with nets. The result: formally represented knowledge, that

y p g , can be used in intelligent processes e.g. infering!

Gruber (1993) defines ontology as

a formal explicit specification of a shared a formal explicit specification of a shared conceptualization.

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 52

slide-53
SLIDE 53

Basically, they consist of Basically, they consist of

Individuals Classes Attributes R l ti Relations Restrictions Rules Axioms Axioms

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 53

slide-54
SLIDE 54

How to use them? How to use them?

We need STANDARDIZATION!

How to identify individuals How to describe individuals Common vocabularies Writing meaning

W3C’s semantic web activity standarize those

technologies! (URI, XML, RDF, OWL)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 54

slide-55
SLIDE 55

W3C standards W3C standards

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 55

slide-56
SLIDE 56

W3C standards W3C standards

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 56

slide-57
SLIDE 57

Let’s get to “real bussiness”! Let s get to real bussiness !

Talk is cheap Talk is cheap, show me the code! show me the code!

XML, XML Schema, URI RDF, RDFS, OWL, SPARQL , S, OW , S Q Jena

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 57

slide-58
SLIDE 58

(very) Short intro to <XML/> (very) Short intro to <XML/>

First specifications in 1998 It defines sctructure and syntax of XML documents

Also DTD (Document Type Definition) Also DTD (Document Type Definition)

Additional specifications:

Namespaces Stylesheet linking

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 58

slide-59
SLIDE 59

XML document elements XML document elements

C /

<Element> Content </Element> <emptyElement></emptyElement> <emptyElement /> <emptyElement / >

p y / p y /

First or main element in document is called root First or main element in document is called root

element

Be aware of proper nesting of elements!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 59

slide-60
SLIDE 60

Example – nestings Example nestings

<person>

<name>Luka</name> P li / <surname>Pavlic</surname>

</person> <!-- improper nesting: --> <person>

<name>Luka</name> <surname>Pavlic</person>

</surname>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 60

slide-61
SLIDE 61

Attributes Attributes

d l h b l l “ l ”

Inside elements, there can be multiple name = “value”

e.g. attributes Th b 0 1 ib l

There can be 0, 1 or more attributes per element

/ <Person id=“12”>…</Person>

Predefined attributes: xml:lang – default en-US xml:space – prevent or not trimming of the element’s

content

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 61

slide-62
SLIDE 62

Well formed XML Well formed XML

E XML d t h ld b ll f d!

Every XML document should be well formed! Sintacticly valid Sintacticly valid Valid with DTD or Schema (if presented) Be aware: One and only one root element Proper names of the elements Proper nestings Case sensitive! Case sensitive! Attribute values inside quote-marks DTD, Schema!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 62

slide-63
SLIDE 63

More info on XML More info on XML

Good start:

htt // 3 h l / l/d f lt http://www.w3schools.com/xml/default.asp http://www.w3.org/XML/

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 63

slide-64
SLIDE 64

Another example Another example

<?xml version="1.0"?> <people> <person id=“1”> <name>Luka</name> <livesIn> <country> <name>Slovenia</name> </country> </livesIn> </person>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 64

</people>

slide-65
SLIDE 65

Another example Another example

<?xml version="1.0"?> <people> <person id=“1”> <name>Luka</name> A need for destinguishing! <livesIn> <country> A need for destinguishing! namespaces <name>Slovenia</name> </country> </livesIn> </person>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 65

</people>

slide-66
SLIDE 66

Another example Another example

" " <?xml version="1.0"?> <people xmlns:p=“http://www.example.com/People” xmlns:c=“http://www.example.com/Countries” > xmlns:c http://www.example.com/Countries <person id=“1”> <p:name>Luka</p:name> <livesIn> <country> < >Sl i </ > <c:name>Slovenia</c:name> </country> </livesIn> / </person> </people>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 66

slide-67
SLIDE 67

Namespaces – XML Schemas Namespaces XML Schemas

Rules for XML content Simple and complex elements, restrictions

p p ,

Datatypes, we can specify our own datatypes C

di lit

Cardinality Sets,...

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 67

slide-68
SLIDE 68

Example Example

<? l i "1 0" di "UTF 8"?> <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/NewXMLSchema" xmlns:tns="http://www.example.org/NewXMLSchema" elementFormDefault="qualified"> < l T "P "> <complexType name="Person"> <sequence> <element name="name" type="string"></element> <element name="livesIn" type="tns:Country"></element> </ > </sequence> </complexType> <complexType name="Country"> <sequence> < l t " " t " t i "></ l t> <element name="name" type="string"></element> </sequence> </complexType> <complexType name="PeopleType"> < i O ="1" O =" b d d"> <sequence minOccurs="1" maxOccurs="unbounded"> <element name="Person" type="tns:Person" /> </sequence> </complexType> < l t ="P l " t ="t P l T "></ l t> Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 68 <element name= People type= tns:PeopleType ></element> </schema>

slide-69
SLIDE 69

Some “public” namespaces Some public namespaces

// / /

xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#"

Good start for more info: http://www.w3schools.com/schema/default.asp p // / / p

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 69

slide-70
SLIDE 70

Back to semantic web Back to semantic web

RDF – XML documents, valid with RDF namespace! RDF enables us to write semantic nets! Concepts, relations… are identified with URIs! Concepts, relations… are identified with URIs!

e.g. http://www.something.com/someProject#someThing

You can state “anything” about “everything” – it’s an

i !

  • pen session!

you have to integrate the data to use it wisely

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 70

slide-71
SLIDE 71

Core Technologies Core Technologies

Identifiers: URI Triples: RDF=XML

p

Ontologies: RDF Schema=RDF about classes,

inheritance inheritance…

Ontologies: OWL=RDF Schema+++

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 71

slide-72
SLIDE 72

RDF basics RDF basics

S b P d Ob

Subject Predicate Object URI URI URI/literal This is how we build nets!

subject bj

A h C Cl k A th

j

  • bject

predicate

Arthur C. Clarke Author

Has name

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 72

slide-73
SLIDE 73

RDF – nets (1/2) RDF nets (1/2)

created

story Author

created

book story

Is described in

2001: A Space b k

Has name

p Odyssey book Arthur Clarke Author

Has name

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 73

slide-74
SLIDE 74

RDF – nets(2/2) RDF nets(2/2)

Author

created

Story

RESOURCE

Is described in

PROPERTY

book

Has name Has name

Arthur Clarke

VALUE

2001: A Space Arthur Clarke

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 74

Odyssey

slide-75
SLIDE 75

RDF storage RDF storage

A set of RDF triples is called a RDF NET More options on storage:

p g

N-Triples Turtle Turtle XML/RDF

XML i d d

XML is recomended

RDF in XML is usually called RDF document

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 75

slide-76
SLIDE 76

RDF document (1/6) RDF document (1/6)

<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C Clarke</book:author> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> </rdf:Description>

Root element: <rdf:RDF>

</rdf:RDF>

Root element: <rdf:RDF>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 76

slide-77
SLIDE 77

RDF document (2/6) RDF document (2/6)

<?xml version="1.0"?> <rdf:RDF l df "htt // 3 /1999/02/22 df t #" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> <book:genre>science fiction</book:genre> </rdf:Description> </rdf:RDF> Namespaces:

xmlns:rdf specifies that we use in rdf elements from

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

xmlns:book specifies, that we use in book elements from

"http://semweb.linz/book/”

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 77

slide-78
SLIDE 78

RDF document (3/6) RDF document (3/6)

<?xml version="1.0"?> <rdf:RDF l df "htt // 3 /1999/02/22 df t #" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> <book:genre>science fiction</book:genre> </rdf:Description> </rdf:RDF> Base namespace: xml:base means that every identifier is from namespace

"http://semweb.linz/”

Remember: identifiers are URI!!! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 78

slide-79
SLIDE 79

RDF document (4/6) RDF document (4/6)

<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C Clarke</book:author> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> </rdf:Description>

Element <rdf:Description> stands for RDF

</rdf:RDF>

Element <rdf:Description> stands for RDF

triple about identifies speficied in rdf:about

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 79

slide-80
SLIDE 80

RDF document (5/6) RDF document (5/6)

<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" p xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C Clarke</book:author> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> </rdf:Description> Predicates: <book:author>, <book:title> in </rdf:RDF> Predicates: <book:author>, <book:title> in

<book:genre>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 80

slide-81
SLIDE 81

RDF document (6/6) RDF document (6/6)

<?xml version="1.0"?> <rdf:RDF l df "htt // 3 /1999/02/22 df t #" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:book="http://semweb.linz/book/" xml:base="http://semweb.linz/"> <rdf:Description rdf:about="ID2001"> <book:author>Artur C. Clarke</book:author> <book:title> 2001: A Space Odyssey</book:title> <book:genre>science fiction</book:genre> <book:genre>science fiction</book:genre> </rdf:Description> </rdf:RDF> This document states 3 triples:

  • http://semweb.linz/ID2001 http://semweb.linz/book#author “Arthur C. Clarke”
  • http://semweb.linz/ID2001 http://semweb.linz/book#title “2001: A Space Odyssey”
  • http://semweb.linz/ID2001 http://semweb.linz/book#genre “science fiction”

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 81

slide-82
SLIDE 82

RDF net – RDF document RDF net RDF document

Author created Story is described in Has name Book Arthur Clarke . . . <rdf:Description rdf:about="Author"> <publ:hasName>Artur C. Clarke</publ:hasName> <publ:created> 2001: A Space has name <rdf:Description rdf:about=“Story"> <publ:isDescribedIn> <rdf:Description rdf:about=“Book"> <publ:hasName>2001: A Space Odyssey</publ:hasName> Odyssey p p y y p </rdf:Description> </ publ:isDescribedIn > </rdf:Description> </publ:created> Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 82 </publ:created> </rdf:Description> . . .

slide-83
SLIDE 83

RDF –container elements RDF container elements

Element <rdf:Bag> Element <rdf:Seq>

q

Element <rdf:Alt>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 83

slide-84
SLIDE 84

RDF “problems”? RDF problems ?

Common syntax - OK Common semantics (classes, relationship types…)

( , p yp )

RDFS OWL OWL

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 84

slide-85
SLIDE 85

RDF shema RDF shema

h ( S) bl l l

RDF shema (RDFS) enables simple ontologies We can use it primarly for taxonomies

Classes Inheritance

R l ( l )

Relations (simple ones)

W3C ifi i

W3C specification

http://www.w3.org/TR/rdf-schema/ RDFS WAS t ti t d h i i OWL

RDFS WAS a recomentation, todays choice is OWL… …but: OWL still includes some RDFS elements!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 85

slide-86
SLIDE 86

RDF shema RDF shema

S f d f d d

Set of predefined predicates:

class property subClassOf

  • bP

t Of

subPropertyOf domain range range …

with predefined semantics! with predefined semantics! standardized in 2004

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 86

slide-87
SLIDE 87

RDFS: Specifying classes RDFS: Specifying classes

vocabulary for classes:

rdfs:Class (a resource is a class) rdf:type (a resource is an instance of a class) rdfs:subClassOf (a resource is a subclass of another

( resource)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 87

slide-88
SLIDE 88

RDFS: specifying properties RDFS: specifying properties

vocabulary for properties:

rdfs:Property (a resource is a property) rdfs:domain (denotes the first component of a property) rdfs:range (denotes the second component of a

g ( p property)

rdfs:subPropertyOf (expresses ISA between properties) rdfs:subPropertyOf (expresses ISA between properties)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 88

slide-89
SLIDE 89

Example Example

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 89

slide-90
SLIDE 90

RDFS Syntax RDFS Syntax

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 90

slide-91
SLIDE 91

Class definition Class definition

<?xml version="1.0"?> 1

Ontology is RDF d t

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://semweb.linz/people"> 2

Ontology (taxonomy) namespace RDF document, rdf:RDF

<rdfs:Class rdf:ID=“Student"> <rdfs:subClassOf rdf:resource="#Person"/> </rdfs:Class>

Defines a class #Person is actually

http://semweb.linz/people #Person

3 4 <rdfs:Class rdf:ID=“Employee"> <rdfs:subClassOf rdf:resource="#Person"/> </rdfs:Class> ... </rdf:RDF> Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 91

slide-92
SLIDE 92

rdfs:Class rdfs:Class

Element <rdfs:Class> is used to define a class rdf:ID class name Content are class relations

All relations are connected with logical AND All relations are connected with logical AND

<rdfs:Class rdf:ID=“Employee"> Class name <rdfs:subClassOf rdf:resource="#Person"/> </rdfs:Class> AND

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 92

slide-93
SLIDE 93

rdfs:subClassOf rdfs:subClassOf

Hierarchy of classes One can also define multiple occurances of subClassOf! 0: = subClassOf rdfs:Resource 1: we defined super-class M

lti l i h it !

Many: multiple inheritance! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 93

slide-94
SLIDE 94

rdf:Property rdf:Property

Defining relations (predicates, properties…) rdf:ID – name of relation Content:

Domain: which class does it apply to Domain: which class does it apply to Range: Possible value

Property name <rdf:Property rdf:ID=“friendOf"> <rdfs:domain rdf:resource="#Strudent"/> Property name AND <rdfs:range rdf:resource="#Student"/> </rdf:Property> AND

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 94

slide-95
SLIDE 95

rdfs:range, rdfs:domain rdfs:range, rdfs:domain

Domain is only object type! (URI) Range can either be data or object type! There can also be many occurances of rdfs:range/rdfs:domain 0: Not specified; any 1: specified range type Multiple: value has to be valid to ALL occurances! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 95

slide-96
SLIDE 96

RDFS – easy and efficient RDFS easy and efficient

Use it when

You need to define

Taxonomies Properties

Y

d i l i f i ( i h it )

You need simple infering (e.g. inheritance)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 96

slide-97
SLIDE 97

Be aware! Be aware!

problems with meta-data:

(#a rdf:type #C) (#C rdf:type #R) (#R rdf:type #a)

( yp )

  • r

(#C df t

#C)

(#C rdf:type #C)

are correct (formally meaningful) RDF statements but no intuitive semantics!!!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 97

slide-98
SLIDE 98

SPARQL SPARQL

SPARQL = RDF query language http://www.w3.org/TR/rdf-sparql-query/

p // g/ / p q q y/

You need its implementation in order to use it (e.g.

Jena) Jena)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 98

slide-99
SLIDE 99

Example SPARQL query Example SPARQL query

Semantic net:

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 99

slide-100
SLIDE 100

Example SPARQL query Example SPARQL query

Search for: “Blog URL from author with name Jon

Foobar!”

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?url FROM <http://on-the.net/bloggers.rdf> p // / gg WHERE { ?author foaf:name “Jon Foobar” . ?author foaf:weblog ?url ?author foaf:weblog ?url . }

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 100

slide-101
SLIDE 101

Example SPARQL query Example SPARQL query

PREFIX - “namespace” alias SELECT – set of variables to query FROM – sources, in some implementations optional WHERE - conditions ?author foaf:name “Jon Foobar” – all “Jon Foobar”

authors

?avtor foaf:weblog ?url

all authors URLs

?avtor foaf:weblog ?url – all authors URLs

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?url FROM <http://on-the.net/bloggers.rdf> WHERE { ?author foaf:name “Jon Foobar” .

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 101

?author foaf:weblog ?url . }

slide-102
SLIDE 102

SPARQL: optional results SPARQL: optional results

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?ime ?slika WHERE { WHERE { ?author foaf:name ?name . OPTIONAL { ? th f f d i ti ?i ?author foaf:depiction ?image . } . }

name | image

  • Vili Podgorelec | <http://lisa.uni-mb.si/vili/viliPodgorelec.jpg>

Marjan Heričko | <http://lisa.uni-mb.si/images/osebje/MarjanHericko.jpg> Luka Pavlič | Tatjana Welzer | <http://lisa.uni-mb.si/images/osebje/TatjanaWelzer.jpg>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 102

slide-103
SLIDE 103

SPARQL: alternative results SPARQL: alternative results

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?ime ?email WHERE { WHERE { ?author foaf:name ?name . { { ? th f f b ? il } UNION { ?author foaf:mbox ?email } UNION { ?author foaf:mbox_sha1sum ?email } } }

name | email

  • Marjan Heričko

| <mailto:marjan.hericko@uni-mb.si> Vili Podgorelec | “92ab30f82de1ecea9c32ae033fd3fc9cd9b44308” Luka Pavlič | <mailto:luka.pavlic@uni-mb.si>

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 103

slide-104
SLIDE 104

SPARQL: results filtering SPARQL: results filtering

PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?authorfoaf:name ?name. FILTER regex(?name, “v”, “i”) FILTER regex(?name, v , i ) }

name

  • Vili Podgorelec

Luka Pavlič

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 104

slide-105
SLIDE 105

SPARQL: results limitation SPARQL: results limitation

PREFIX foaf <http // mlns com/foaf/0 1/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX info: <http://somewhere/peopleInfo#> SELECT ?name ?age WHERE { ?author foaf:name ?name. ?author info:age ?age. FILTER (?age>= 18) }

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 105

slide-106
SLIDE 106

SPARQL: formating results SPARQL: formating results

Sorting

ORDER BY LIMIT – only specified number of results OFFSET – where to start when returning results

g

CONSTRUCT, DESCRIBE –build RDF from results

ASK t t if th i lt f SPARQL

ASK – returns true if there is a result from SPARQL

query, othervise false

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 106

slide-107
SLIDE 107

SPARQL in Java * SPARQL in Java

We use Jena framework Module ARQ – ”query engine”

q y g

Packake com.hp.hpl.jena.query Use class QueryFactory Use class QueryFactory Simple constructing, executing and itarating trough

results results * l d t * see examples and comments

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 107

slide-108
SLIDE 108

SPARQL – quick view by examples SPARQL quick view by examples

PREFIX abc: http://mynamespace.com/exampleOntology#> p // y p / p gy SELECT ?capital ?country WHERE { WHERE { ?x abc:cityname ?capital.

?y abc:countryname ?country. ?x abc:isCapitalOf ?y. ?y abc:isInContinent abc:africa. }

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 108

slide-109
SLIDE 109

SPARQL – quick view by examples SPARQL quick view by examples

PREFIX PREFIX abc: <http://mynamespace.com/exampleOntology#> SELECT ?capital ?country WHERE { WHERE {

?x abc:cityname ?capital. ?y abc:countryname ?country. ?x abc:isCapitalOf ?y.

?y abc:isInContinent abc:africa. }

Variables are outlined through the "?" prefix ("$" is also possible). Variables are outlined through the ? prefix ( $ is also possible). The ?capital and the ?country will be returned. The SPARQL query processor returns all hits matching the pattern

f h f RDF l

  • f the four RDF-triples.

"property orientation" (class matches can be conducted solely

through class attributes/properties)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 109

g /p p )

slide-110
SLIDE 110

SPARQL – quick view by examples SPARQL quick view by examples

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 110

slide-111
SLIDE 111

SPARQL – quick view by examples SPARQL quick view by examples

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 111

slide-112
SLIDE 112

SPARQL – quick view by examples SPARQL quick view by examples

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 112

slide-113
SLIDE 113

RDF, RDFS and SPARQL with Jena RDF, RDFS and SPARQL with Jena

Create model. * Write model. * Use model. * T

i *

Try some queries. *

*see code examples and comments!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 113

slide-114
SLIDE 114

Jena Jena

Open so rce librar Open-source library http://jena.sourceforge.net/ http://www.hpl.hp.com/semweb/

p // p p / /

HP Labs Semantic Web Research Supports: RDF, RDFS, OWL, SPARQL, RDQL, N3,

N-Triples etc N Triples etc.

Functionalities: RDF API OWL API OWL API Read and wrte of RDF in RDF/XML, N3 and N-Triples Managing persistent nets

RDQL RDF l

RDQL – RDF query language It can be easily extended – see example code! Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 114

slide-115
SLIDE 115

Jena - example Jena example

OntModel m = ModelFactory.createOntologyModel( OntModelSpec OWL MEM null ); OntModelSpec.OWL_MEM, null ); m.read( "http://www.w3.org/2001/sw/WebOnt/wine" ); p // g/ / / / ); new ClassHierarchy().showHierarchy( System.out, m );

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 115

slide-116
SLIDE 116

RDFS vs. OWL RDFS vs. OWL

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 116

slide-117
SLIDE 117

Origin of the OWL Origin of the OWL

DAML OIL RDF(S) DAML+OIL DAML = DARPA Agent Markup Language OIL = Ontology Inference Layer

OWL

OWL versions:

  • OWL Lite

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 117

OWL

  • OWL DL (Description Logic)
  • OWL Full
slide-118
SLIDE 118

Properties in OWL Properties in OWL

S

RDFS:

range domain subPropertyOf

They are valid in OWL also! Additives!

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 118

slide-119
SLIDE 119

Property types in OWL Property types in OWL

Properties can be of multiple types

Symetrical: A r B ⇒ B r A Transitive: A r B and B r C ⇒ A r C Functional

Only one property value per instance

Inverse: A r B ⇒ B r’ A Inverse: A r B ⇒ B r A Inverse functional

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 119

slide-120
SLIDE 120

Thank you – your turn now ☺ Thank you your turn now ☺

Semantic Web Technologies: Fundamentals, Tools, Cases and Best Practices Johannes Kepler Universität Linz , October 2010

Luka Pavlič (luka.pavlic@uni-mb.si) University of Maribor, Faculty of Electrical Engineering and Computer Science

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 120

slide-121
SLIDE 121

SEMANTIC WEB TECHNOLOGIES TECHNOLOGIES: FUNDAMENTALS, TOOLS, , , CASES AND BEST PRACTICES

PROJECT WORK

slide-122
SLIDE 122

Rules Rules

You will be graded:

50% written test (Nov. 5th 2010) 50% project work (inovativness will be graded better!)

You have to select a project BEFORE you start You have to select a project BEFORE you start

working – if the project will be accepted, then you start start

Send documentation and code to

luka.pavlic@uni-mb.si before Nov. 5th 2010.

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 122

slide-123
SLIDE 123

What is expected? What is expected?

Documentation:

Name, surname, email Title Short abstract: what is your project about, what is

y p j , inovative about it, what have you learned from it

Code: Code:

RDF, RDFS, OWL documents J

d / b / d /

Java code / web pages / demo / …

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 123

slide-124
SLIDE 124

How to do it? How to do it?

G h / / l k l Gather / create / link to ontology Gather / create / link to RDF data … … Do something intelligent about it (e.g. Jena, SPARQL infering, combining data from ( g g g different sources to get new knowledge etc.) There are also projects, that are not so practically

  • riented.

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 124

slide-125
SLIDE 125

Proposed projects - examples Proposed projects examples

Create ontology about musicians, use data from

MusicBrainz (http://musicbrainz.org/) and try to create and execute some interesting queries: singer with most songs, artists that changed groups the most etc.

Use DBPedia services (http://dbpedia.org) in your

application, to gather as many knowledge about Linz as possible.

Prepare ontology, supporting knowledge of your

favourite sport and gather data for it from the web. Do some infering.

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 125

slide-126
SLIDE 126

Proposed projects - examples Proposed projects examples

P t l b t P l d th i b h i

Prepare ontology about People and their behaviour.

Prepare some data and create application, that will tell which person might be the best friend with selected p g person – according to knowledge supported by

  • ntology.

C d f f i i l k

Capture data from your favorite social network

(facebook?) and present it according to FOAF ontology. Execute some intelligent queries! ecu e so e e ge que es!

Create ontology on courses, in your study programme.

Try to figure out their relation and create queries that will propose in what order should courses be taken.

You can also propose a project – be innovative ;)

Luka Pavlič: Semantic Web Technologies, JKU Linz, October 2010 126