adding semantic to web data and servicesbeaune/websem/cours2008_2009/alainleger/sup… · csawsdl,...

25
D1 - 15/01/2009 Adding Semantic to Web Data and Services Part 5 – Rules - Query Doctoral School, St Etienne January 2009 Alain Léger FT R&D Orange Labs Research DR Knowledge Processing (KRR) Manager Industry Area IST NoEs OntoWeb et Knowledgeweb (2000 -2007) Associated DR CNRS Lyon I - LIRIS D2 - 15/01/2009 Plan Cours 1 (5 janv 09 13:30 – 17:15 / 6 janv 09 8:00 – 11:45 ) Why adding semantics to the Web ? (1h30) CIntroduction CTake Away and References Foundations of Semantic Web (2h15) CIntroduction to Description Logics CStandards Inferences and Tableau From XML, RDF to OWL (2h45) CXML, RDF, RDF-S COWL Applications and Roadmap (1h) CApplication Scenarios CVisions prospectives et verrous technologiques

Upload: others

Post on 10-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

D1 - 15/01/2009

Adding Semantic to Web Data and ServicesPart 5 – Rules - Query

Doctoral School, St Etienne January 2009

Alain Léger FT R&D Orange Labs ResearchDR Knowledge Processing (KRR)Manager Industry Area IST NoEs OntoWeb et Knowledgeweb (2000 -2007)Associated DR CNRS Lyon I - LIRIS

D2 - 15/01/2009

Plan Cours 1 (5 janv 09 13:30 – 17:15 / 6 janv 09 8:00 – 11:45)

• Why adding semantics to the Web ? (1h30)

CIntroduction

CTake Away and References

• Foundations of Semantic Web (2h15)

CIntroduction to Description Logics

CStandards Inferences and Tableau

• From XML, RDF to OWL (2h45)

CXML, RDF, RDF-S

COWL

• Applications and Roadmap (1h)

CApplication Scenarios

CVisions prospectives et verrous technologiques

Page 2: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

D3 - 15/01/2009

Plan Cours 2 (12 janv 09 13:30 – 17:15 / 13 janv 09 8:15 – 12:00 / 14 janv 09 8:15 – 12:00 )

• From Rules to Queries (2h15)

CRules Languages

CSparQL

• Process Distribution (1h30)

CFrom structural to services computing

• Semantic WS discovery (2h30)

CResources discovery

CIllustration (BCov)

• Semantic WS composition (1h30) ** Introduction pour cours 3 **

CAutomata for Web services composition

CPlanning for Web services

CIllustrations : DERI et FT-Orange Labs

• Technologies, Plateforms, Applications (2h45 mn)

CStandards for SWS : OWL-S, SA WSDL, BPEL

CPlatforms WSML-MX, OWL-S MX, SA-WSDL, SWSF

CApplications Sem Web (AceMedia, Mkbeem)

D4 - 15/01/2009

Plan Cours 3 (19 janv 09 / 20 janv 09 / 21 janv 09 )

• SWS Standards TD (4h)

CSAWSDL, OWLS, WSMO

• Functional based Semantic Web Service CompositionCDefinitionsCApproaches (Our two approaches vs. State of the Art)COptimizationCIndustrial Scenarios

• WSMO service Parsing and Reasoning TP(4H)

• Techniques de base de la construction d'application par composition de services type mashup via mashup tools TP(4H)

CPiggy bank CTabulator CYahoo Pipes CMicrosoft PopflyCQEDWikiCGoogle Mashup via IGoogle

CNetvibes

Page 3: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-5 - 15/01/2009

Rules

Content based on Boris Motik Keynote at RR'2008, Karlsruhe,

and Rules systems tutorial N. Henze and D. Krause, REASE Knowledgeweb, 2006

A Semantic Web Primer, G. Antoniou and F. Van Harmelen, 2004

p-6 - 15/01/2009

Motivations

• Rules for modeling applications' processes

• Rules for modeling applications' constraints

• Rules for the missing part of DL-OWL !!

