semantic web for the working ontologist dean allemang jim hendler snu idb laboratory

39
Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Upload: augustine-fleming

Post on 17-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist

Dean Allemang

Jim Hendler

SNU IDB laboratory

Page 2: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

2Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

Working Ontology Contents

■ Chapter 1 What is the Semantic Web?

■ Chapter 2 Semantic Modeling

■ Chapter 3 RDF-The Basis of the semantic Web

■ Chapter 4 Semantic Web Application Architecture

■ Chapter 5 RDF and Inferencing

■ Chapter 6 RDF Schema

■ Chapter 7 RDFS-Plus

■ Chapter 8 Using RDFS-Plus in the Wild

■ Chapter 9 Basic OWL

■ Chapter 10 Counting and Sets in OWL

■ Chapter 11 Using OWL in the Wild

■ Chapter 12 Good and Bad Modeling Practices

■ Chapter 13 OWL Levels and Logic

Page 3: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

3Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

Chapter 3 RDF – The Basis of the Semantic Web

■ 1. Distributing Data Across the Web

■ 2. Merging Data from Multiple Sources

■ 3. Namespaces, URIs, and Identity

3.1. Expressing URIs in Print

3.2. Standard Namespaces

■ 4. Identifiers in the RDF Namespace

■ 5. Challenge: RDF and Tabular Data

■ 6. Higher-Order Relationships

■ 7. Alternatives for Serialization

7.1. N-Triples

7.2. Notation 3 RDF (N3)

7.3. RDF/XML

■ 8. Blank Nodes

8.1. Ordered Information in RDF

Page 4: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

4Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

Introduction: Semantics

■ The most primitive part of this notion of semantics

is a representation of the linkage of a term in a statement to the entity in the world that the term refers to

apple

Real WorldWeb

Page 5: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

5Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

Introduction: Semantics

■ In the Semantic Web we refer to the things in the world as resources

■ Resource ≈ Entity, Thing

Can be anything that someone might want to talk about

■ RDF = Resource Description Framework

resource

resource

resource

RDF

Page 6: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web

ID Title Author Medium Year

1 As You Like It Shakespeare Play 1599

2 Hamlet Shakespeare Play 1604

3 Othello Shakespeare Play 1603

4 “Sonnet 78” Shakespeare Poem 1609

5 Astrophil and Stella Sir Phillip Sidney Poem 1590

6 Edward ll Christopher Marlowe Play 1592

7 Hero and Leander Christopher Marlowe Poem 1593

8 Greensleeves Henry Vlll Rex Song 1525

Tabular Data about Elizabethan Literature and Music

Let’s consider a few different strategies for how this data could be distributed over the Web!

6

Page 7: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web: row by row

1 As You Like It Shakespeare Play 1599

5 Astrophil and Stella Sir Phillip Sidney Poem 1590

6 Edward ll Christopher Marlowe Play 1592

7 Hero and Leander Christopher Marlowe Poem 1593

8 Greensleeves Henry Vlll Rex Song 1525

7

Page 8: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

8Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web: row by row

■ “row by row” distribution solution provides considerable flexibility

Since the machines can share the load of representing information about several individuals

But because it is a distributed representation of data, it requires some coordi-nation between the servers

■ In particular, each server must share information about the columns

Page 9: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler9

1. Distributing Data across the Web: column by column

Title

As You Like It

Hamlet

Othello

“Sonnet 78”

Astrophil and Stella

Edward ll

Hero and Leander

Greensleeves

Author

Shakespeare

Shakespeare

Shakespeare

Shakespeare

Sir Phillip Sidney

Christopher Marlowe

Christopher Marlowe

Henry Vlll Rex

Medium Year

Play 1599

Play 1604

Play 1603

Poem 1609

Poem 1590

Play 1592

Poem 1593

Song 1525

Page 10: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

10Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web: column by column

■ “row by row” distribution solution (also flexible in a different way)

Each server is responsible for one or more complete from original table

If we are not interested in the dates of publication, we needn’t consider infor-mation from that server

■ It requires some coordination between the servers

The coordination has to do with the identities of the entities to be described

It requires a global identifier for the entities being described

Page 11: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web: cell by cell

Medium

Row 7 Poem

Medium

Row 6 Play

Title

Row 2 Hamlet

Author

Row 4 Shakespeare

11

Page 12: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

12Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web: cell by cell

