124
Semantic Web: Semantic Web: State of the Art and Opportunities State of the Art and Opportunities Aatif Hussain Warraich Compiled, partly based on various online tutorials and presentations, with respect to their authors University of Engineering and Technology, Lahore

Semantic web

Embed Size (px)

DESCRIPTION

“The Semantic Web is a vision: the idea of having data on the Web defined and linked in a way that it can be used by machines not just for display purposes, but for automation, integration and reuse of data across various applications”

Citation preview

Page 1: Semantic web

Semantic Web:Semantic Web:State of the Art and OpportunitiesState of the Art and Opportunities

Aatif Hussain WarraichCompiled, partly based on various online tutorials

and presentations, with respect to their authors

University of Engineering and Technology, Lahore

Page 2: Semantic web

Where we are Today: the Syntactic Web

[Hendler & Miller 02]

Page 3: Semantic web

Most of the Current Web (dumb links) Most of the Current Web (dumb links)

Page 4: Semantic web

Semantic WebSemantic Web(data connected by relationships)(data connected by relationships)

Page 5: Semantic web

Approach: Semantic WebApproach: Semantic Web

“The Semantic Web is a vision: the idea of having data on the Web defined and linked in a way that it can be used by machines not just for display purposes,

but for automation, integration and reuse

of data across various applications”

http://www.w3.org/sw/

The Semantic Web is an initiative with the goal of extending the current Web and facilitating Web automation, universally accessible web resources, and the 'Web of Trust', providing a universally accessible platform that allows data to be shared and processed by automated tools as well as by people.

Page 6: Semantic web

Tim Berners-Lee's Vision of Semantic Web (IJCAI-01)

Page 7: Semantic web

Semantic Web Stack(updated, W3C, 2006)

Page 8: Semantic web

Semantic Web: New “Users” Semantic Web: New “Users”

SemanticAnnotations

Ontologies Logical Support

Languages Tools Applications /Services

Web content

UsersCreatorsWWWandBeyond

SemanticWeb

Semantic Webcontent

UsersSemanticWeb andBeyond

Creators

applications

agents

Page 9: Semantic web

Semantic Web: Annotations

SemanticAnnotations

Ontologies Logical Support

Languages Tools Applications /Services

Web content

UsersCreatorsWWWandBeyond

SemanticWeb

Semantic Webcontent

UsersSemanticWeb andBeyond

Creators

applications

agents

Semantic annotations are specific sort of metadata, which provides information about particular domain objects, values of their properties and relationships, in a machine-processable, formal and standardized way.

Page 10: Semantic web

Semantic Web: Ontologies

SemanticAnnotations

Ontologies Logical Support

Languages Tools Applications /Services

Web content

UsersCreatorsWWWandBeyond

SemanticWeb

Semantic Webcontent

UsersSemanticWeb andBeyond

Creators

applications

agents

Ontologies make metadata interoperable and ready for efficient sharing and reuse. It provides shared and common understanding of a domain, that can be used both by people and machines. Ontologies are used as a form of agreement-based knowledge representation about the world or some part of it and generally describe: domain individuals, classes, attributes, relations and events.

Page 11: Semantic web

Semantic Web: Rules

SemanticAnnotations

Ontologies Logical Support

Languages Tools Applications /Services

Web content

UsersCreatorsWWWandBeyond

SemanticWeb

Semantic Webcontent

UsersSemanticWeb andBeyond

Creators

applications

agents

Logical support in form of rules is needed to infer implicit content, metadata and ontologies from the explicit ones. Rules are considered to be a major issue in the further development of the semantic web. On one hand, they can be used in ontology languages, in conjunction with or as an alternative to description logics. And on the other hand, they will act as a means to draw inferences, to configure systems, to express constraints, to specify policies, to react to events/changes, to transform data, to specify behavior of agents, etc.

Page 12: Semantic web

Semantic Web: Languages

SemanticAnnotations

Ontologies Logical Support

Languages Tools Applications /Services

Web content

UsersCreatorsWWWandBeyond

SemanticWeb

Semantic Webcontent

UsersSemanticWeb andBeyond

Creators

applications

agents

Languages are needed for machine-processable formal descriptions of: metadata (annotations) like e.g. RDF; ontologies like e.g. OWL.; rules like e.g. RuleML. The challenge is to provide a framework for specifying the syntax (e.g. XML) and semantics of all of these languages in a uniform and coherent way. The strategy is to translate the various languages into a common 'base' language (e.g. CL or Lbase) providing them with a single coherent model theory.

Page 13: Semantic web

Semantic Web: Tools

SemanticAnnotations

Ontologies Logical Support

Languages Tools Applications /Services

Web content

UsersCreatorsWWWandBeyond

SemanticWeb

Semantic Webcontent

UsersSemanticWeb andBeyond

Creators

applications

agents

User-friendly tools are needed for metadata manual creation (annotating content) or automated generation, for ontology engineering and validation, for knowledge acquisition (rules), for languages parsing and processing, etc.

Page 14: Semantic web

Semantic Web: Applications and Services

SemanticAnnotations

Ontologies Logical Support

Languages Tools Applications /Services

Web content

UsersCreatorsWWWandBeyond

SemanticWeb

Semantic Webcontent

UsersSemanticWeb andBeyond

Creators

applications

agents

Utilization of Semantic Web metadata, ontologies, rules, languages and tools enables to provide scalable Web applications and Web services for consumers and enterprises" making the web 'smarter' for people and machines.

Page 15: Semantic web

The Semantic Web

The Ontology Articulation Toolkit helps agents to

understand unknown ontologies

Page 16: Semantic web

Semantic Web basics…

RDF:• is a W3C standard, which provides tool to describe Web

resources

• provides interoperability between applications that exchange machine-understandable information

RDF Schema:– is a W3C standard which defines vocabulary for RDF– organizes this vocabulary in a typed hierarchy – capable to explicitly declare semantic relations between

vocabulary terms

Page 17: Semantic web

Mary

Director

Secretary

to_be_in_love_with

has_job

has_job

John

has_homepage

has_homepage

OntologyOntology

RDF – Semantic Web over Web Resources

Page 18: Semantic web

Resources

