semantic web محمد احمدی نیا ahmadinia@gmail.com. 2 of 73 outline why semantic web? ...

Post on 03-Jan-2016

231 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Semantic Web

محمد احمدی نیاahmadinia@gmail.com

2 Of 73

Outline

Why Semantic Web? What is Semantic Web? Semantic Web Main Technologies

XML RDF RDFs OWL

3 Of 73

Mom

Physician’s Agent

Lucy’s Agent

requiredtreatment

Schedule appointment

Insurance Co.

Provider sites

Rating

in-plan?close-by?

Specialist?

Pete’ Agent

Driving schedule

Semantic Web Scenario

4 Of 73

The Vision

The World Wide Web (the syntactic web) is a big and impressive success story, both in terms of the amount of available information and the growth rate of human users

It has entered most areas of our daily life and business.

5 Of 73

The Vision

This success is based on its simplicity It’s easy to publish information on the web It’s easy to access information (but if you know where

they are)

6 Of 73

Why Semantic Web?

Tasks often require to combine data on the Web: hotel and travel information may come from different

sites searches in different digital libraries

Humans combine these information easily even if different terminologies are used the information is incomplete, or buried in images,

videos, … But Machines?

7 Of 73

Impossible using the Syntactic Web…

Complex queries involving background knowledge Find information about “animals that use sonar but are

not either bats or dolphins” Locating information in data repositories

Travel enquiries Prices of goods and services Results of human genome experiments

Finding and using “web services” Delegating complex tasks to web “agents”

Book me a holiday next weekend somewhere warm, not too far away, and where they speak French or English

8 Of 73

What is the Problem?

9 Of 73

Challenge

Query What is the name of a person who is a member of an

organization in Iran, and likes a kind of sport?

10 Of 73

Why Semantic Web?

(Some) data should be available for machines for further processing Metadata: Data about data

Data should be possibly combined, merged on a Web scale

Machines may also need to reason about that data

11 Of 73

What is Semantic Web?

Tim Berners-Lee:

“The Semantic Web is an extension of the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation.” 2001

12 Of 73

Semantic Web “The Semantic Web will bring structure

to the meaningful content of Web pages, creating an environment where software agents roaming from page to page can readily carry out sophisticated tasks for users” 2001

13 Of 73

Current Web

14 Of 73

Current Web

Resources identified by URI's untyped

Links href, src, ... limited, non-descriptive

User Exciting world - semantics of the resource, however, gleaned from content

Machine: Very little information available - significance of the links only evident from

the context around the anchor.

15 Of 73

Semantic Web

16 Of 73

Semantic Web

Resources Globally Identified by URI's Extensible Relational

Links Identified by URI's Extensible Relational

User Even more exciting world, richer user experience

Machine More processable information is available (Data Web)

Computers and people Work, learn and exchange knowledge effectively

17 Of 73

Semantic Web Technologies

The Semantic Web extends the Web through the use of standards, markup languages and related processing tools

18 Of 73

Semantic Web Architecture

19 Of 73

A Simple Web Page

Markup consists of: rendering information (e.g.,

font size and colour) Hyper-links to related

content

Semantic content is accessible to humans but not (easily) to computers…

20 Of 73

Challenge

Query What is the name of a person who is a member of an

organization in Iran, and likes a kind of sport?

21 Of 73

What information can we see…

Hi!

My name is Ali!

This is my homepage. I am a student at Ferdowsi University of Mashhad.

I like football.

22 Of 73

The Page Source Code in HTML

<html> <head> <title>Ali's Homepage </title></head><body> <p><b>Hi!</b></p> <p><b>My name is Ali!</b></p> </b> <p>This is my homepage. I am a student at <a href=

“http://um.ac.ir">Ferdowsi University of Mashhad</a>.</p> <p>I like football.</p>

</body></html>

23 Of 73

What information can a machine see…

<html> <head> <title>…………………..</title></head><body> <p><b>………</b></p> <p><b>....................</b></p> </b> <p>…………………………………………..……<a

href=“………………”>…………………..</a>.</p> <p>............................</p>

</body></html>

XML

25 Of 73

XML

eXtensible Markup Language XML allows users to add arbitrary structure to their

documents but says nothing about what the structures mean

26 Of 73

Solution: XML “meaningful” tags

………………………….

<student>………………….</student><university>……………………..<university>

…………………………………………………………………………………………………….

27 Of 73 27

HTML vs. XML

