Combining Existential Rules with the Power of CP-Theories

1
Combining Existential Rules with the Power of CP-Theories Tommaso Di Noia * Thomas Lukasiewicz ** Maria Vanina Martinez *** Gerardo I. Simari *** Oana Tifrea-Marciuska ** Answering Queries for the Web 3.0: Personalized Access Semantic Data Precise and rich results with Datalog+/– conjunctive queries (CQs) Social Data Answers ordered by ontological CP-theories (OCP-theories) Expressive preferences Order the answers by preferences Answers Ontology O hotel id city conn class t 1 h 1 rome c e t 2 h 2 rome w l t 3 h 3 rome c e review id user feedback t 7 h 1 b n t 8 h 2 b p t 9 h 3 j p reviewer user age t 10 b 20 t 11 j 30 friend user user t 12 b a t 13 j a Rules = {review(I,U,F ) →∃C,T,S hotel(I,C,T,S ), review(I,U,F ) →∃A reviewer(U, A), reviewer(U, A) →∃F friend(U, F ), friend(A, B ) friend(B,A), friend(A, A) → ⊥}. CQ q (H, U, C, R)= Y hotel(H, rome, C, Y ) review(H, U, R) Some answers: a 1 = h 1 , b, c, n, a 2 = h 2 , b, w,p a 3 = h 3 , j, c,p. ans(q, Γ , O , o 1 )= a 1 , ans(q, Γ , O , o 2 )= a 2 , ans(q, Γ , O , o 3 )= a 3 Preferences Γ Preferences of the form υ : ξ ξ [ W ] - independent of W, given υ Γ = { : hotel(I,C, w,S ) hotel(I , C, c,S )[ {F, R}], : review(I,U,p) review(I , U, n)[ {C, R}], hotel(I,C, c,S ) review(I,U, n): reviewer(j, A) reviewer(b,A )[ ]} With the set of variables X = {C, RF} the domains Dom(C)= {hotel(t 1 ), hotel(t 2 ), hotel(t 3 )}, Dom(R)= {reviewer(t 10 ), reviewer(t 11 )}, Dom(F)= {review(t 7 ), review(t 8 ), review(t 9 )} An outcome o associates with every variable a value from its domain. o 1 = hotel(t 1 ) reviewer(t 11 ) review(t 7 ) , o 2 = hotel(t 2 ) reviewer(t 10 ) review(t 8 ) , o 3 = hotel(t 3 ) reviewer(t 10 ) review(t 9 ) with o 2 o 1 ,o 2 o 3 Consistency of (O , Γ ) o is consistent if O ∪{o(X ) | X X}| = o o if O ∪{o(X ) | X X}≡ O ∪{o (X ) | X X} (o,o are outcomes) Let π be a total order over the outcomes of (O , Γ ). π | = O if (i) o and o are consistent, for all (o, o ) π (ii) (o, o ) π for any o o π | = ϕ (with ϕ Γ ) if π strict ϕ , π | = Γ if π | = ϕ for all ϕ Γ π | =(O , Γ ) if π | = O and π | = Γ . An OCP-theory (O , Γ ) is consistent if there exists a π s.t. π | =(O , Γ ). Skyline and k-Rank Answers A skyline answer for a CQ q to a consistent (O , Γ ) is any a ans(q, Γ , O , o) for some consistent outcome o s.t. there does not exist consistent outcome o with (i) o o and (ii) ans(q, Γ , O , o ) = A k -rank answer for a CQ q to consistent (O , Γ ) outside a set of atoms S is a se- quence a 1 ,..., a k s.t. either: (a) a 1 ,..., a k are k different existing skyline answers for q , a r / S (r k ), or (b1) a 1 ,..., a i are all i different skyline answers for q , a r / S (r i), and (b.2) a i+1 ,..., a k is a (k -i)-rank answer for q to (O , Γ \{o}) outside S ∪{a 1 ,..., a i }, where o is an undominated outcome relative to . A k -rank answer for q to (O , Γ ) is a k -rank answer for q to (O , Γ ) outside . a 2 is a skyline answer, while {a 2 ,a 1 } or {a 2 ,a 3 } are top-2 answers Complexity of Consistency, Dominance, and CQs Skyline Memb. Language Data Comb. Bounded Arity-Comb. Fixed Σ -Comb. L, LF, AF in p pspace pspace pspace G in p 2exp exp pspace WG exp 2exp exp exp S, F, GF, SF in p exp pspace pspace WS, WA in p 2exp 2exp pspace Languages L: linear, F: full, A: acyclic, G: guarded, W: weakly, S: sticky Main contributions Introduced OCP-theory’s syntax and semantics Defined consistency for OCP-theories Defined skyline and k -rank answers for CQs Provided an algorithm for computing k-rank an- swers to CQ over a OCP-theory Analyzed the computational complexity and pro- vided several tractability results * Politecnico di Bari, Italy ** University of Oxford, UK *** Univ. Nacional del Sur and CONICET, Argentina IJCAI 2015, Buenos Aires, Argentina

Transcript of Combining Existential Rules with the Power of CP-Theories

Page 1: Combining Existential Rules with the Power of CP-Theories

Combining Existential Rules with thePower of CP-Theories