• All things being described by RDF expressions are called resources:– entire Web page;– a specific XML element;– whole collection of pages;– an object that is not directly accessible via the

Web.

Page 19: Semantic web

26

RDF Statement

Resource_i Value_nProperty_k

Resource_iProperty_r

Resource_ j

OR

Page 20: Semantic web

27

Semantic Relation as RDF statement(so called “object property”)

Ai Aj

Lk

Relation (i ≠ j)

http://www.cs.jyu.fi/ai/vagan/index.html http://www.jyu.fi/agora-center/indexEng.htmlPersonal web page of Terziyan V. Web page of Agora Center

refers_to

ResourceRelation

Resource

Subject objectPredicate

http://www.cs.jyu.fi/ai/vagan/#vaganURI of Terziyan V. employed_by

Dereferenceable URI (“Hash vs. Slash”)

URI of Agora Center http://www.jyu.fi/agora-center/#AC

Dereferenceable URI (“Hash vs. Slash”)

Page 21: Semantic web

28

Semantic Property as RDF statement (so called “datatype property”)

http://www.cs.jyu.fi/ai/vagan/index.htmlPersonal web page of Terziyan V.

Literal

has_birthday

ResourceProperty

Subject objectPredicate

LiteralAi

LkProperty (i = j)

15.02.2000

http://www.cs.jyu.fi/ai/vagan/#vaganURI of Terziyan V. has_birthday

27.12.1958Dereferenceable URI (“Hash vs. Slash”)

“Birthday” of the web-page

Birthday of Terziyan V.

Page 22: Semantic web

29

Semantic Network of Web Resources

http://www.cs.jyu.fi/ai/vagan/index.html http://www.jyu.fi/agora-center/indexEng.htmlPersonal web page of Terziyan V. Web page of Agora Center

refers_to

http://www.cs.jyu.fi/ai/vagan/#vaganURI of Terziyan V. employed_by URI of Agora Center

http://www.jyu.fi/agora-center/#AC

hasWebPage

isWebPageOf

hasWebPage

isWebPageOf27.12.1958

has_birthday

15.02.2000

has_birthday

Page 23: Semantic web

30

From Hyperlinks to Semantic Web

http://www.cs.jyu.fi/ai/ university

http://www.kture.kharkov.ua/

international_contacts

http://www.cs.jyu.fi/ai/contacts.html

Page 24: Semantic web

Resources and URIs

• A resource can be anything that has identity

• Uniform Resource Identifiers (URI)* provide a simple and extensible means for identifying a resource

• Not all resources are network "retrievable"; e.g., human beings, corporations, and books in a library can also be considered resources

* The term "Uniform Resource Locator" (URL) refers to the subset of URI that identify resources via a representation of their primary access mechanism (e.g., their network "location"), rather than identifying the resource by name or by some other attribute(s) of that resource.

Page 25: Semantic web

URI vs. URL

Venn diagram of Uniform Resource Identifier (URI) scheme categories. Schemes in the URL (locator) and URN (name) categories both function as resource IDs, so URL and URN are subsets of URI. They are also, generally, disjoint sets. However, many schemes can't be categorized as strictly one or the other, because all URIs can be treated as names, and some schemes embody aspects of both categories – or neither.

A URI represents a single concept or thing, but many URIs can represent the same thing.

All URLs are URIs. Not all URIs are URLs.

URI identifies something uniquely.

URL not only identifies something, but also describes where it is located.

Page 26: Semantic web

URL vs. URI example

URI of Vagan Terziyan in Nordea Database:

http://www.NordeaDB.fi/#VaganTerziyan

URI of Vagan Terziyan in the Central Hospital Database:

http://www.JKL_Central_Hospital_DB.fi/#VaganTerziyan

URL of Vagan Terziyan record in Nordea Database:

http://www.NordeaDB.fi/VaganTerziyanRecord

URL of Vagan Terziyan record in the Central Hospital Database:

http://www.JKL_Central_Hospital_DB.fi/VaganTerziyanRecord

?

Page 27: Semantic web

http://www.ted.com/talks/tim_berners_lee_on_the_next_web.html

Dereferenceable URIThe term Linked Data is used to describe a method of exposing, sharing, and connecting data via dereferenceable* URIs on the Web. Linked Data is about using the Web to connect related data that wasn’t previously linked, or using the Web to lower the barriers to linking data currently linked using other methods. More specifically, Wikipedia defines Linked Data as a term used to describe a recommended best practice for exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF. Linked Data aims to extend the Web with a data commons by publishing various open datasets as RDF on the Web and by setting RDF links between data items from different data sources.

*A dereferenceable Uniform Resource Identifier or dereferenceable URI is a resource retrieval mechanism that uses any of the internet protocols (e.g. HTTP) to obtain a copy or representation of the resource it identifies. In the context of traditional HTML web pages, this is the normal and obvious way of working: A URI refers to the page, and when requested the web server returns a copy of it. In other non-dereferenceable contexts, such as XML Schema, the namespace identifier is still a URI, but this is simply an identifier (i.e. a namespace name). There is no intention that this can or should be dereferenced. There is even a separate attribute, schemaLocation, which may contain a dereferenceable URI that does point to a copy of the schema document. In the case of Linked Data, the representation takes the form of a document (typically HTML or XML) that describes the resource that the URI identifies. In either case, the mechanism makes it possible for a user (or software agent) to "follow your nose" to find out more information related to the identified resource.

Page 28: Semantic web

Relationships between URIs illustrated

The picture shows a Big Lynx film team at work. Within the picture, Big Lynx Lead Cameraman Matt Briggs as well as his two assistants, Linda Meyer and Scott Miller, are identified by HTTP URIs from the Big Lynx namespace. The relationship, that they know each other, is represented by connecting lines having the relationship type http://xmlns.com/foaf/0.1/knows. [source: http://linkeddatabook.com/editions/1.0/ ]

Page 29: Semantic web

• Subject of an RDF statement is a resource

• Predicate of an RDF statement is a property of a resource

• Object of an RDF statement is the value of a property of a resource

RDF Statement

Page 30: Semantic web

Example of RDF Statement

Subject (resource) http://www.w3.org/Home/Lassila

Predicate (property) Creator

Object (literal) “Ora Lassila”

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