HTML is for humans HTML describes web pages Browsers ignore and/or correct as many HTML errors as they can,

so HTML is often sloppy XML is for computers

XML describes data The rules are strict and errors are not allowed

In this way, XML is like a programming language Current versions of most browsers can display XML

However, browser support of XML is spotty at best

28 Of 73 28

XML Building blocks The XML declaration looks like this:

<?xml version="1.0" encoding="UTF-8“ ?>

Identify the nature of the content they surround General format:

<element attribute=“value” > … </element>

Empty element: <empty-Element attribute=“value” />

XML Elements have Relationships Elements are related as parents and children <name>

<first>David</first> <last>Matuszek</last>

</name>

29 Of 73 29

XML Applications

XML is used to Exchange Data Reduce the complexity of interpreting data

XML can be used to Store Data Accessible to more applications

XML can be used to Create new Languages, e.g. : WML (Wireless Markup Language), MusicXML

30 Of 73 30

XML Validation

"Well Formed" XML document correct XML syntax

"Valid" XML document “well formed” Conforms to the rules of a DTD

XML DTD defines the legal building blocks of an XML document Can be inline in XML or as an external reference

XML Schema an XML based alternative to DTD, more powerful Support namespace and data types

31 Of 73 31

An Example XML with DTD

<?xml version="1.0"?><!DOCTYPE note [

<!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)>

]> <note>

<to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend</body>

</note>

32 Of 73 32

XML Schemas

“Schema” is a general term DTDs are a form of XML schemas

When we say “XML Schemas,” we usually mean the W3C XML Schema Language This is also known as “XML Schema Definition”

language, or XSD.

33 Of 73

But What if?

………………………….

<boy>………………….</boy><college>……………………..<college>…………

………………………………………………………………………………………….

RDF

35 Of 73

RDF

Resource Description Framework A data model

o Meaning encoded in sets of ‘triples’: entities have properties which have values

o Each triple: subject-predicate-object

o Entities, properties and values all have distinct URIs

36 Of 73

RDF Model

A model is a collection of statements Statement := (predicate,subject,object) Predicate is a resource Subject is a resource Object is either a resource or a literal

Subject Object

Predicate

Statement

37 Of 73

RDF

AliFerdowsi

University of Mashhad

studentOF

http://um.ac.ir

hasHomePage

38 Of 73

RDF

<rdf:Description about="some.uri/person/ali"><studentOf resource="some.uri/Ferdowsi_University_of_Mashhad"/>

</Description>

<Description about="Ferdowsi_University_of_Mashhad"> <hasHomePage>http://um.ac.ir</hasHomePage></rdf:Description>

39 Of 73

Example

We are looking for a woman who works for one of my client and her son studies at University of Rovaniemi

40 Of 73 40

XML vs. RDF RDF is not just an XML dialect.

XML: Has a tree structure data model. Only nodes are labeled.

RDF: Has a graph structure data model. Both edges (properties) and nodes (subjects/objects) are

labeled.

41 Of 73

Challenge

Query What is the name of a person who is a member of an

organization in Iran, and likes a kind of sport?

42 Of 73

But…

What is the relation between a Student and a Person? Football and Sport? University and College? University and Website?

Ontology is the solution

Ontology

44 Of 73

Ontology

To answer the query it is required to tell the machine that There is a class of objects named ‘Student’ There is a class of objects named ‘Person’ Each Student is a Person Each Person has a Name There is a class of objects named ‘Sport Type’ Football is a kind of Sport There is an instance of a Student that its Name is “Ali” ….

45 Of 73

Ontology

Philosophy The study of what is, what has to be true for

something to exist, the kinds of things that can exist

AI and computer science Co-opted the term. Something exists if it can be

represented, described, defined (in a formal, hence, machine-interpretable way).

46 Of 73

Ontology Ontologies are about vocabularies and their meanings, with

explicit, expressive, and well-defined semantics, possibly machine-interpretable.

“Ontology is a formal specification of a conceptualization.” Gruber, 1993

Main elements of an ontology: Concepts Relationships

Hierarchical Logical

Properties Instances (individuals)

47 Of 73

Ontology

48 Of 73

Ontologies in the Semantic Web Provide shared data structures to exchange

information between agents Can be explicitly used as annotations in web sites Can be used for knowledge-based services using

other web resources

49 Of 73

Ontology

Ontology Languages RDFS (RDF Schema) OWL SHOE DAML+OIL