• Examples for rulesCBusiness Rules (NoE Rewerse)CQueries

Page 4: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-7 - 15/01/2009

Description Logics and OWL

• OWL (Web Ontology Langage)Clanguage for ontology modeling in the Semantic WebCstandard of the W3C (http://www.w3.org/2004/OWL/)

• OWL is based on Description Logics (DLs)Cinspired by semantic networksCDLs have a precise semantics based on first-order logicsCwell-understood computational properties

• What can we say in DLs?

UK cities are in UK regions.UK cities are in UK regions. UKCity v ∃ isIn.UKRgnUKCity v ∃ isIn.UKRgn ∀ x : UKCity(x) → ∃ y : isIn(x,y) u UKRgn(y)∀ x : UKCity(x) → ∃ y : isIn(x,y) u UKRgn(y)

UK regions are EU regions.UK regions are EU regions. UKRgn v EURgnUKRgn v EURgn ∀ x : UKRgn(x) → EURgn(x)∀ x : UKRgn(x) → EURgn(x)

Things in EU are parts of EU.Things in EU are parts of EU. ∃ isIn.EURgn v EUPart∃ isIn.EURgn v EUPart ∀ x : [∃ y : isIn(x,y) u EURgn(y)] → EUPart(x)∀ x : [∃ y : isIn(x,y) u EURgn(y)] → EUPart(x)

UK cities are parts of EU.UK cities are parts of EU. UKCity v EUPartUKCity v EUPart ∀ x : UKCity(x) → EUPart(x)∀ x : UKCity(x) → EUPart(x)

We can conclude:

p-8 - 15/01/2009

• Relational expressivityCOWL can express only tree-like axioms

• Polyadic predicates in OWL ?Ce.g., Flight (From, To, Airline)

• Can be addressed by rules (LP or ASP)

Missing Features (1)

∃ S.(∃ R.C u ∃ R.D) v Q ⇔

∀ x:{[∃ y: S(x,y) u (∃ x: R(y,x) u C(x)) u (∃ x: R(y,x) u D(x))] → Q(x)} ⇔

∀ x,x1,x2,x3:{ S(x,x1) u R(x1,x2) u C(x2) u R(x1,x3) u D(x3) → Q(x) }

x

x1S

x2 x3

R R

Page 5: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-9 - 15/01/2009

Missing Features (2) – Closed Worlds

Flight (MAN,STR)Flight (MAN,LHR)Flight (MAN,FRA)Flight (FRA,ZAG)

Question: is there a flight from MAN to MUC?

Open worlds (=OWL):Don’t know!

We did not specify thatwe know information about

all possible flights.

Closed worlds (=LP):No.

If we cannot prove something,it must be false.

• Partial solution: close off flight∀ x,y: flight(x,y) ↔ (x ≈ MAN u y ≈ STR) t (x ≈ MAN u y ≈ LHR) t …

cannot express many things (e.g., transitive closure)• Closed-world is orthogonal to closed-domain reasoning

∃ father.Person v Person Person (Peter) { Peter, Paul } v >

• CWA is available in various LP formalisms (e.g., ASP)

p-10 - 15/01/2009

Missing Features (3) – Constraints

• “Each person must have an SSN”Cnaïve attempt:

Person u ¬(∃ hasSSN.SSN) v ⊥

Cin FOL, this is equivalent to:Person v ∃ hasSSN.SSN

Cassume that only Person(Peter) is given• we expect the constraint to be violated (no SSN)• but KB is satisfiable: Peter has some unknown SSN

• FOL formulae…C…speak about the general properties of worldsC…cannot reason about their own knowledge

• Constraints can be expressed in LP

Page 6: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-11 - 15/01/2009

• “The heart is usually on the left, but in some cases it is on the right”

• Naïve approach:CHuman v HeartOnLeftDextrocardiac v HumanDextrocardiac v ¬HeartOnLeft

⇒ the class Dextrocardiac is unsatisfiable

C“with no contrary evidence, the heart is on the left”

• Exceptions…C…cannot be expressed in FOL

C…can be expressed in ASP

Missing Features (4)

p-12 - 15/01/2009

The Magic Formula

DLs (= taxonomical reasoning)+

LP Rules (= relational expressivity + nonmonotonic inferences)

=The Winning Combination!

Page 7: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-13 - 15/01/2009

Open vs. Closed Worlds

• In DLs we derive Person(a)

• The formula is equivalent to∀ x : [Father(x) → Person(x)]

Celiminates all models in which x

is a father and not a person

• In LP, ¬ is interpreted as

default negationCread as “is not provable”

• The example is unsatisfiable

• Negation defined using

minimal knowledge

• “It is illegal to state that someone is a father without stating

that he is a person”

∀ x : [Father(x) u ¬Person(x) → ⊥]

Father(a)

p-14 - 15/01/2009

Idea of Minimal Knowledge

• DLs • LP

Father(a)

M1Father(a)

M2Father(a), Person(a)

MFather(a)

∀ x : [Father(x) u ¬Person(x) → ⊥]

• kills all models in which the formula does not hold

All models are of equal “quality”.

This is the only minimal model.

(There is no model M’⊂ M.)

• We are left with models that

contain Person(a)

• We are left with no model

Page 8: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-15 - 15/01/2009

Minimal Knowledge and Negation

• DLs • Rules

Father(a)

∀ x : [Father(x) u ¬Person(x) → Cat(x)]

• ensures Cat(x) in each model where x is a father and not a person

• Does not entail Cat(a) • Does entail Cat(a)

, Cat(a)M1

Father(a)

M2Father(a), Person(a)

MFather(a) , Cat(a)

Nonmonotonic semantics typically prefer certain models.

p-16 - 15/01/2009

First-Order Rule Formalisms

• First-order combinations of DLs and rules:CSWRL, CARIN, AL-log, DL-safe rules

• A1 u … u An ← B1 u … u Bm

Cconcepts (classes) = unary predicatesCroles (properties) = binary predicatesCinterpreted as first-order clauses

• Semantics is standard first-orderCWoman(x) → Person(x) and ¬Person(Lassie) imply ¬Woman(Lassie)

• Easily undecidableCdecidability achieved by syntactic restrictions; e.g., DL-safety

• Issues addressed:relational expressivity and polyadic predicatesnonmonotonic features

* DL+Rule Language used in the applications Picsel, Mkbeem will be presented at the end of the course

Page 9: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-17 - 15/01/2009

Rule Definitions (1)

• A rule has the formA ← B1 u … u Bn

CWhere A, Bi are atomic formulas

CA is the head – consequent of the ruleCB1 u … Bn are the body – premises - antecedent

• ExempleDiscount (X) ← localCustomer (X) u age (X) > 60

Cvariables : placeholders for values, e.g. X

CConstants denote fixed value, e.g. 60

CPredicates relate objects, e.g. loyalCustomer

CFunction symbols return a value, e.g. age

p-18 - 15/01/2009

Rule Definitions (2)

• All variables occuring in a rule are universally quantified. A

rule can be interpreted as a formula :

∀X1 … ∀Xk(B1 u … u Bn))→A)