■ “cell by cell” distribution solution (this strategy is taken by RDF)

Each machine is responsible for some number of cells in the table

This system combines the flexibility of both of the previous strategies (row by row + column by column)

Share the description of a single entity (row by row) + Share the use of a par-ticular property (column by column)

■ But this solution also combines the costs of the other two strategies

Need a global reference for the column headings

Need a global reference for the rows

Page 13: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

13Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web: cell by cell

■ Each cell has to be presented with three values Triple

A global reference for the row

A global reference for the column

Value in the cell it self

■ Basic building block for RDF is triple

Identifier for the row is subject of the triple

Identifier for the column is predicate of the triple

Value is object of the triple

Subject Predicate Object

Row 2 Title Hamlet

Row 7 Medium Poem

Row 4 Author Shakespeare

Row 6 Medium Play

Page 14: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

1. Distributing Data across the Web: cell by cell

Subject Predicate Object

Shakespeare Wrote King Lear

Shakespeare Wrote Macbeth

Anne Hathaway Married Shakespeare

Shakespeare Lived in Stratford

Stratford Is in England

Macbeth Set in Scotland

England Part of The UK

Scotland Part of The UK

Shakespeare

Macbeth

Stratford

England

King Lear

Anne Hathaway

Sample TriplesScotlan

d

UK

married

wrote

wrote

lived in

set in

is in

part ofpart of

14

Page 15: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

15Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

2. Merging Data from Multiple Sources

■ Section 1: a way to distribute data over several sources

■ Section 2: merge those sources back together again

Triples representation is easy to merge

Taken together all of the triples from each individual RDF graph

UKEnglan

d

Northern Ireland

Wales

Scotland

Shakespeare

Winter Tale

Henry V

The Tempest

Macbeth

King Lear part of

part of

part of

part of

wrote

wrote

wrote

wrote

wrote

Page 16: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

16Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

2. Merging Data from Multiple Sources

UK

England

Northern Ireland

Wales

Scotland

Shakespeare

Winter Tale

Henry V

The Tempest

Macbeth

King Lear

part of

part of

part of

part of

wrote

wrote

wrote

wrote

wrote

Stratford

LivedIn

IsIn

setIn

Page 17: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

17Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

3. Namespaces, URIs, and Identity

“When is a node in one graph the same node as a node in another graph?”

■ In RDF, Uniform Resource Identifiers (URIs)

A URI provides a global identification for a resource

URL is just a special case of the URI

Shakespeare

King Lear

wrote

Http://www.sample.com/shakespeare.owl#Shakespeare

Http://www.sample.com/shakespeare.owl#wrote

Http://www.sample.com/shakespeare.owl#KingLear

Shakespeare wrote KingLear

Page 18: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

18Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

3.1. Expressing URIs in Print

■ URI work very well for expressing identity on the WWW

But it is too detail, long..

■ So we use a simplified version of a URI abbreviation scheme called qnames

A namespace and an identifier written with a colon

Qnames are not global identifiers

Http://www.sample.com/geography.owl#England

geo:England

Page 19: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

3.1. Expressing URIs in Print

Subject Predicate Object

lit:Shakespeare lit:wrote lit:KingLear

lit:Shakespeare lit:wrote lit:Macbeth

bio:AnneHathaway bio:married lit:Shakespeare

bio:AnneHathaway bio:livedWith lit:Shakespeare

lit:Shakespeare bio:livedIn geo:Stratford

geo:Stratford geo:isIn geo:England

geo:England geo:part of geo:UK

geo:Scotland geo:partOf geo:UK

Triples Referring to URIs with a Variety of Namespaces

lit stands for http://www.WorkingOntologist.org/Examples/Chapter3/Shakepeare.owl#geo stands for http://www.WorkingOntologist.org/Examples/Chapter3/geography.owl#bio stands for http://www.WorkingOntologist.org/Examples/Chapter3/biography.owl#

19

Page 20: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

3.2. Standard Namespaces

■ Using the URI as a standard for global identifiers allows for a worldwide refer-ence for any symbol

■ W3C standards provide definitions for terms

ex) type, subClassOf, Class, inverseOf, …

■ W3C defined standard namespaces

ex) xsd: XML schema definition

xmlns: XML namespace..

20

Page 21: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

3.2. Standard Namespaces

■ rdf:

Indicates identifiers used in RDF