Tommaso Di Noia∗ Thomas Lukasiewicz∗∗ Maria Vanina Martinez∗∗∗

Gerardo I. Simari∗∗∗ Oana Tifrea-Marciuska∗∗

Answering Queries for the Web 3.0: Personalized AccessSemantic Data

Precise and rich results with Datalog+/– conjunctive queries (CQs)

Social Data

Answers ordered by ontological CP-theories (OCP-theories)

Expressive preferences

Order the answers by preferences

Answers

Ontology O

hotelid city conn class

t1 h1 rome c et2 h2 rome w lt3 h3 rome c e

reviewid user feedback

t7 h1 b nt8 h2 b p

t9 h3 j p

revieweruser age

t10 b 20t11 j 30

frienduser user

t12 b a

t13 j a

Rules = {review(I, U, F )→ ∃C, T, S hotel(I, C, T, S),review(I, U, F )→ ∃A reviewer(U,A),reviewer(U,A)→ ∃F friend(U, F ),friend(A,B)→ friend(B,A), friend(A,A)→ ⊥}.

CQ q(H,U,C, R) = ∃Y hotel(H, rome,C, Y ) ∧ review(H,U,R)Some answers: a1 = 〈h1, b, c, n〉, a2 = 〈h2, b,w, p〉 a3 = 〈h3, j, c, p〉.ans(q, Γ ,O, o1) = a1, ans(q, Γ ,O, o2) = a2, ans(q, Γ ,O, o3) = a3

Preferences ΓPreferences of the form υ : ξ � ξ′ [W ] - independent of W, given υΓ = {> : hotel(I, C,w, S) � hotel(I ′, C, c, S ′)[{F,R}],> : review(I, U, p) � review(I ′, U, n)[{C,R}],hotel(I, C, c, S) review(I, U, n) : reviewer(j, A)� reviewer(b, A′)[∅]}With the set of variables X = {C, R F} the domainsDom(C) = {hotel(t1), hotel(t2), hotel(t3)},Dom(R) = {reviewer(t10), reviewer(t11)},Dom(F) = {review(t7), review(t8), review(t9)}An outcome o associates with every variable a value from its domain.o1 = hotel(t1) reviewer(t11) review(t7) ,o2 = hotel(t2) reviewer(t10) review(t8) ,o3 = hotel(t3) reviewer(t10) review(t9) with o2 � o1, o2 � o3

Consistency of (O,Γ )

• o is consistent if O ∪ {o(X) | X ∈ X} 6 |= ⊥• o ∼ o′ if O∪{o(X) | X ∈ X} ≡ O∪{o′(X) |X ∈ X} (o,o′ are outcomes)Let π be a total order over the outcomes of (O,Γ ).π |= O if(i) o and o′ are consistent, for all (o, o′) ∈ π(ii) (o, o′) ∈ π for any o ∼ o′

π |= ϕ (with ϕ ∈ Γ ) if πstrict ⊇ ϕ?,π |= Γ if π |= ϕ for all ϕ ∈ Γπ |= (O,Γ ) if π |= O and π |= Γ .

An OCP-theory (O,Γ ) is consistent if there existsa π s.t. π |= (O,Γ ).

Skyline and k-Rank Answers

A skyline answer for a CQ q to a consistent (O,Γ ) is any a ∈ ans(q, Γ ,O, o) forsome consistent outcome o s.t. there does not exist consistent outcome o′ with

(i) o′ � o and(ii)ans(q, Γ ,O, o′) 6= ∅

A k-rank answer for a CQ q to consistent (O,Γ ) outside a set of atoms S is a se-quence 〈a1, . . . , ak〉 s.t. either:(a) a1, . . . , ak are k different existing skyline answers for q, ar /∈ S (∀r ≤ k), or

(b1) a1, . . . , ai are all i different skyline answers for q, ar /∈ S (∀r ≤ i), and(b.2) 〈ai+1, . . . , ak〉 is a (k−i)-rank answer for q to (O,Γ\{o}) outside

S ∪ {a1, . . . , ai}, where o is an undominated outcome relative to �.A k-rank answer for q to (O,Γ ) is a k-rank answer for q to (O,Γ ) outside ∅.a2 is a skyline answer, while {a2, a1} or {a2, a3} are top-2 answers

Complexity of Consistency, Dominance, and CQs Skyline Memb.

Language Data Comb. Bounded Arity-Comb. Fixed Σ-Comb.L, LF, AF in p pspace pspace pspace

G in p 2exp exp pspaceWG exp 2exp exp exp

S, F, GF, SF in p exp pspace pspaceWS, WA in p 2exp 2exp pspace

Languages L: linear, F: full, A: acyclic, G: guarded, W: weakly, S: sticky

Main contributions• Introduced OCP-theory’s syntax and semantics• Defined consistency for OCP-theories• Defined skyline and k-rank answers for CQs• Provided an algorithm for computing k-rank an-swers to CQ over a OCP-theory• Analyzed the computational complexity and pro-vided several tractability results

∗ Politecnico di Bari, Italy ∗∗ University of Oxford, UK ∗∗∗ Univ. Nacional del Sur and CONICET, Argentina

IJCAI 2015, Buenos Aires, Argentina