visual models for knowledge engineering madalina croitoru [email protected]

69
Visual Models for Knowledge Engineering Madalina Croitoru [email protected]

Upload: esmond-dawson

Post on 11-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Visual Models for Knowledge Engineering

Madalina Croitoru

[email protected]

Page 2: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Course Structure

Week 1: Ontologies: motivation Week 2: RDF - representation Week 3: RDF - reasoning Week 4: CGs - representation Week 5: CGs – reasoning

All material available on my webpage:www.lirmm.fr/~croitoru

Page 3: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Semantic Web

Web of data An extension of the current web in

which information is give well-defined meaning, better enabling computers and people to work together

Page 4: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Semantic Web: information

STRUCTURED FORM

Page 5: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

What structure?

Statements Describe some relationship between

one thing and another Standardised by W3C as RDF

Page 6: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

How things work?

For the Web: URI; HTTP; (X)HTML

For the Semantic Web: URI; HTTP; RDF

Page 7: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Uniform Resource Identifier

To be able to manipulate something we should first IDENTIFY it

Examples: http://me.jozilla.net/ http://purl.org/dc/terms/modified uuid:04b749bf-3bb2-4dba-934c-c92c56b709df tag:[email protected],2001-06-05:Taiko esl:SHA1:iQAAwUBO51bkD6DJL[...]szDxfckCE:

someName

Page 8: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

How things work?

For the Web: URI; HTTP; (X)HTML

For the Semantic Web: URI; HTTP; RDF

Page 9: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

HTTP

Protocol for operations on resources: Get (Ask for information) Post (Send request) Put (Update information)

Page 10: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

How things work?

For the Web: URI; HTTP; (X)HTML

For the Semantic Web: URI; HTTP; RDF

Page 11: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

RDF

Resource Description Format Machine – processable Statements: TRIPLES

Page 12: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

RDF triplets:

<Subject> <Predicate> <Value> Example:

<Cat> <hasName> “Gizzy” . <Madalina> <knows> <Cathy> . <Madalina> <hasEmployer> <LIRMM> <LIRMM> <site> <http://www.lirmm.fr> <primaryKey> <column_name> “value” .

Page 13: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

The Web vs Semantic Web

Web (Madalina Croitoru, www.lirmm.fr/~croitoru)

Semantic Web (Madalina Croitoru, has_homepage,

www.lirmm.fr/~croitoru)

Page 14: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

RDF is a graph:

<Madalina> <has_homepage> <www.lirmm.fr/~croitoru> . <Madalina> <hasEmployer> <LIRMM> <LIRMM> <site> <http://www.lirmm.fr>

Madalina

LIRMM

www.lirmm.fr/~croitoru

http://www.lirmm.fr

has_homepage

hasEmployer

site

Page 15: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

What difference with XML?

XML is about documents and not data Many ways to say the same thing in

XML RDF is easy to put in relational

databases RDF is easy to merge!

Page 16: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Ambiguity in XML

<page><hasAuthor><Madalina>

<author>

<uri> page </uri>

<name> Madalina </name>

</author>

<person name = “Madalina”>

<work> page </work>

</person>

<document href=”http://www.lirmm.fr/~croitoru” author=”Madalina”/>

Page 17: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

RDF - syntax

RDF was designed to provide a common way to describe information so it can be read (and understood) by computer applications.

RDF descriptions are not designed to be displayed on the web.

Page 18: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

URIs for RDF

RDF uses a URI (Uniform Resource Identifier) to identify a web resource, and properties to describe the resource

Unlike URLs, URIs are not limited to identifying things that have a network location

A URI reference (URIref) is a URI, together with an optional fragment identifier at the end. http://www.example.org/index.html#section2

Page 19: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example

<?xml version="1.0"?>

<RDF>

<Description about="http://www.w3schools.com/default.asp">

<author>Jan Egil Refsnes</author>

<created>November 1, 1999</created>

<modified>February 1, 2004</modified>

</Description>

</RDF>

Page 20: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example - cont

the URI "http://www.w3schools.com/- default.asp" is used to identify a web page,

the property "author" describes the author of the page,

the property value is "Jan Egil Refsnes". The property "created" tells when the page

was created, and the property "modified" when it was last modified.

Page 21: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Subject, Predicate, Object

RDF terminology also use the words subject, predicate and object.

The resource http://www.w3schools.com/default.asp is the subject

The property "author" is the predicate The value "Jan Egil Refsnes" is the

object

Page 22: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example 2

<rdf:RDF

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

xmlns:cd="http://www.recshop.fake/cd">

<rdf:Description

rdf:about="http://www.recshop.fake/cd/EmpireBurlesque">