• or equivalent

∀X1 … ∀Xk(A - ¬B1 - … - ¬Bn)

CRemark : A Horn clause is a disjunction of literals of which at most one is positive

Page 10: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-19 - 15/01/2009

Exercices

• Express these two statements in Rules and in DLCA home student lives and studies in the same cityCA person is either female or male

• ?

p-20 - 15/01/2009

Facts, LP and Goal Definitions

• A fact is an atomic formula

• Example

CloyalCustomer (a36547) says that the customer with ID a36547 is loyal

• A logic program (LP) is a finite set of facts and rules

• A goal denotes a query Q asked to a LP. It has the formCB1 . … . Bn →

• For n=0 we have the empty goal

CEquivalent formulations• ∀X1 … ∀Xk(¬B1 - … - ¬Bn) where X1 … Xk are all var. occurring in B1 … Bn

• ¬ ≥X1 … Xk(B1 . … . Bn)

CTo proof a goal : proof by contradiction – We proof that a goal can be answered

positively by negating the goal and proving that we get a contradiction using LP

Page 11: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-21 - 15/01/2009

Monotonic Rule System

• Intuition : If a conclusion can be drawn, it remains valid

even if new knowledge becomes available

• Formalised :CLet P be a LP and B1 . … . Bn → is a query with var. X1 … Xk .