Set of identifiers is used to define types and properties in RDF

Http://www.w3.org/1999/02/22-rdf-syntax.ns#

■ rdfs:

Indicates identifiers used for the RDF Schema Language

Http://www.w3.org/2000/01/rdf-schema#

■ owl:

Indicates identifiers used for the Web Ontology Language

Http://www.w3.org/2002/07/owl#

21

Page 22: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

4. Identifiers in the RDF Namespace

■ rdf:type

Provides an elementary typing system in RDF

■ Types can have types

Subject Predicate Object

lit:Shakespeare rdf:type lit:Playwrite

lit:Ibsen rdf:type lit:Playwrite

lit:Simon rdf:type lit:Playwrite

lit:Miller rdf:type lit:Playwrite

Subject Predicate Object

lit:Playwrite rdf:type lit:Profession

lit:Profession rdf:type lit:Compensation

22

Page 23: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

4. Identifiers in the RDF Namespace

■ rdf:Property

Identifier is used as a predicate rather than as a subject or an object

Subject Predicate Object

lit:wrote rdf:type rdf:Property

geo:part of rdf:type rdf:Property

bio:married rdf:type rdf:Property

bio:livedIn rdf:type rdf:Property

bio:livedWith rdf:type rdf:Property

geo:Isin rdf:type rdf:Property

rdf:Property Assertions

23

Page 24: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

5. Challenge: RDF and Tabular Data

■ ID is a locally unique identifier

■ We need a globally unique identifier

■ Let us call that namespace mfg:

■ Identifiers

ex) mfg:Product1, mfg:Product2, …

■ Properties

ex) mfg:Product_ModelNo, mfg:Proudct_Division, …

24

Page 25: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

5. Challenge: RDF and Tabular Data

Subject Predicate Object

mfg:Product1 mfg:Product_ID 1

mfg:Product1 mfg:Product_ModelNo ZX-3

mfg:Product1 mfg:Product_Division Manufacturing Support

mfg:Product1 mfg:Product_Product_Line Paper Machine

mfg:Product1 mfg:Product_Manufacture_Location Scramento

mfg:Product1 mfg:Product_SKU FB3524

mfg:Product1 mfg:Product_Available 23

mfg:Product2 mfg:Product_ID 2

… … …

Triples Representing Some of the Data

25

Page 26: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

5. Challenge: RDF and Tabular Data

Subject Predicate Object

mfg:Product1 rdf:type mfg:Product

mfg:Product2 rdf:type mfg:Product

mfg:Product3 rdf:type mfg:Product

mfg:Product4 rdf:type mfg:Product

… … …

mfg:Product8 rdf:type mfg:Product

mfg:Product9 rdf:type mfg:Product

Triples Representing Type of Information

26

Page 27: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

27Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

6. Higher-Order Relationships

■ Reification

In general, there are cases in which it is desirable to make a statement about another statement

This process called reification

Shakespeare wrote Hamlet

Shakespeare wrote Hamlet in 1604

Wikipedia states Shakespeare wrote Hamlet in 1604

Page 28: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

■ “Shakespeare wrote Hamlet in 1601” can be expressed with three triples

bio:n1 bio:author lit:Shakespeare;

bio:title “Hamlet”;

bio:publicationDate 1601.

■ This approach works well in this case

■ But, it doesn’t work to express information about the statement itself

“Wikipedia says Shakespeare wrote Hamlet”

■ Explicit reification

In such cases, it is useful to explicitly make a statement about a statement

6. Higher-Order Relationships

28

Page 29: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

6. Higher-Order Relationships

■ “Wikipedia says Shakespeare wrote Hamlet”

q:n1 rdf:subject lit:Shakespeare;

rdf:predicate lit:wrote;

rdf:object lit:Hamlet.

web:Wikipedia m:says q:n1.

■ Explicit reification is supported by the W3C RDF standard with rdf:subject, rdf:predicate, and rdf:object

29

Page 30: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

30Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

7. Alternatives for Serialization

■ So far, we have expressed RDF triples in subject/predicate/object tabular form or as graphs of boxes and arrows

■ But they are not always the most compact forms

■ So, there are multiple ways of expressing RDF in textual form

N-Triples

Notation 3 RDF (N3)

RDF/XML

Shakespeare

King Lear

wrote

Subject Predicate Object

lit:Shakespeare lit:wrote lit:KingLear