<cd:artist>Bob Dylan</cd:artist> <cd:country>USA</cd:country> <cd:company>Columbia</cd:company> <cd:price>10.90</cd:price>

<cd:year>1985</cd:year>

</rdf:Description>

. . . . . . . . . . . .

Page 23: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example 2 - cont

Page 24: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

RDF as a Graph

Page 25: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Main elements

The RDF Element <rdf:RDF> The RDF element is the root of the RDF document. It

defines the XML document to be an RDF document and contains a reference to the xmlns:rdf namespace:

<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> . . Description goes here . </rdf:RDF>

The root element must always have a reference to the RDF namespace: http://www.w3.org/1999/02/22-rdf-syntax-ns#

Page 26: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Main elements

The Description Element <rdf:Description> The Description element describes a resource. The about attribute identifies the resource. Property elements are used to describe the

resource In example 2: The property elements (artist,

country, company, price, and year) are defined in the namespace xmln:cd.

Page 27: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

RDF Container Elements

The Bag Element <rdf:Bag> The Bag element contains an unordered list of

value elements The Seq Element <rdf:Seq>

The Seq element contains an ordered list of value elements

The Alt Element <rdf:Alt> The Alt element contains a list of alternative

values for an element

Page 28: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

rdf:Bag

<rdf:Description rdf:about="http://example.org/courses/6.001"> <s:students>

<rdf:Bag>

<rdf:li rdf:resource="http://example.org/students/Amy"/>

<rdf:li rdf:resource="http://example.org/students/Mohamed"/>

<rdf:li rdf:resource="http://example.org/students/Johann"/>

<rdf:li rdf:resource="http://example.org/students/Maria"/>

<rdf:li rdf:resource="http://example.org/students/Phuong"/> </rdf:Bag>

</s:students>

</rdf:Description>

Page 29: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

rdf:Bag graph

Page 30: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

RDF – SYNTAX

RDF primer Grigoris Antoniou Frank van Harmelen

Page 31: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Basic Ideas of RDF

Basic building block: object-attribute-value triple It is called a statement

RDF has been given a syntax in XML This syntax inherits the benefits of XML

The fundamental concepts of RDF are: resources properties statements

Page 32: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Resources

We can think of a resource as an object, a “thing” we want to talk about E.g. authors, books, publishers, places,

people, hotels Every resource has a URI, a Universal

Resource Identifier A URI can be

a URL (Web address) or some other kind of unique identifier

Page 33: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Properties

Properties are a special kind of resources They describe relations between resources

E.g. “written by”, “age”, “title”, etc. Properties are also identified by URIs Advantages of using URIs:

Α global, worldwide, unique naming scheme Reduces the homonym problem of distributed

data representation

Page 34: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Statements

Statements assert the properties of resources

A statement is an object-attribute-value triple It consists of a resource, a property, and

a value Values can be resources or literals

Literals are atomic values (strings)

Page 35: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Three Views of a Statement

A triple A piece of a graph A piece of XML code

Page 36: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Statements as Triples

The triple (x,P,y) can be considered as a logical formula P(x,y) Binary predicate P relates object x to

object y RDF offers only binary predicates

(properties)

Page 37: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

XML Vocabularies

A directed graph with labeled nodes and arcs from the resource (the subject of the

statement) to the value (the object of the statement)

Known in AI as a semantic net The value of a statement may be a

resource Ιt may be linked to other resources

Page 38: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Chapter 3 A Semantic Web Primer 38

Statements in XML Syntax

Graphs are a powerful tool for human understanding but

The Semantic Web vision requires machine-accessible and machine-processable representations

There is a 3rd representation based on XML But XML is not a part of the RDF data model E.g. serialisation of XML is irrelevant for RDF

Page 39: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Statements in XML

An RDF document is represented by an XML element with the tag rdf:RDF

The content of this element is a number of descriptions, which use rdf:Description tags.

Every description makes a statement about a resource, identified in 3 ways: an about attribute, referencing an existing resource an ID attribute, creating a new resource without a name, creating an anonymous resource

Page 40: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Statements in XML

The rdf:Description element makes a statement about the resource

Within the description the property is used as a tag the content is the value of the property

Page 41: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Reification In RDF it is possible to make statements

about statements A believes that David Billington is the creator

of http://www.cit.gu.edu.au/~db Such statements can be used to describe

belief or trust in other statements The solution is to assign a unique identifier

to each statement It can be used to refer to the statement

Page 42: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Reification (2) Introduce an auxiliary object (e.g. belief1) relate it to each of the 3 parts of the original

statement through the properties subject, predicate and object

In the preceding example subject of belief1 is David Billington predicate of belief1 is creator object of belief1 is

