Chasing Sets:
How to Use Existential Rules for Expressive Reasoning
David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Datalog for DL reasoning?
Can we use Datalog to solve hard problems?
• ExpTime-complete combined complexity
• Fast and scalable reasoners available
2
Datalog for DL reasoning?
Can we use Datalog to solve hard problems?
• ExpTime-complete combined complexity
• Fast and scalable reasoners available
DL Ontology
Datalog
rules Facts
TBox ABox
Rule Engine
✓Carral et al. (KR 2018): Horn-ALCHOIQ
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Datalog for DL reasoning?
Can we use Datalog to solve hard problems?
• ExpTime-complete combined complexity
• Fast and scalable reasoners available
2
DL Ontology
Datalog
rules Facts
TBox ABox
Rule Engine
✓Carral et al. (KR 2018): Horn-ALCHOIQ
➡ exponentially many rules
Datalog for DL reasoning?
Can we use Datalog to solve hard problems?
• ExpTime-complete combined complexity
• Fast and scalable reasoners available
DL Ontology
Datalog
rules Facts
TBox ABox
Rule Engine
✓Carral et al. (KR 2018): Horn-ALCHOIQ
➡ exponentially many rules
✓ Ahmetaj et al. (ICDT 2018): guarded existential rules
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Datalog for DL reasoning?
Can we use Datalog to solve hard problems?
• ExpTime-complete combined complexity
• Fast and scalable reasoners available
2
DL Ontology
Datalog
rules Facts
TBox ABox
Rule Engine
✓Carral et al. (KR 2018): Horn-ALCHOIQ
➡ exponentially many rules
✓ Ahmetaj et al. (ICDT 2018): guarded existential rules
➡ predicates with linearly large arities
Is there an efficient way to solve hard problems
with rule engines,
nonetheless?
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Our contribution
4
Our contribution
By moving from Datalog to existential rules we can
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
4
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
• using existing rule engines
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
• using existing rule engines
• with a fixed set of rules
4
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
• using existing rule engines
• with a fixed set of rules
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
• using existing rule engines
• with a fixed set of rules
‣ Available reasoners use the chase algorithm
4
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
• using existing rule engines
• with a fixed set of rules
‣ Available reasoners use the chase algorithm
‣ Chase algorithm may not terminate
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
• using existing rule engines
• with a fixed set of rules
‣ Available reasoners use the chase algorithm
‣ Chase algorithm may not terminate
‣ Sufficient conditions for chase termination
4
Our contribution
By moving from Datalog to existential rules we can
• solve hard (ExpTime-complete) real-world problems
• using existing rule engines
• with a fixed set of rules
‣ Available reasoners use the chase algorithm
‣ Chase algorithm may not terminate
‣ Sufficient conditions for chase termination
‣ characterise rule sets of PTime data complexity (like Datalog)
How can we get the
required expressivity?
Datalog(S)
Surface language for existential rules with terminating chase
• ExpTime-complete data complexity
• polynomial translation from Datalog(S) to existential rules
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Datalog(S)
Surface language for existential rules with terminating chase
• ExpTime-complete data complexity
• polynomial translation from Datalog(S) to existential rules
6
person(x) → likesAll(x, ∅) (1)
likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
Datalog(S)
Surface language for existential rules with terminating chase
• ExpTime-complete data complexity
• polynomial translation from Datalog(S) to existential rules
person(x) → likesAll(x, ∅) (1)
likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
likesAll(x, S ) → allLikeAll({x}, S ) (3)
allLikeAll(S, T ) ∧ likesAll(x, T ) → allLikeAll(S ∪ {x}, T ) (4)
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Datalog(S)
Surface language for existential rules with terminating chase
• ExpTime-complete data complexity
• polynomial translation from Datalog(S) to existential rules
6
person(x) → likesAll(x, ∅) (1)
likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
likesAll(x, S ) → allLikeAll({x}, S ) (3)
allLikeAll(S, T ) ∧ likesAll(x, T ) → allLikeAll(S ∪ {x}, T ) (4)
allLikeAll(S, S ) ∧ alice ∈ S → cliqueOfAlice(S ) (5)
Datalog(S): Definition
Logic with two sorts: objects and sets of objects
• Each predicate position has a sort
• Object and set variables are distinct
• Set terms:
• Built-in predicates (only in body):
∅ {object} Set 1 ∪ Set 2
object ∈ Set Set 1 ⊆ Set 2
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Datalog(S): Definition
Logic with two sorts: objects and sets of objects
• Each predicate position has a sort
• Object and set variables are distinct
• Set terms:
• Built-in predicates (only in body):
7
All set variables must occur in a regular body atom (not built-in)
∅ {object} Set 1 ∪ Set 2
object ∈ Set Set 1 ⊆ Set 2
Datalog(S): Definition
Logic with two sorts: objects and sets of objects
• Each predicate position has a sort
• Object and set variables are distinct
• Set terms:
• Built-in predicates (only in body):
All set variables must occur in a regular body atom (not built-in)
Theorem: Datalog(S) has ExpTime-complete combined and data complexity.
∅ {object} Set 1 ∪ Set 2
object ∈ Set Set 1 ⊆ Set 2
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
person(x) → likesAll(x, ∅) (1)
likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve)
likes(Eve, a)
likes(Eve, b)
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve)
likes(Eve, a)
likes(Eve, b)
Eve
n
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve)
likes(Eve, a)
likes(Eve, b)
Eve
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
n ∅
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll
n
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
n ∅ n {a,b}
b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
n n {a,b}
b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve) likes(Eve, a) likes(Eve, b) Eve
n {a,a}
a
likesAll SU n {a}
a
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
n ∅ n {a,b}
b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve) likes(Eve, a) likes(Eve, b) Eve
n {a,a}
a
likesAll SU n {a}
a n {a,a,a}
a
n n {a,b}
b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′) likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
n ∅ n {a,b}
b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
∧ SU(V, y, V )
likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
n n {a,b}
b b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
∧ SU(V, y, V )
likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
a
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
n ∅ n {a,b,a}
n {a,b}
b b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
∧ SU(V, y, V )
likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
a
a
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
a
n n {a,b}
b b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
∧ SU(V, y, V )
likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ )
a
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 8
n ∅ n {a,b}
b b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
∧ SU(V, y, V )
likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ ) SU(U, x, V ) ∧ SU(U, y, U ) → SU(V, y, V ) (2′′ )
a
person(Eve) likes(Eve, a) likes(Eve, b) Eve
likesAll SU n {a}
a
n n {a,b}
b b
person(x) → likesAll(x, ∅) (1) likesAll(x, S ) ∧ likes(x, y) → likesAll(x, S ∪ {y}) (2)
→ ∃ V . empty(V ) (1′ )
person(x) ∧ empty(Y ) → likesAll(x, Y ) (1′′)
∧ SU(V, y, V )
likesAll(x, S ) ∧ likes(x, y) → ∃ V . likesAll(x, V ) ∧ SU(S, y, V ) (2′ ) SU(U, x, V ) ∧ SU(U, y, U ) → SU(V, y, V ) (2′′ )
a
person(Eve) likes(Eve, a) likes(Eve, b)
a Eve
likesAll SU n {a}
a
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Datalog(S) to existential rules
Theorem: Any Datalog(S) rule set can be
• polynomially translated
• into a consequence-preserving set of existential rules
• with a terminating Datalog-first standard chase.
✓ Datalog-first is implemented by some rule engines
9
Datalog(S) for
DL Reasoning?
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
DL Reasoning using Datalog(S)
11
Rule Engine Datalog(S)
rules Reasoning
calculus
Existential rules
Facts DL Ontology
TBox ABox
Classification for Horn-SHIQ
(Kazakov,IJCAI 2009)
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Consequence-driven classification
13
H ⊑ ∃ R . K H ⊑ A
H ⊑ ∃ R . (K ⊓ B) : A ⊑ ∀ R . B ∈ 𝒪
Consequence-driven classification
H ⊑ ∃ R . K H ⊑ A
H ⊑ ∃ R . (K ⊓ B) : A ⊑ ∀ R . B ∈ 𝒪 Exists (H, r, K ) ∧ SubClass (H, a) ∧ ax ⊑∀ (a, r, b)
→ Exists (H, r, K ∪ {b})
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe 14
Classification Class Retrieval
1 100 10000
G O x- an at om y G O x- ta xo n Gaz etteer ChE BI mo l. f c. NCI Re ac to m e 1. 7M Re ac to m e 3. 1M Re ac to m e 4. 4M UO BM 1.9M UO BM 4M UO BM 5.9M
Evaluation
time(s)
• Consequence-based classification and class retrieval for Horn-ALC:
• Kazakov (IJCAI 2011)
• Fact entailment for guarded existential rules:
• Ahmetaj et al. (ICDT 2018)
What can we use Datalog(S) for?
IN PAPER
IN PAPER
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
• Consequence-based classification and class retrieval for Horn-ALC:
• Kazakov (IJCAI 2011)
• Fact entailment for guarded existential rules:
• Ahmetaj et al. (ICDT 2018)
What can we use Datalog(S) for?
15
• Combined-approach materialisation for Horn-ALCHOIQ:
• Carral et al. (KR 2018)
• Reasoning tasks for non-Horn DLs
• Simančík et al. (IJCAI 2011): ALCH
IN PAPER
IN PAPER
• Consequence-based classification and class retrieval for Horn-ALC:
• Kazakov (IJCAI 2011)
• Fact entailment for guarded existential rules:
• Ahmetaj et al. (ICDT 2018)
What can we use Datalog(S) for?
• Combined-approach materialisation for Horn-ALCHOIQ:
• Carral et al. (KR 2018)
• Reasoning tasks for non-Horn DLs
• Simančík et al. (IJCAI 2011): ALCH
• ?
IN PAPER
IN PAPER
Chasing Sets: How to Use Existential Rules for Expressing Reasoning David Carral, Irina Dragoste, Markus Krötzsch, Christian Lewe
Summary
We provide a practical new way of solving
• ExpTime-complete problems
• using current existential rule engines Next steps:
• Logical reasoning: solve new ExpTime-complete problems
• Rule engine development: optimise and benchmark
• Characterising chase termination: discover syntactic criteria
16