50 Of 73

RDF Schema (RDFS)

RDF gives a formalism for meta data annotation, and a way to write it down in XML, but it does not give any special meaning to vocabulary such as subClassOf

RDF Schema allows you to define vocabulary terms and the relations between those terms in special domain it gives “extra meaning” to particular RDF predicates and

resources

this “extra meaning”, or semantics, specifies how a term should be interpreted

51 Of 73

Core Classes & PropertiesCore Classes

Core Properties

rdfs:Resource

rdfs:Literal

rdfs:Statement

rdfs:Class

rdfs:Property

rdfs:Type

rdfs:SubClassOf

rdfs:SubPropertyOf

rdfs:Domain

rdfs:Range

rdfs:Label

rdfs:Comment

52 Of 73

RDF &RDFS (a sample)

زبانهای برنامه سازی وب

53 Of 73

RDFS Sample Code<rdf:RDF

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

xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

<rdfs:Class rdf:ID=“professor">

<rdfs:comment>

The class of professor All professors are academic staff members.

</rdfs:comment>

<rdfs:subClassOf rdf:resource="#academicStaffMember"/>

</rdfs:Class>

<rdfs:Class rdf:ID="academicStaffMember">

<rdfs:comment>

The class of academic staff members

</rdfs:comment>

<rdfs:subClassOf rdf:resource="#staffMember"/>

</rdfs:Class>

<rdfs:Class rdf:ID="staffMember">

<rdfs:comment>The class of staff members</rdfs:comment>

</rdfs:Class>

زبانهای برنامه سازی وب

54 Of 73

RDFS Sample Code …<rdfs:Class rdf:ID="course">

<rdfs:comment>The class of courses</rdfs:comment>

</rdfs:Class>

<rdf:Property rdf:ID="involves">

<rdfs:comment>

It relates only courses to lecturers.

</rdfs:comment>

<rdfs:domain rdf:resource="#course"/>

<rdfs:range rdf:resource="#academicStaffMember "/>

</rdf:Property>

<rdf:Property rdf:ID="isTaughtBy">

<rdfs:comment>

Inherits its domain ("course") and range ("lecturer")

from its superproperty "involves"

</rdfs:comment>

<rdfs:subPropertyOf rdf:resource="#involves"/>

</rdf:Property>

زبانهای برنامه سازی وب

55 Of 73

Problems with RDFS RDFS too weak to describe resources in sufficient detail

No localised range and domain constraints Can’t say that the range of hasChild is person when applied to

persons and elephant when applied to elephants No existence/cardinality constraints

Can’t say that all instances of person have a mother that is also a person, or that persons have exactly 2 parents

No transitive, inverse or symmetrical properties Can’t say that isPartOf is a transitive property, that hasPart is the

inverse of isPartOf or that touches is symmetrical …

Difficult to provide reasoning support No “native” reasoners for non-standard semantics May be possible to reason via FO axiomatisation

56 Of 73

OWL (Ontology Web Language) OWL is now a W3C Recommendation The purpose of OWL is identical to RDFS i.e. to provide an

XML vocabulary to define classes, properties and their relationships. RDFS enables us to express very rudimentary relationships

and has limited inferencing capability. OWL enables us to express much richer relationships, thus

yielding a much enhanced inferencing capability. The benefit of OWL is that it facilitates a much greater degree

of inference than you get with RDF Schema.

57 Of 73

Origins of OWL

RDFRDF

DAML+OILDAML+OIL

DARPA Agent Markup Language

A W3C Recommendation

OILOIL

OWLOWL

All influenced by RDF

Ontology Inference Layer

EU/NSF Joint Ad hoc Committee

DAMLDAML

OWL LiteOWL DL OWL Full

58 Of 73

OWL OWL and RDF Schema enable rich machine-processable semantics

XML/DTD/XML Schemas

RDF Schema

OWL

Semantics

Syntax

<rdfs:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/></rdfs:Class>

<owl:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/></owl:Class>

RDFS

OWL

59 Of 73

Full: Very expressive, no computation guarantees

DL (Description Logic): Maximum expressiveness, computationally complete

Lite: Simple classification hierarchy with simple constraints.

Versions of OWL

Depending on the intended usage, OWL provides three increasingly expressive sublanguages

OWL Full

OWL DL

OWL Lite

60 Of 73

OWL Ontologies What’s inside an OWL ontology

Classes + class-hierarchy Properties (Slots) / values Relations between classes