http://www.cit.gu.edu.au/~db

Page 43: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Data Types

Data types are used in programming languages to allow interpretation

In RDF, typed literals are used, if necessary

(“David Billington”,

http://www.mydomain.org/age,

“27”^^http://www.w3.org/2001/XMLSchema#integer)

Page 44: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Data Types (2) ^^-notation indicates the type of a literal In practice, the most widely used data typing

scheme will be the one by XML Schema But the use of any externally defined data typing

scheme is allowed in RDF documents

XML Schema predefines a large range of data types E.g. Booleans, integers, floating-point numbers,

times, dates, etc.

Page 45: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

XML-Based Syntax of RDF An RDF document consists of an rdf:RDF

element The content of that element is a number of

descriptions A namespace mechanism is used

Disambiguation Namespaces are expected to be RDF documents

defining resources that can be reused Large, distributed collections of knowledge

Page 46: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example of University Courses

<rdf:RDF

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

xmlns:xsd="http://www.w3.org/2001/XLMSchema#"

xmlns:uni="http://www.mydomain.org/uni-ns">

<rdf:Description rdf:about="949318">

<uni:name>David Billington</uni:name>

<uni:title>Associate Professor</uni:title>

<uni:age rdf:datatype="&xsd:integer">27<uni:age>

</rdf:Description>

Page 47: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example of University Courses (2)

<rdf:Description rdf:about="CIT1111"><uni:courseName>Discrete Maths</uni:courseName><uni:isTaughtBy>David Billington</uni:isTaughtBy></rdf:Description>

<rdf:Description rdf:about="CIT2112"><uni:courseName>Programming III</uni:courseName><uni:isTaughtBy>Michael Maher</uni:isTaughtBy></rdf:Description>

</rdf:RDF>

Page 48: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

rdf:about versus rdf:ID

An element rdf:Description has an rdf:about attribute indicating that the resource has

been “defined” elsewhere An rdf:ID attribute indicating that the resource is defined

Formally, there is no such thing as “defining” an object in one place and referring to it elsewhere Sometimes is useful (for human readability) to have a

defining location, while other locations state “additional” properties

Page 49: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Property Elements

Content of rdf:Description elements<rdf:Description rdf:about="CIT3116">

<uni:courseName>Knowledge Representation</uni:courseName>

<uni:isTaughtBy>Grigoris Antoniou</uni:isTaughtBy></rdf:Description>

uni:courseName and uni:isTaughtBy define two property-value pairs for CIT3116 (two RDF statements) read conjunctively

Page 50: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Data Types

The attribute rdf:datatype="&xsd:integer" is used to indicate the data type of the value of the age property

<rdf:Description rdf:about="949318">

<uni:name>David Billington</uni:name>

<uni:title>Associate Professor</uni:title>

<uni:age rdf:datatype="&xsd:integer">27<uni:age>

</rdf:Description>

Page 51: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Data Types (2) The age property has been defined to have

"&xsd:integer" as its range It is still required to indicate the type of the value

of this property each time it is used This is to ensure that an RDF processor can

assign the correct type of the property value even if it has not "seen" the corresponding RDF Schema definition before

This scenario is quite likely to occur in the unrestricted WWW

Page 52: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Chapter 3 A Semantic Web Primer 52

The rdf:resource Attribute

The relationships between courses and lecturers (in the example) were not formally defined but existed implicitly through the use of the same name

The use of the same name may just be a coincidence for a machine

We can denote that two entities are the same using the rdf:resource attribute

Page 53: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

The rdf:resource Attribute (2)

<rdf:Description rdf:about="CIT1111"><uni:courseName>Discrete

Mathematics</uni:courseName><uni:isTaughtBy rdf:resource="949318"/>

</rdf:Description>

<rdf:Description rdf:about="949318"><uni:name>David Billington</uni:name><uni:title>Associate Professor</uni:title>

</rdf:Description>

Page 54: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Referencing Externally Defined Resources

E.g., to refer the externally defined resource CIT1111:http://www.mydomain.org/uni-ns#CIT1111 as the value of rdf:about

www.mydomain.org/uni-ns is the URI where the definition of CIT1111 is found

A description with an ID defines a fragment URI, which can be used to reference the defined description

Page 55: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Nested Descriptions: Example

<rdf:Description rdf:about="CIT1111"><uni:courseName>Discrete

Maths</uni:courseName><uni:isTaughtBy>

<rdf:Description rdf:ID="949318"><uni:name>David

Billington</uni:name><uni:title>Associate

Professor</uni:title></rdf:Description>

</uni:isTaughtBy></rdf:Description>

Page 56: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Nested Descriptions

Descriptions may be defined within other descriptions

Other courses, such as CIT3112, can still refer to the new resource with ID 949318

Although a description may be defined within another description, its scope is global

Page 57: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Introducing some Structure to RDF Documents using the rdf:type Element

<rdf:Description rdf:ID="CIT1111"><rdf:type rdf:resource="http://www.mydomain.org/uni-

ns#course"/><uni:courseName>Discrete Maths</uni:courseName><uni:isTaughtBy rdf:resource="#949318"/>

</rdf:Description>

<rdf:Description rdf:ID="949318"><rdf:type rdf:resource="http://www.mydomain.org/uni-

ns#lecturer"/><uni:name>David Billington</uni:name><uni:title>Associate Professor</uni:title>

</rdf:Description>

Page 58: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Abbreviated Syntax

Simplification rules:1. Childless property elements within description elements

may be replaced by XML attributes

2. For description elements with a typing element we can use the name specified in the rdf:type element instead of rdf:Description

These rules create syntactic variations of the same RDF statement

They are equivalent according to the RDF data model, although they have different XML syntax

Page 59: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Abbreviated Syntax: Example

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

<rdf:type rdf:resource="http://www.mydomain.org/uni-ns#course"/>

<uni:courseName>Discrete Maths</uni:courseName>

<uni:isTaughtBy rdf:resource="#949318"/>

</rdf:Description>

Page 60: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Application of First Simplification Rule

<rdf:Description rdf:ID="CIT1111"uni:courseName="Discrete Maths">

<rdf:type rdf:resource="http://www.mydomain.org/uni-ns#course"/>

<uni:isTaughtBy rdf:resource="#949318"/></rdf:Description>

Page 61: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Application of 2nd Simplification Rule

<uni:course rdf:ID="CIT1111"uni:courseName="Discrete Maths">

<uni:isTaughtBy

rdf:resource="#949318"/>

</uni:course>

Page 62: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Container Elements

Collect a number of resources or attributes about which we want to make statements as a whole

E.g., we may wish to talk about the courses given by a particular lecturer

The content of container elements are named rdf:_1, rdf:_2, etc. Alternatively rdf:li

Page 63: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Three Types of Container Elements

rdf:Bag an unordered container, allowing multiple occurrences E.g. members of the faculty board, documents in a folder

rdf:Seq an ordered container, which may contain multiple occurrences E.g. modules of a course, items on an agenda, an

alphabetized list of staff members (order is imposed) rdf:Alt a set of alternatives

E.g. the document home and mirrors, translations of a document in various languages

Page 64: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example for a Bag

<uni:lecturer rdf:ID="949352" uni:name="Grigoris Antoniou"

uni:title="Professor"><uni:coursesTaught>

<rdf:Bag><rdf:_1 rdf:resource="#CIT1112"/><rdf:_2 rdf:resource="#CIT3116"/>

</rdf:Bag></uni:coursesTaught>

</uni:lecturer>

Page 65: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Example for Alternative

<uni:course rdf:ID="CIT1111"uni:courseName="Discrete Mathematics">

<uni:lecturer><rdf:Alt>

<rdf:li rdf:resource="#949352"/><rdf:li rdf:resource="#949318"/>

</rdf:Alt></uni:lecturer>

</uni:course>

Page 66: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Rdf:ID Attribute for Container Elements

<uni:lecturer rdf:ID="949318"  uni:name="David Billington">

<uni:coursesTaught><rdf:Bag rdf:ID="DBcourses">

<rdf:_1 rdf:resource="#CIT1111"/><rdf:_2 rdf:resource="#CIT3112"/>

</rdf:Bag></uni:coursesTaught>

</uni:lecturer>

Page 67: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Chapter 3 A Semantic Web Primer 67

Reification

Sometimes we wish to make statements about other statements

We must be able to refer to a statement using an identifier

RDF allows such reference through a reification mechanism which turns a statement into a resource

Page 68: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Reification Example

<rdf:Description rdf:about="#949352"><uni:name>Grigoris Antoniou</uni:name>

</rdf:Description>

reifies as

<rdf:Statement rdf:ID="StatementAbout949352"><rdf:subject rdf:resource="#949352"/><rdf:predicate

rdf:resource="http://www.mydomain.org/uni-ns#name"/>

<rdf:object>Grigoris Antoniou</rdf:object></rdf:Statement>

Page 69: Visual Models for Knowledge Engineering Madalina Croitoru croitoru@lirmm.fr

Reification (2) rdf:subject, rdf:predicate and rdf:object

allow us to access the parts of a statement The ID of the statement can be used to refer

to it, as can be done for any description We write an rdf:Description if we don’t want

to talk about a statement further We write an rdf:Statement if we wish to refer

to a statement