Then, the answer is yes iff

CPl(P) ≥X1 … Xk(B1 . … . Bn)

or equivalently

CPl(P) ∪ {¬ ≥X1 … Xk(B1 . … . Bn)} is unsatisfiable

p-22 - 15/01/2009

Monotonic Rule Exemple (1)

• Facts:

Mother(X,Y) X is mother of YFather(X,Y) X is father of Y

Male(X) X is maleFemale(X) X is female

• Rules fo deriving further relationships :

Mother(X,Y) → Parent(X,Y)Father(X,Y) → Parent(X,Y)

Page 12: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-23 - 15/01/2009

Monotonic Rule Exemple (2)

• A brother is a male person sharing a parentmale(X) . parents(P,X) . parent (P,Y) . notSame(X,Y) → brother(X,Y)

• An uncle is a brother of a parentBrother(X) . parent(P,Y) → uncle(X,Y)

• A grandmother is he mother of a parentmother(X,P) . parent(P,Y) → grandmother(X,Y)

• An ancestor is either a parent or an encestor of a parent :Parent(X,Y) → ancestor(X,Y)

Ancestor(X,P) . parent(P,Y) → ancestor(X,Y)

p-24 - 15/01/2009

Grounding (2)

• So far we have focused on yes/no questions• Suppose a fact p(a) and the query p(X) →

CThe answer yes is correct but not satisfactory

• More appropriate is the substitution x/a which gives an

instantiation for X

• a is called a ground witness

Page 13: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-25 - 15/01/2009

Non-monotonic Rule Systems (2)

p-26 - 15/01/2009

Non-monotonic Rule Systems Defeasible rules

Page 14: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-27 - 15/01/2009

Non-monotonic Rule Systems Defeasible rules

p-28 - 15/01/2009

Non-monotonic Rule Systems Example

Buyer’s requirements:

• Carlos is looking for an apartment of at least 45 m2 with at least two bedrooms. If it

is no the third floor or higher, the house must have an elevator. Also, pets must be

allowed.

• Carlos is willing to pay $300 for a centrally located 45 m2 apartment, and $250 for a

similar flat in the suburbs. In addition, he is willing to pay an extra $5 per square

meter for a larger apartment, and $2 per square meter for a garden.

• He is unable to pay more than $400 in total. If given the choice, he would go for the

cheapest option. His second priority is the presence of a garden; his lowest priority is

additional space.

Page 15: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-29 - 15/01/2009

Non-monotonic Rule Systems Example

Formalization:

size(X,Y ) Y is the size of apartment X (in sq m)

bedrooms(X,Y ) X has Y bedrooms

price(X,Y ) X has the price Y

floor (X,Y ) X is on the Yth floor

gardenSize(X,Y ) X has a garden of size Y

lift(X) X has a lift

pets(X) pets are allowed in X

central(X) X is centrally located

We use the following predicates:

acceptable(X) flat X satisfies Carlos’ requirements

offer (X,Y ) for X, Carlos is willing to pay Y $

p-30 - 15/01/2009

Non-monotonic Rule Systems Example (1)

• Firm requirements: Any requirement is a priori acceptabler1 : ⇒ acceptable(X)

• It is unacceptable if one of Carlos’ requirements is not met:r2 : bedrooms(X,Y ),Y < 2 ⇒ ¬accetable(X)

r3 : size(X,Y ),Y < 45 ⇒ ¬accetable(X)

r4 : ¬pets(X) ⇒ ¬accetable(X)