Page 31: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

7.1. N-Triples

■ N-triples

Corresponds most directly to the raw RDF triples

Using fully unabbreviated URIs

Three resources are expressed in subject/predicate/object order

<http://www.WorkingOntologist.org/Examples/Chater3Manufacture.rdf#Product1>

<http://www.w3.org/1992/02/22-rdf-syntax-ns#type>

<http://www.WorkingOntologist.org/Examples/Chapter3Manufacture.rdf#Product>

N-triples

Product1

Product

type

31

Page 32: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

7.2. Notation 3 RDF (N3)

■ Notation 3 RDF (N3)

More compact serialization of RDF

Binding between the local qnames an the global URIs

N3 provides a compact representation

@prefix mfg:<http://www.WorkingOntologist.org/Examples/Chapter3/Manufacturing.rdf#>

@prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>

mfg:Product1 rdf:type mfg:Product.

N3

32

Page 33: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

7.2. Notation 3 RDF (N3)

■ N3 begins with the first triple in subject/predicate/ object order

■ A semicolon (;) indicates that another triple with the same subject follows

■ Terminating with a period (.)

mfg:Product1 rdf:type mfg:Product;

mfg:Product_Division “Manufacturing support”;

mfg:Product_Available “23”.

mfg:Product1 rdf:type mfg:Product.

mfg:Product1 mfg:Product_Division “Manufacturing support”.

mfg:Product1 mfg:Product_Available “23”.

33

Page 34: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

7.2. Notation 3 RDF (N3)

■ Several triples share both subject and predicate

N3 uses a comma (,) to separate the objects

lit:Shakespeare b:hasChild b:Susanna, b:Judith, b:Hamlet.

lit:Shakespeare b:hasChild

b:Susanna.

lit:Shakespeare b:hasChild b:Judith.

lit:Shakespeare b:hasChild b:Hamlet.

34

Page 35: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

7.2. Notation 3 RDF (N3)

■ Abbreviation

a means rdf:type

mfg:Product1 rdf:type mfg:Product.

mfg:Product1 a mfg:Product.

35

Page 36: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

7.3. RDF/XML

■ W3C has recommended the use of an XML serialization of RDF called RDF/XML

(Many web infrastructures are accustomed to representing information in XML)

<rdf:RDF xmlns:mfg=“http://www.WorkingOntologist.org/Examples/Chapter3/Manufacturing.rdf#” xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#> <mfg:Product rdf:about=“http://www.WorkingOntologist.org/Examples/Chapter3/Manufacturing.rdf# Product1”> <mfg:Available>23</mfg:Available> <mfg:Division>Manufactuingsupport</mfg:Division> <mfg:ProductLine>Paper machine</mfg:ProductLine> <mfg:SKU>FB3524</mfg:SKU> <mfg:ModelNo>ZX-3</mfg:ModelNo> <mfg:ManufactureLocation>Sacramento</mfg:ManufactureLocation> </mfg:Product> …</rdf:RDF>

36

Page 37: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

8. Blank Nodes

■ RDF allows for resource that do not have any Web identity at all

■ Example: “Shakespeare had a mistress”

■ Her identity remains unknown

But we know a few things about her

▶ She was a woman

▶ She lived in England

▶ She was the inspiration for “Sonnet 78”

lit:Mistress1 rdf:type bio:Woman; bio:LivedIn geo:England .

lit:Sonnet78 lit:hasInspiration lit:Mistress1.

∵ Her identity remains unknown

? rdf:type bio:Woman; bio:LivedIn geo:England .

lit:Sonnet78 lit:hasInspiration ? .

37

Page 38: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

8. Blank Nodes

■ RDF allows blank node (bnode for short)

■ But this notation can not express more than one blank node

■ In N3, a bnode is indicated by putting all the triples between square brackets

A blank node is referred by including the entire bracketed sequence in place of the blank node

? rdf:type bio:Woman; bio:LivedIn geo:England .

lit:Sonnet78 lit:hasInspiration ? .

lit:Sonnet78 lit:hasInspiration [ a bio:Woman;

bio:livedIn England;

… ] .

38

Page 39: Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory

Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler

8.1. Ordered Information in RDF

■ An ordered list can be expressed in N3 as follows

lit:Shakespeare b:hasChild ( b:Susanna b:Judith b:Hamlet) .

39