Lets represent the above statement in RDF/XML in accordance with the “serialization” and the “abbreviated” syntax (see next slides):

Page 31: Semantic web

RDF Example in serialization syntax (subject of statement)

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

<rdf:RDF> <rdf:Description rdf:about= "http://www.w3.org/Home/Lassila"> <s:Creator>Ora Lassila</s:Creator> </rdf:Description></rdf:RDF>

Subject

Page 32: Semantic web

RDF Example in serialization syntax (predicate of statement)

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

<rdf:RDF> <rdf:Description rdf:about= "http://www.w3.org/Home/Lassila"> <s:Creator>Ora Lassila</s:Creator> </rdf:Description></rdf:RDF>

Predicate

Page 33: Semantic web

RDF Example in serialization syntax

(object of statement)

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

<rdf:RDF> <rdf:Description rdf:about= "http://www.w3.org/Home/Lassila"> <s:Creator>Ora Lassila</s:Creator> </rdf:Description></rdf:RDF>

Object

Page 34: Semantic web

RDF Example in serialization syntax

(reference to ontology)

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

<rdf:RDF> <rdf:Description rdf:about= "http://www.w3.org/Home/Lassila"> <s:Creator>Ora Lassila</s:Creator> </rdf:Description></rdf:RDF> a specific namespace prefix as reference to

ontology where predicates are defined, e.g. xmlns: s="http://description.org/schema/"

Page 35: Semantic web

Full XML Document in serialization syntax for the Example

<?xml version="1.0"?><rdf:RDF

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

xmlns:s="http://description.org/schema/"> <rdf:Description rdf:about= "http://www.w3.org/Home/Lassila"> <s:Creator>Ora Lassila</s:Creator> </rdf:Description></rdf:RDF>

Namespaces

Page 36: Semantic web

Template/frame for RDF/XML statement (1)

Subject (URI)

Value

Ontology (URI)p

p pPredicate

Predicate

ValuePredicate

Subject

Page 37: Semantic web

Template/frame for RDF/XML statement (2)

Ontology (URI)p

p

Subject (URI)

Object (URI)

PredicateSubject Object

Page 38: Semantic web

RDF/XML Online Validatorhttp://www.w3.org/RDF/Validator/

Page 39: Semantic web

Abbreviated Syntax Example (1)

<rdf:RDF> <rdf:Description rdf:about="http://www.w3.org/Home/Lassila" s:Creator="Ora Lassila" /></rdf:RDF>

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

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

<rdf:Description rdf:about="http://www.w3.org/Home/Lassila" s:Creator="Ora Lassila"/>

</rdf:RDF>

Page 40: Semantic web

Abbreviated Syntax Example (2)

<rdf:Description rdf:about="http://www.w3.org/Home/Lassila" s:Creator="Ora Lassila" />

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila. Subject

Page 41: Semantic web

Abbreviated Syntax Example (3)

<rdf:Description rdf:about="http://www.w3.org/Home/Lassila" s:Creator ="Ora Lassila" />

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

Predicate

Page 42: Semantic web

Abbreviated Syntax Example (4)

<rdf:Description rdf:about="http://www.w3.org/Home/Lassila" s:Creator="Ora Lassila" />

Ora Lassila is the creator of the resource http://www.w3.org/Home/Lassila.

Object

Page 43: Semantic web

Template/frame for RDF statement

<?xml version="1.0"?> <rdf:RDF

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

xmlns: = " " >

<rdf:Description rdf:about= " “ "

: = " " />

</rdf:RDF>

Ontology (URI)

ValuePredicate

prefix

Subject (URI)

prefix

ValuePredicate

Subject

Page 44: Semantic web

RDF N3 syntax

• Notation3, or N3 as it is more commonly known, is a shorthand non-XML serialization of RDF models, designed with human-readability in mind: N3 is much more compact and readable than XML RDF notation. The format is being developed by Tim Berners-Lee and others from the Semantic Web community.

RDF sample in XML notation

RDF sample in N3 notation

http://www.w3.org/TeamSubmission/n3/

Page 45: Semantic web

Some fast hints:All URIs are quoted with angle brackets ( “<“ and “>” ). Whitespace within the < > is to be ignored.All values are within " " .Each statement ends with “.”@pref is used to define the namespace prefix.[ ] are used for the “blank nodes”.Check all in : http://www.w3.org/TeamSubmission/n3/

Square brackets for blank nodes:[ pl ] means x, where there exists some x such that x has properties in the property list pl. For example: [ :firstname "Ora" ] dc:wrote [ dc:title "Moby Dick" ] .

… is a statement which would be means in math:

exists x, y . firstname(x, "Ora") & dc:wrote(x,y) & dc:title (y, "Moby Dick")

… or in English "Some person who has a first name Ora wrote a book entitled "Moby Dick". Note not "the book" or "the person".

Shorthand:

Example:

@PREFIX dc: <http://purl.org/dc/elements/1.1/> .

<http://en.wikipedia.org/wiki/Tony_Benn> dc:publisher "Wikipedia" .

RDF N3 syntax

Page 46: Semantic web

Template/frame for RDF statement (N3)Subject Object

Predicate

Subject ValuePredicate

OR

Subject (URI)

< > Predicate (URI)< > Object (URI)< > .

Subject (URI)

< > Predicate (URI)< > Value" " .

OR

@prefix Onto:

Subject: Predicate: : Object .Onto OntoOnto

Ontology (URI)< > .

Subject: Predicate: " Value .OntoOnto "

OR

Page 47: Semantic web

Some N3 syntax specifics

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:Professor a rdfs:Class .

<http://www.cs.jyu.fi/ai/vagan> a :Professor .

Ontological statements in N3

http://www.w3.org/TeamSubmission/n3/

Page 48: Semantic web

1. Gender of Vagan Terziyan is male.

2. His mother is Svetlana Terziyan.

3. He is fun of fishing.

4. He is fun of Nordic walking.

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasGender >"male" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasMother><http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#SvetlanaTerziyan> .<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"Fishing" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"NordicWalking" .

The story 4 RDF (N3) statements

RDF N3 examples

Page 49: Semantic web

1. Gender of Vagan Terziyan is male.

2. His mother is Svetlana Terziyan.

3. He is fun of fishing.