r5 : floor (X,Y ),Y > 2,¬lift(X) ⇒ ¬accetable(X)

r6 : price(X,Y ),Y > 400 ⇒ ¬accetable(X)

• Rules r2, . . . r6 are exceptions to rule r1:

r2 > r1, r3 > r1, r4 > r1, r5 > r1, r6 > r1.

Page 16: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-31 - 15/01/2009

Non-monotonic Rule Systems Example (2)

• Next we calculate the price Carlos is willing to pay:

r7 : size(X,Y ),Y >= 45, garden(X, z), central(X)

⇒ offer (X, 300 + 2z + 5(Y − 45))

r8 : size(X,Y ),Y >= 45, garden(X, z),¬central(X)⇒ offer (X, 250 + 2z + 5(Y − 45))

And

r7 > r1, r8 > r1.

• An apartment is only acceptable if the amount Carlos is willing to pay

is not less than the price specified by the landlord

r9 : offer (X,Y ), price(X, z),Y < z ⇒ ¬accetable(X)

and r9 > r1.

p-32 - 15/01/2009

Non-monotonic Rule Systems Example (3)

Page 17: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-33 - 15/01/2009

Non-monotonic Rule Systems Example (4)

• a1 is not acceptable because it has one bedroom only (rule r2)

• a4 and a6 because no pets are allowed (rule r4)

• a2 is more than the $300 Carlos is willing to pay (rules r7, r9)

• a3, a5, a7 are acceptable (rule r1)

Carlos preferences are further based on price, garden size, and size,

in that order.r10 : cheapest(X) ⇒ rent(X)

r11 : cheapest(X), largestGarden(X) ⇒ rent(X)

r12 : cheapest(X), largestGarden(X), largest(X) ⇒ rent(X)

r12 > r10

r12 > r11

r11 > r10

p-34 - 15/01/2009

Non-monotonic Rule Systems Example (5)

Also, we need to specify that at most one apartment can be rented, using

conflict sets:

C(rent(X)) = {rent(X)} ∪ {rent(Y )|Y ≠ X}

• cheapest(a3)

• cheapest(a5)

• largest(a3)

• largest(a7)

• largestGarden(a5)

• r11 can be applied to a5

• r10 can be applied to a3, thus establishing an attack

• r11 is stronger than r10, attack is successfully countered

• no further attacks

• a5 is the apartment of choice!

Page 18: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-35 - 15/01/2009

XQL - SPARQL

Content based on Enrico Franconi Keynote at Knowledgeweb Review meeting, 2006

and SPARQL tutorial N. Henze and D. Krause, REASE Knowledgeweb, 2006

p-36 - 15/01/2009

Motivations

• We have XML query languages (XQuery2007). RDF is XML. Why don't

we use XML query languages to query RDF?

C RDF aware: query for triples

• Subject, Predicate, Object

C No knowledge about the storage structure required

C Ontology support

• Reasoning

• Support for class hierarchies

C Entailment

• RDF is a flexible and extensible way to represent information about

web resources.

• SPARQL is a standardised query language for RDF data, which offers

developers and end users a way to access and combine information

from across web resources.

http://www.w3.org/TR/xquery/ jan. 2007

Page 19: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-37 - 15/01/2009

Entailment

• Definition:

C The set A entails the set B iff, in every model in which all sentences in A are

true, all sentences in B are also true

C Notation : A B a set A entails a set B

• Entailment in RDF queries

C KB Q

C KB: RDF knowledge base

C Q: query

A query is true if it is entailed in the RDF source graph

p-38 - 15/01/2009

SPARQL (Recommendation)

SPARQL provides facilities to:

• Extract information from the queried graphs in the form of tuples of

URIs, blank nodes, and literals;

• Construct new RDF graphs based on information in the queried

graphs.

• As a query language, it is suitable for remote use by means of a

remote access protocol.

W3C REC 15 jan. 2008 http://www.w3.org/2001/sw/DataAccess/• Consists out of three specifications

C Query language specification• http://www.w3.org/TR/rdf-sparql-query/