(inheritance, disjoints, equivalents) Restrictions on properties (type, cardinality) Characteristics of properties (transitive, equivalence,

symmetry …) Annotations Individuals

Reasoning tasks: classification,consistency checking

61 Of 73

owl:Class

Top-most class: owl:Thing

>owl:Class rdf:ID=“Person</">owl:Class rdf:ID=“Man<"

>rdfs:subClassOf rdf:resource="#Person </ "/>owl:Class<

62 Of 73

Properties

What is a Property? e.g., has_father, has_pet, service_number a collection of relationships between individuals (and

data) a way of describing a kind of relationship between

individuals an object in the world (OWL Full)

63 Of 73

OWL PropertiesObject

Properties

Ana has_father David

Is range a

literal / typed value ?

then ERROR

Data type

Properties

Ana age 25

XML Schema data types supported DB people happy

64 Of 73

Defining Properties

ObjectProperty DatatypeProperty rdfs:subPropertyOf rdfs:domain rdfs:range

<owl:ObjectProperty rdf:ID="madeFromGrape"> <rdfs:domain rdf:resource="#Wine"/> <rdfs:range rdf:resource="#WineGrape"/> </owl:ObjectProperty>

65 Of 73

Describing classes in OWLComplex Classes

Intersection of classes (owl:intersectionOf) OR (A B)

Union of classes (owl:unionOf) AND (A B)

Complement (owl:complementOf) NOT

Enumeration (owl:oneOf)

Disjoint Classes (owl:disjointWith)

66 Of 73

Describing classes in OWLRestrictions on Property Classes

Properties: allValuesFrom: rdfs:Class (lite/DL owl:Class) hasValue: specific Individual someValuesFrom: rdfs:Class (lite/DL owl:Class) minCardinality: xsd:nonNegativeInteger (in lite {0,1}) maxCardinality: xsd:nonNegativeInteger (in lite {0,1})

67 Of 73

Describing properties in OWLOWL vs. RDFS RDF Schema provides some of predefined properties:

rdfs:range used to indicate the range of values for a property. rdfs:domain used to associate a property with a class. rdfs:subPropertyOf used to specialize a property. …

OWL provides additional predefined properties: owl:cardinality (indicate cardinality) owl:hasValue (at least one of the specified property values) …

OWL provides additional property classes, which allow reasoning and inferencing: owl:FunctionalProperty owl:TransitiveProperty …

68 Of 73

OWL Cardinality

min Cardinality max Cardinality

“Cardinality” When min = max

has Value belongs to the class if it has the value

69 Of 73

An Example OWL ontology<owl:Class rdf:ID=“Person” /><owl:Class rdf:ID=“Man”>

<rdfs:subClassOf rdf:resource=“#Person” /><owl:disjointWith rdf:resource=“#Woman” />

</owl:Class><owl:Class rdf:ID=“Woman”>

<rdfs:subClassOf rdf:resource=“#Person” /><owl:disjointWith rdf:resource=“#Man” />

</owl:Class><owl:Class rdf:ID=“Father”>

<rdfs:subClassOf rdf:resource=“Man” /><owl:Restriction owl:minCardinality="1">

<owl:onProperty rdf:resource="#hasChild" /></owl:Restriction>

</owl:Class><owl:ObjectProperty rdf:ID=“hasChild">

<rdfs:domain rdf:resource="#Parent" /><rdfs:range rdf:resource="#Person" />

</owl:ObjectProperty>

70 Of 73

Semantic Web: Now

Numerous web technologies, languages, formats, and standards which provide the inferastructure URI, XML, XML Schema, RDF, RDFS, OWL,

SPARQL, SerQL, HTTP, Microformats, RDFa,

71 Of 73

Semantic Web: Now

A large body of research and activity is related to ontologies, since they play a main role Ontology engineering issues and tools

ontology development, ontology selection, ontology matching, ontology evaluation, ontology partitioning,….

Numerous Ontologies are developed in different domains, e.g. FOAF, DOAP, SIOC, SKOS, …

72 Of 73

Semantic Web: Now

Semantic Web technologies are used as an enabler in different areas to develop small semantic web applications Ontology-based ….. Ontology-enabled … Semantic-Web-Enabled … Semantic ….

73 Of 73

Semantic Web: Now

Semantic Web Search Engines Swoogle, SWSE, Watson, Falcons, Yahoo!

Microsearch, ….

top related