4. He is fun of Nordic walking.

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasGender >"male" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasMother><http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#SvetlanaTerziyan> .<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"Fishing" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"NordicWalking" .

@prefix On1: <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#> .

@prefix On2: <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#> .

On1:VaganTerziyan On1:hasGender "male" .

On1:VaganTerziyan On1:hasMother On1:SvetlanaTerziyan .

On1:VaganTerziyan On2:isFunOf "Fishing" .

On1:VaganTerziyan On2:isFunOf "NordicWalking" .

Reader-friendly version

RDF N3 examples

Page 50: Semantic web

1. Gender of Vagan Terziyan is male.

2. His mother is Svetlana Terziyan.

3. He is fun of fishing.

4. He is fun of Nordic walking.

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasGender >"male" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasMother><http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#SvetlanaTerziyan> .<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"Fishing" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"NordicWalking" .

Compact version

@prefix On1: <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#> .@prefix On2: <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#> .

On1:VaganTerziyan On1:hasGender "male" ; On1:hasMother On1:SvetlanaTerziyan ; On2:isFunOf "Fishing" , "NordicWalking" .

RDF N3 examples

Page 51: Semantic web

Online RDF translatorhttp://rdf-translator.appspot.com/

Page 52: Semantic web

… lets validate the translationhttp://www.w3.org/RDF/Validator/

Page 53: Semantic web

Online RDF translator (“Ora Lassila” example)http://rdf-translator.appspot.com/

Page 54: Semantic web

1. Gender of Vagan Terziyan is male.

2. His mother is Svetlana Terziyan.

3. He is fun of fishing.

4. He is fun of Nordic walking.

5. He is fun of mother’s hobby.

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasGender >"male" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#hasMother><http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#SvetlanaTerziyan> .<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"Fishing" .

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>"NordicWalking" .

Compact version

@prefix On1: <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#> .@prefix On2: <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#> .

On1:VaganTerziyan On1:hasGender "male" ; On1:hasMother On1:SvetlanaTerziyan ; On2:isFunOf "Fishing" , "NordicWalking" , [On2:isHobbyOf On1:SvetlanaTerziyan ] .

RDF/N3 example (blank node with [ ])

<http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#VaganTerziyan> <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isFunOf>[<http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#isHobbyOf> <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#SvetlanaTerziyan>].

Page 55: Semantic web

… lets translate it to RDF/XML …http://rdf-translator.appspot.com/

Page 56: Semantic web

… and check with RDF/XML validatorhttp://www.w3.org/RDF/Validator/

Page 57: Semantic web

Studer(98): Formal, explicit specification of a shared conceptualization

Machine readable

Concepts, properties,functions, axiomsare explicitly defined

Consensualknowledge

Abstract model of some domain

What is an ontology?

Page 58: Semantic web

66

What is an Ontology?A model of (some aspect of) the world

• Introduces vocabulary relevant to domain, e.g.:

– Anatomy

From: Ian Horrocks “OWL 2: The Next Generation”

Page 59: Semantic web

67

What is an Ontology?A model of (some aspect of) the world

• Introduces vocabulary relevant to domain

• Specifies meaning of terms

Heart is a muscular organ thatis part of the circulatory system

From: Ian Horrocks “OWL 2: The Next Generation”

Page 60: Semantic web

68

What is an Ontology?A model of (some aspect of) the world

• Introduces vocabulary relevant to domain

• Specifies meaning of terms

Heart is a muscular organ thatis part of the circulatory system

• Formalised using suitable logic

From: Ian Horrocks “OWL 2: The Next Generation”

Page 61: Semantic web

Ontology Elements

• Concepts(classes) + their hierarchy

• Concept properties (slots/attributes) + their hierarchy

• Property restrictions (type, cardinality, domain …)

• Relations between concepts (disjoint, equality …)

• Instances

Page 62: Semantic web

70

DL SemanticsSemantics given by standard FO model theory:

John

Mary

Lawyer

Doctor

Vehicle

hasChild

owns

(Lawyer and Doctor)

From: Ian Horrocks “OWL: A Description Logic Based Ontology Language”

Page 63: Semantic web

RDF Schema (language for simple ontologies)

• rdfs:Resource

• rdfs:Class

• rdfs:domain

• rdfs:range

• rdfs:subClassOf

• rdfs:subPropertyOf

• …

RDF schema is a semantic extension of RDF used for simple ontologies’ design. The RDF schema language is used for declaring basic class and types when describing the terms used in RDF and are used to determine characteristics of other resources, such as the domains and ranges of properties.

RDF Schema provides a data-modelling vocabulary for RDF data.

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

The RDF Schema class and property system is similar to the type systems of object-oriented programming languages such as Java. RDF Schema differs from many such systems in that instead of defining a class in terms of the properties its instances may have, RDF Schema describes properties in terms of the classes of resource to which they apply.The namespace is identified by:

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

Page 64: Semantic web

RDFS example…

:Mary :hasHusband :John .…

:hasHusband

rdf:property

rdf:type

rdfs:Domain

rdfs:Range

:Woman

:Man

:Person

rdfs:

subC

lassO

f

rdfs:subPropertyOf

:hasSpoothrdfs:Domain

rdfs:Range

rdf:type

rdfs:Class

rdf:typerdf:type

:John

:Mary

rdf:type

rdf:type

RDFS

:hasHusband

RDF

rdfs:subClassOf

rdf:type

Page 65: Semantic web

RDFS example

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix : <http://www.cs.jyu.fi/ai/vagan/ontologies/LifeInFinland.owl#> .

:Person a rdfs:Class .:Woman a rdfs:Class .:Man a rdfs:Class .:Woman rdfs:subClassOf :Person .:Man rdfs:subClassOf :Person .:hasHusband a rdf:Property .:hasSpooth a rdf:Property .:hasHusband rdfs:subPropertyOf :hasSpooth .:hasSpooth rdfs:domain :Person .:hasSpooth rdfs:range :Person .:hasHusband rdfs:domain :Woman .:hasHusband rdfs:range :Man .:John a :Man .:Mary a :Woman .:Mary :hasHusband :John .

Page 67: Semantic web

… and validate RDF/XML

http://www.w3.org/RDF/Validator/