C Data access protocol (using WSDL 2.0)

• http://www.w3.org/TR/rdf-sparql-protocolC Query results XML format

• http://www.w3.org/TR/rdf-sparql-XMLres

Page 20: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-39 - 15/01/2009

SPARQL Graph matching

• Given an RDF graph to query, the WG defined a query as an RDF graph

where some nodes are variables.

• An answer to the query is the assignment to the variables so that the

query graph matches the data graph.

• ...this, regardless the semantics that the RDF graph may carry.

Graph homomorphism• A graph homomorphism f from graph G to graph H is a map f from the vertices and edges of

G to vertices and edges of H that preserves the edge structure, i.e.,C there is an edge e from vertex u to vertex v in G if and only if there is an edge f(e) from f(u) to f(v) in H.

• We restrict f such that f(u)=u if u is a URI or literal (i.e., it is a matching), and f(u)=w for an arbitrary w in H if u is a bnode in G.

p-40 - 15/01/2009

SPARQL Example

• DATA:

:john :age “25”^^xsd:decimal .

• QUERY:

:john :age ?X .

• SPARQL ANSWER:

{?X/25}

Page 21: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-41 - 15/01/2009

SPARQL OWL Lite example

WORKER = EMPLOYEE :or MANAGER

WORKER(Andrea)

EMPLOYEE(Simon)

MANAGER(Caroline)

has-friend(Paul, Andrea)

has-friend(Paul, Simon)

has-friend(Simon, Andrea)

has-friend(Andrea, Caroline)

q :– has-friend(Paul, ?X), EMPLOYEE(?X),

has-friend(?X, ?Y), MANAGER(?Y).

Paul

AndreaWORKER

SimonEMPLOYEE

CarolineMANAGER

?X?Y

MANAGER

?X

?Y

EMPLOYEE

p-42 - 15/01/2009

SPARQL Semantics

• Given an entailment E , a query Q, an RDF graph G, then Q

E-matches graph G with answer S if:

C there is a Q' isomorphic (modulo bnodes) to Q, such that Q' does

not share any bnode with G

C G ∪ S(Q‘) is a well-formed RDF graph for

C G E (G ∪ S( Q‘ ))

the RDF terms in S all occur in G

Page 22: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-43 - 15/01/2009

SPARQL Simple Query

• All queries are made out of two main blocks :

C SELECT orders/structures the outpout

C WHERE generates the output

p-44 - 15/01/2009

SPARQL FILTER

• FILTER is used to apply value constraints

Page 23: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-45 - 15/01/2009

SPARQL Testing values

• Most functions and operators are taken from XQuery and XPATH

• SPARQL uses XSD Datatypes

p-46 - 15/01/2009

SPARQL Optional pattern matching

• OPTIONAL specifies optional parts of the RDF graph

Page 24: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-47 - 15/01/2009

Remerciements

• Une pensée toute particulière à tous ceux à qui j'ai emprunté, et ils

sont nombreux !

• Et à ceux qui m'ont emprunté … ☺

Merci !

Et Riccardo Rosati, Univ Roma

p-48 - 15/01/2009

Rule Interchange Format - RIF

Few slides from Michael Kifer, State University of New York at Stony Brook, 2006

Rule Reasoning 2008 (RR 2008) Karlsruhe, Nov 2008

Page 25: Adding Semantic to Web Data and Servicesbeaune/websem/cours2008_2009/AlainLeger/Sup… · CSAWSDL, OWLS, WSMO • Functional based Semantic Web Service Composition CDefinitions CApproaches

p-49 - 15/01/2009

Annexe

Recommandations

p-50 - 15/01/2009

Recommandations

• "Reasoning with Rules and Ontologies" Riccardo Rosati, Reasoning

Web 2006, LNCS 4126

• "Combining Rules and Ontologies: A survey" (Deliverable I3-D3 NoE

REWERSE http://rewerse.net/publications

• ESWC 2006 SPARQL Tutorial (Units 1-2-4)