Page 68: Semantic web

RDFS example (continue)

@base <http://www.cs.jyu.fi/ai/vagan/LifeInFinland.owl> .@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix owl: <http://www.w3.org/2002/07/owl#> .@prefix : <http://www.cs.jyu.fi/ai/vagan/LifeInFinland.owl#> .

:Person a rdfs:Class .:Woman a rdfs:Class .:Man a rdfs:Class .:Woman rdfs:subClassOf :Person .:Man rdfs:subClassOf :Person .:hasSpooth a owl:ObjectProperty .:hasHusband a owl:ObjectProperty .:hasHusband rdfs:subPropertyOf :hasSpooth .:hasSpooth rdfs:domain :Person .:hasSpooth rdfs:range :Person .:hasHusband rdfs:domain :Woman .:hasHusband rdfs:range :Man .:John a :Man .:Mary a :Woman .:Mary :hasHusband :John .

Adding some “cosmetics” from OWL (Web Ontology Language):

Page 69: Semantic web

… then we got translation to RDF/XMLhttp://rdf-translator.appspot.com/

Page 70: Semantic web

… validating RDF/XMLhttp://www.w3.org/RDF/Validator/

Page 71: Semantic web

… then we publish RDF/XML as OWL file to the right place in the Web

Page 72: Semantic web

Opening file in Protégé (Screenshot 1)

Page 73: Semantic web

Opening file in Protégé (Screenshot 2)

Page 74: Semantic web

Dublin Core• A set of fifteen basic properties for describing

generalised Web resources;• ISO Standard 15836-2003 (February 2003) and

ANSI/NISO Z39.85-2012 (February 2013) : http://www.niso.org/apps/group_public/download.php/10256/Z39-85-2012_dublin_core.pdf

Namespace:@prefix dc: http://purl.org/dc/elements/1.0/ .

http://dublincore.org/

The Dublin Core Metadata Initiative is an open forum engaged in the development of interoperable online

metadata standards that support a broad range of purposes and business models.

Page 75: Semantic web

83

Dublin Core (15 basic properties):

Page 76: Semantic web

<?xml version="1.0"?>

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

<rdf:Description rdf:about="http://www.ukoln.ac.uk/metadata/resources/dc/datamodel/WD-dc-

rdf/"> <dc:title> Guidance on expressing the Dublin Core within the RDF </dc:title> <dc:creator> Eric Miller </dc:creator> <dc:creator> Paul Miller </dc:creator> <dc:creator> Dan Brickley </dc:creator> <dc:subject> Dublin Core; RDF; XML </dc:subject> <dc:publisher> Dublin Core Metadata Initiative </dc:publisher> <dc:contributor> Dublin Core Data Model Working Group </dc:contributor> <dc:date> 1999-07-01 </dc:date> <dc:format> text/html </dc:format> <dc:language> en </dc:language> </rdf:Description> </rdf:RDF>

Dublin Core Example (RDF/XML)

Page 77: Semantic web

Dublin Core Example (RDF/N3)

Obtained with: http://rdf-translator.appspot.com/

Page 78: Semantic web

HUMAN

#Vagan Vagan Terziyan 27/12/58 #JyU

#John

#Aino

C

Properties (predicate)

Resources (subject)

hasBirthd

ay

isEm

ployedBy

hasNam

e

hasSurnam

e

:#JyU :hasTitle “University of Jyvaskyla”

:#JyU :hasLocation “Finland”:#JyU :hasWorldRank “204”:#JyU :hasRector :#Aino

:#JyU a UNIVERSITY

UNIVERSITY

#MIT

#JyUUniversity of Jyvaskyla

Finland 204 #Aino

#KNURE

C

ha

sWo

rldR

an

k

hasRector

hasTitle

hasLocation

:#Vagan :hasName “Vagan”:#Vagan :hasSurname “Terziyan”:#Vagan :hasBirthday “27/12/58”:#Vagan :isEmployedBy :#JyU

:#Vagan a HUMAN

:#Aino a HUMAN

Each cell is an RDF triple

Each cell is an RDF triple

RDF triples

RDF triples (continue)

… … …

!

RDF (as a Linked Data) Illustrated

Page 79: Semantic web

Traditional RDF Statement

Resource_i LiteralProperty_k

Resource_iProperty_r

Resource_ j

OR

• Subject of an RDF statement is a resource

• Predicate of an RDF statement is a property of a resource

• Object of an RDF statement is the value of a property of a resource (either literal or resource)

Page 80: Semantic web

New semantics of RDF Statement in S-APL (object - executable resource)

Resource_iProperty_m

exe: Resource_ j

executable propertySemantics of such statement means that the value of the

Property_m of the Resource_i can be obtained as a result of

execution of the procedure (query, service, function, etc.) represented

as Resource_ j

S-APLS-APLSemantic Agent Programming Language

(Designed by Industrial Ontologies Group)

Page 81: Semantic web

execution

Page 82: Semantic web

RDFa: Combining human- and machine-readable information within the same document !

Today's web is built predominantly for human readers. Even as machine-readable data begins to permeate the web, it is typically distributed in a separate file, with a separate format, and very limited correspondence between the human and machine versions. As a result, web browsers can provide only minimal assistance to humans in parsing and processing web pages: browsers only see presentation information. RDFa is intended to solve the problem of marking up machine-readable data in HTML documents. RDFa provides a set of HTML attributes to augment visual data with machine-readable hints. Using RDFa, authors may turn their existing human-visible text and links into machine-readable data without repeating content.

RDFa (or Resource Description Framework – in – attributes) is a W3C Recommendation that adds a set of attribute-level extensions to XHTML for embedding rich metadata within Web documents. RDFa provides a set of XHTML attributes to augment visual data with machine-readable hints and turns the existing human-visible text and links into machine-readable data without repeating content. The great thing about RDFa is the ability to weave meaning and rich data directly into a web page without having any impact on the front-end user experience.

XHTMLHTML5

Page 83: Semantic web
Page 84: Semantic web

Example of HTML :

Browser screenshot:

RDFa Example (1)

Page 85: Semantic web

RDFa Example (2)http://www.w3.org/TR/xhtml-rdfa-primer/

Use:Read first:

(http://rdfa.info/play/)

Update your HTML with some RDFa inside and check it:

Page 86: Semantic web

RDFa Example (3)

HTML marked up with RDFa :

Page 87: Semantic web

RDFa Example (“Happy end”)

Page 88: Semantic web

96

Where to look next

• RDF:http://www.w3.org/RDF/

• RDF Schema:http://www.w3.org/TR/rdf-schema/

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

Page 89: Semantic web

DBpedia (DataBasePedia) is a project aiming to extract structured content from the information created as part of the Wikipedia project and making it available in the Web. DBpedia allows querying relationships and properties associated with Wikipedia resources, including links to other related datasets. Therefore DBpedia is one of the more famous parts of the decentralized Linked Data effort.

DBpedia http://dbpedia.org/

The DBpedia data set uses a large multi-domain ontology which has been derived from Wikipedia. The English version of the DBpedia 2014 data set currently describes 4.58 million “things” with 583 million “facts”. In addition, localized versions of DBpedia available in 125 languages. All these versions together describe 38.3 million things, out of which 23.8 million overlap (interlinked) with concepts from the English DBpedia.

Page 90: Semantic web

Concepts in DBpediaDBpedia Ontology (2014)

The DBpedia Ontology is a shallow, cross-domain ontology, which has been manually created based on the most commonly used infoboxes within Wikipedia. The ontology currently covers 685 classes which form a subsumption hierarchy and are described by 2,795 different properties.

Page 91: Semantic web

Each thing in the DBpedia data set is denoted by a de-referenceable URI-based reference of the form:

http://dbpedia.org/resource/Name ,where Name is derived from the URL of the source Wikipedia article, which has the form:

http://en.wikipedia.org/wiki/Name .Thus, each DBpedia entity is tied directly to a Wikipedia article. Every DBpedia entity name resolves to a description-oriented Web document (or Web resource). Read more in: http://wiki.dbpedia.org/Datasets

http://wiki.dbpedia.org/Datasets

Naming “things” in DBpedia

http://dbpedia.org/resource/Kharkiv http://en.wikipedia.org/wiki/Kharkiv

Kharkiv city in Wikipedia and DBpedia

Page 92: Semantic web

Building personal graph as Linked Data@base <http://www.cs.jyu.fi/ai/vagan/ontologies/university.owl#> .@prefix db: <http://dbpedia.org/resource/> .@prefix gs: <http://scholar.google.com/citations?user=> .

db:Kharkiv

db:Ukraine

db:Finland

db:University_of_Jyvaskyla

db:Kharkiv_National_University_of_Radioelectronics

:hasPlaceOf Birth

:isResidentOf

:isCitizenOf

:isEmployedBy

:hasPhDFrom:hasPublicationRecord

:VaganTerziyan

gs:4U8ydfgAAAAJ

Page 93: Semantic web

OWL: Web Ontology Language

• The Web Ontology Language (OWL) is a family of knowledge representation languages or ontology languages for engineering ontologies or knowledge bases. The languages are characterized by formal semantics and RDF/XML-based serializations for the Semantic Web.

• OWL DL (Description Logic) designed to provide the maximum expressiveness possible while retaining computational completeness (either φ or ¬φ belong), decidability (there is an effective procedure to determine whether φ is derivable or not), and the availability of practical reasoning algorithms. OWL DL includes all OWL language constructs, but they can be used only under certain restrictions

http://www.w3.org/TR/owl-ref/ OWL 2004

http://www.w3.org/TR/owl2-overview/ OWL-2 2009

Page 94: Semantic web

• RDFS is too weak in describing resources with sufficient details, e.g.: – No localised range and domain constraints

• Cannot say that the range of isToughtBy is only professor when applied to professors and lecturer when applied to lecturers

– No cardinality constraints• Cannot say that a course is taught by at least one professor, or persons have

exactly 2 parents

– No transitive, inverse or symmetrical properties• Cannot say that isPartOf is a transitive property, that hasSupervisor is the

inverse of isSupervisorOf, and, that friendOf is symmetrical

– Disjoint classes • Cannot say that Graduate and PhD. Students are two disjoint classes

– Boolean combinations of classes• Sometimes we may need to build new classes by combining other classes using

union, intersection, and complement (e.g. person is the disjoint union of the classes male and female)

Why OWL? Limitations of RDFS

Page 95: Semantic web

rdfs:Resource

rdf:Propertyrdfs:Class

owl:Class owl:ObjectProperty owl:DatatypeProperty

OWL Class and OWL Properties

Page 96: Semantic web
Page 97: Semantic web

• Symmetric: if P(x, y) then P(y, x)• Transitive: if P(x,y) and P(y,z) then P(x, z)• Functional: if P(x,y) and P(x,z) then y=z• InverseOf: if P1(x,y) then P2(y,x)• InverseFunctional: if P(y,x) and P(z,x) then y=z• allValuesFrom: P(x,y) and y=allValuesFrom(C)• someValuesFrom: P(x,y) and y=someValuesFrom(C)• hasValue: P(x,y) and y=hasValue(v)• cardinality: cardinality(P) = N• minCardinality: minCardinality(P) = N• maxCardinality: maxCardinality(P) = N• equivalentProperty: P1 = P2• intersectionOf: C = intersectionOf(C1, C2, …)• unionOf: C = unionOf(C1, C2, …)• complementOf: C = complementOf(C1)• oneOf: C = one of(v1, v2, …)• equivalentClass: C1 = C2• disjointWith: C1 != C2• sameIndividualAs: I1 = I2• differentFrom: I1 != I2• AllDifferent: I1 != I2, I1 != I3, I2 != I3, …• Thing: I1, I2, …

OWL on one Slide

Legend:Properties are indicated by: P, P1, P2, etcSpecific classes are indicated by: x, y, zGeneric classes are indicated by: C, C1, C2Values are indicated by: v, v1, v2Instance documents are indicated by: I1, I2, I3, etc.A number is indicated by: NP(x,y) is read as: “property P relates x to y”

Page 98: Semantic web

An Example

• Woman ≡ Person ⊓ Female• Man ≡ Person ⊓ ¬Woman• Mother ≡ Woman ⊓ ∃hasChild.Person• Father ≡ Man ⊓ ∃hasChild.Person

• Parent ≡ Father ⊔ Mother

• Grandmother ≡ Mother ⊓ ∃hasChild.Parent

We can further infer (though not explicitly stated):

Grandmother Person⊑ Grandmother Man ⊑ ⊔ Woman

etc.

Page 99: Semantic web

OWL-2 adds new functionality with respect to OWL.:

• keys; • disjoint union of classes• property chains; • richer datatypes, data ranges; • qualified cardinality restrictions; • asymmetric, reflexive, and disjoint properties; • enhanced annotation capabilities .

OWL-2 vs. OWL

Page 100: Semantic web

• W3C Documents– Guide: http://www.w3.org/TR/owl-guide/– Reference: http://www.w3.org/TR/owl-ref/– Semantics and Abstract Syntax:

http://www.w3.org/TR/owl-semantics/• OWL Tutorials

– Ian Horrocks, Sean Bechhofer:http://www.cs.man.ac.uk/~horrocks/Slides/Innsbruck-tutorial/

– Roger L. Costello, David B. Jacobs: http://www.xfront.com/owl/

• Example Ontologies, e.g. here:http://www.daml.org/ontologies/

Resources

Page 101: Semantic web

Tutorial: Designing Ontologies with Protégé

http://www.cs.jyu.fi/ai/vagan/ProtegeOWL_1.ppt

http://www.cs.jyu.fi/ai/vagan/ProtegeOWL_2.ppt

• Protégé is an ontology editor and a knowledge-base editor (download from:

http://protege.stanford.edu ).• Protégé is also an open-source,

Java tool that provides an extensible architecture for the creation of customized knowledge-based applications.

• Protégé's OWL Plug-in now provides support for editing Semantic Web ontologies.

PLEASE !!!Download version:Protégé 3.5.

http://www.cs.jyu.fi/ai/vagan/Ontologies.ppt

Page 102: Semantic web

Download Protégé 3.5 http://protege.stanford.edu/

Page 103: Semantic web
Page 104: Semantic web

Semantic Web / Ontologies / OWL are based on the Open World Assumption: “everything is allowed if not explicitly prohibited”

Databases / SQL / Prologue are based on the Closed World Assumption: “everything is prohibited if not explicitly allowed”

John Maryloves

Q: John loves Mary?A: yes

Q: Mary loves John?A: I do not know …

Example:

John Maryloves

Q: John loves Mary?A: yes

Q: Mary loves John?A: no

Example:Non-Monotonic Logic driven by the “negation as failure” rule is used for reasoning. For example “belief revision” can be applied as the process of changing beliefs to accommodate a new belief that might be inconsistent with the old ones. In the assumption that the new belief is correct, some of the old ones have to be retracted in order to maintain consistency.

Monotonic Logic assumes that adding a formula to a theory never produces a reduction of its set of consequences, i.e., learning a new piece of knowledge cannot reduce the set of what is known. Therefore monotonic logic cannot handle various reasoning tasks such as: reasoning by default (consequences may be derived only because of lack of evidence of the contrary); abductive reasoning (consequences are only deduced as most likely explanations); belief revision (when new knowledge may contradict old beliefs), etc.

Restrictions of Monotonic Logic

Page 105: Semantic web
Page 106: Semantic web

Example (formalised rules)

R : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

1. Mary will love John if he loves her and if he is not abusing Pete.

2. Pete will consider Mary as his friend if she is not in love with John.

3. Pete will not consider Mary as his friend if she is in love with John who is abusing him.

4. John will stop loving Mary if she does not love him or she is a friend of Pete.

5. Mary will stop loving John if he is abusing Pete.

6. John being in bad mood will abuse Pete.

7. John gets rid of bad mood if Mary loves him or if she is not a friend of Pete.

8. John will fall in a bad mood if he loves Mary and she does not love him or vice versa.

9. John will stop abusing Pete if he (John) does not love Mary any more or if she is not a friend of Pete.

P1 = :John:loves :Mary .

P2 = :Mary :loves :John .

P3 = :Pete :hasFriend :Mary .

P4 = :John :isAbusing :Pete .

P5 = :John :hasBadMood ”true”.

543210 PPPPP=)S(t ∧∧∧∧Let the initial state to be:

Atomic predicates from the story:

Formalized rules from the story:

Rules as the story:

Page 107: Semantic web

Example (reasoning, 1-st step)

John Mary

Pete

loves

hasFriend

543210 PPPPP=)S(t ∧∧∧∧

R : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .543210 PPPPP=)S(t ∧∧∧∧+τ

Hereinafter for the simplicity we will apply the rules synchronously !

Page 108: Semantic web

Example (reasoning, 2-nd step)

John Mary

Pete

loves

hasFriend

R : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

543210 PPPPP=)S(t ∧∧∧∧+τ

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ2

hasBadMood

Page 109: Semantic web

Example (reasoning, 3-rd step)

John Mary

Pete

loves

hasFriend

R : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ2

isAbusing

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ3

Page 110: Semantic web

Example (reasoning, 4-th step)

John Mary

PeteR : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ3

hasBadMood

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ4

Page 111: Semantic web

Example (reasoning, 5-th step)

John Mary

PeteR : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ4

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ5

isAbusing hasFriend

Page 112: Semantic web

Example (reasoning, reaching terminal state)

John Mary

PeteR : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

543210 PPPPP=)S(t ∧∧∧∧⋅+ τ5

hasFriend

terminal state

Page 113: Semantic web

Example (final “terminal” state)

1. John does not love Mary.

2. Mary does not love John.

3. Mary is a friend of Pete.

4. John is not abusing Pete.

5. John is not in a bad mood.

543210 PPPPP=)5S(t ∧∧∧∧⋅+ τ

Page 114: Semantic web

Example (another initial and in the same time terminal state)

1. John loves Mary.

2. Mary loves John.

3. Mary is not a friend of Pete.

4. John is not abusing Pete.

5. John is not in a bad mood.

543210 PPPPP=)S(t ∧∧∧∧

John Mary

Pete

to love

to love

R : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

terminal state

Page 115: Semantic web

Example (two possible terminal states of the “love triangle”)

John Mary

Pete

to love

to love

John Mary

Peteto have a friend

Page 116: Semantic web

Example (asynchronous reasoning tree)

54321 PPPPP ∧∧∧∧

R : IF (P P P ) THEN P1 1 4 2 2∧ ∧ ;R : IF (P P ) THEN P2 2 3 3∧ ;R : IF (P P P ) THEN P3 2 4 3 3∧ ∧ ;R : IF ((P P ) P ) THEN P4 3 2 1 1∨ ∧ ;R : IF (P P ) THEN P5 2 4 2∧ ;R : IF (P P ) THEN P6 5 4 4∧ ;R : IF ((P P ) P ) THEN P7 2 3 5 5∨ ∧ ;R : IF ((P P P P ) P ) THEN P8 1 2 1 2 5 5∧ ∨ ∧ ∧ ;R : IF ((P P ) P ) THEN P9 1 3 4 4∨ ∧ .

54321 PPPPP ∧∧∧∧54321 PPPPP ∧∧∧∧ 54321 PPPPP ∧∧∧∧

R1R4

R8

54321 PPPPP ∧∧∧∧

R4

R1

54321 PPPPP ∧∧∧∧

R6

54321 PPPPP ∧∧∧∧54321 PPPPP ∧∧∧∧

R4

54321 PPPPP ∧∧∧∧

R8R4 R6

54321 PPPPP ∧∧∧∧

R4

54321 PPPPP ∧∧∧∧

R6

54321 PPPPP ∧∧∧∧R9

54321 PPPPP ∧∧∧∧R5

R3

R7

54321 PPPPP ∧∧∧∧ 54321 PPPPP ∧∧∧∧54321 PPPPP ∧∧∧∧

R5R9 R7

R3

54321 PPPPP ∧∧∧∧

R5

R8R9

R2

54321 PPPPP ∧∧∧∧R7

54321 PPPPP ∧∧∧∧R9

54321 PPPPP ∧∧∧∧

R6 R7R5

R8

R9

R9

54321 PPPPP ∧∧∧∧R9 R2

R2

R6

R7

R9

R2

R8

Page 117: Semantic web

http://www.w3.org/Submission/SWRL/

Page 118: Semantic web

Semantic Rules in SWRL

Page 119: Semantic web

SWRL Rule structureContains an antecedent part (body), and a consequent (head).The body and head consist of positive conjunctions of atoms:

Atom ∧ Atom … → Atom ∧ Atom …

SWRL provides seven types of atoms:

- Class Atoms owl:Class e.g., Person (?x), …, Person (John)

- Individual Property atoms owl:ObjectProperty e.g., loves (?x, ?y), …, loves (John, Mary)

- Data Valued Property atoms owl:DatatypeProperty e.g., hasAge(?x, 19), …, hasAge(Mary, 19)

- Different Individuals atoms e.g., differentFrom(?x, ?y), …,

- Same Individual atoms e.g., sameAs(?x, ?y), …, sameAs(John, ?y)

- Built-in atoms (next slide)

Person(?x) ∧ hasSibling(?x,?y) ∧ Man(?y) → hasBrother(?x,?y)

antecedent consequent

Page 120: Semantic web

SWRL built-ins

swrlb:equal

swrlb:notEqual

swrlb:lessThan

swrlb:lessThanOrEqual

swrlb:greaterThan

swrlb:greaterThanOrEqual

swrlb:stringEqualIgnoreCase (satisfied iff the first argument (string) is the same as the second argument (upper/lower case ignored))

Comparison of two datatypesswrlb:add (satisfied iff the first argument is equal to the arithmetic sum of the second argument and the third argument)

swrlb:subtract

swrlb:multiply

swrlb:divide

swrlb:pow (satisfied iff the first argument is equal to the result of the second argument raised to the third argument power)

swrlb:abs (satisfied iff the first argument is the absolute value of the second argument)

swrlb:round (satisfied iff the first argument is equal to the nearest number to the second argument with no fractional part)

swrlb:booleanNot (satisfied iff the first argument is true and the second argument is false, or vice versa.

Some mathematical operations

Read more in: http://www.w3.org/Submission/SWRL/

Page 121: Semantic web

Examples of SWRL Rules (1)

Rule computes age of a person from the current year and the date of birth:

Person(?x) ∧ hasYearOfBirth(?x, ?yborn) ∧ hasCurrentYear(?x,?ycurrent) ∧∧ swrlb:subtract(?age, ?ycurrent, ?yborn) →

→ hasAgeYears(?x,?age)

Page 122: Semantic web

Examples of SWRL Rules

A researcher, which Hirsch-index (citation index) is more than amount of years in her academic career, is a good researcher:

Researcher(?x) ∧ hasHindexOfPublications(?x, ?hirschindex) ∧∧ hasYearsInCareer(?x, ?years) ∧ swrlb:greaterThan(?hirschindex,?years) →

→ GoodResearcher(?x)

Page 123: Semantic web

Examples of SWRL Rules

A person of age between 29-55 would have an extra weight equal to positive difference between his/her weight in kilos and his/her height in centimeters (minus 100):

Person(?x) ∧ hasAgeYears(?x,?age) ∧ swrlb:greaterThan(?age, 28) ∧∧ swrlb:lessThan(?age, 56) ∧ hasWeightKg(?x, ?weight) ∧ hasLengthSm(?x, ?length) ∧∧ swrlb:subtract(?ideal, ?length, 100) ∧ swrlb:subtract(?extra, ?weight, ?ideal) ∧∧ swrlb:greaterThan(?extra, 0) →

→ hasExtraWeightKg(?x, ?extra)

Page 124: Semantic web

Examples of SWRL Rules

A person of age between 29-55 would have a lacking weight equal to positive difference between his/her height in centimeters (minus 100) and his/her weight in kilos:

Person(?x) ∧ hasAgeYears(?x,?age) ∧ swrlb:greaterThan(?age, 28) ∧∧ swrlb:lessThan(?age, 56) ∧ hasWeightKg(?x, ?weight) ∧ hasLengthSm(?x, ?length) ∧∧ swrlb:subtract(?ideal, ?length, 100) ∧ swrlb:subtract(?lacking, ?ideal, ?weight) ∧∧ swrlb:greaterThan(?lacking, 0) →

→ hasLackingWeightKg(?x, ?lacking)