PRACTICAL USES OF EXISTENTIAL RULES IN KNOWLEDGE REPRESENTATION
Part 2: Solving Horn-ALCClassification with Existential Rules
David Carral,1Markus Kr ¨otzsch,1and Jacopo Urbani2 1. TU Dresden
2. VU University Amsterdam
Special thanks to Irina Dragoste,1Ceriel Jacobs,2and Maximilian Marx1 for their invaluable contributions to the software used in this tutorial
KR 2020, September 13, 2020
Outline
Goal
Show some example where eitherrulesorrelated ideaswere crucial to achieve the state of the art
• Horn-ALCreasoning
• PLP
• Data integration
• Stream reasoning
1 st Scenario: Horn- ALC reasoning
The Description Logic Horn- ALC : Syntax
Definition. A Horn-ALContology is a set of Horn-ALCaxioms:
Av ⊥ > vB AvB AuEvB ∃R.AvB Av ∀R.B Av ∃R.B In the above;A,B, andEare concept names; andRis a role name.
Remark. Note the axioms of the formAv ∀R.B, which are notEL, such as:
CheesePizzav ∀HasTopping.Cheese
The axiom states that “all toppings in a cheese pizza are cheese toppings”.
Even though Horn-ALCis not much more expressive thanEL, (Krötzsch, Rudolph, and Hitzler 2013) have showed that:
Theorem. Solving classification over Horn-ALCis ExpTime-complete.
A Consequence-Based Calculus to Solve Classification
RCA
AvA :A∈Concepts(O) R+∃ CvA
Cv ∃R.B :Av ∃R.B∈ O R∃A Cv ∃R.D D∈D
DvD R−∃ Cv ∃R.D DvA
CvB :∃R.AvB∈ O R1u CvA
CvB :> vB∈ O R⊥∃ Cv ∃R.D Dv ⊥ Cv ⊥ R1u CvA
CvB :AvB∈ O R∀
Cv ∃R.D CvA
Cv ∃R.(DuB) :Av ∀R.B∈ O R2u CvA CvE
CvB :AuEvB∈ O
Figure: Classification Calculus for Horn-ALC. WhereA,B, andEare concept names;R is a role name; andCandDare conjunctions of concept names
Remark. The above procedure is based on the work of (Kazakov 2009).
Consequence-Based Calculus: Complexity
Theorem. The Horn-ALCclassification calculus runs in exponential time in the size of the input ontologyO.
Remark. Note that this calculus produces inferences of the form
(1) CvB and (2) Cv ∃R.D
whereBis a concept name,Ris a role name, andCandDare conjunctions of concept names. Therefore, on inputO, the calculus may produce at most
2|Concepts(O)|× |Concepts(O)| and 2×2|Concepts(O)|× |Roles(O)|
inferences of type (1) and (2), respectively.
Remark. Since classification over Horn-ALCis an ExpTime-complete problem, the calculus is worst-case optimal.
Implementing the Classification Calculus: Datalog
Because of the following result, we can not implement the Horn-ALCclassification calculus using a fixed Datalog rule set:
Theorem. The data complexity of fact entailment over Datalog is in P.
Assume that we can implement the Horn-ALCclassification calculus with a fixed Datalog rule set (as we did for theELclassification calculus). Then:
1. By the above theorem, we could solve Horn-ALCclassification in polynomial time.
2. By (1), we could solve an ExpTime-hard problem in polynomial time.
3. By (2), P=ExpTime( )
Remark. To implement the Horn-ALCclassification calculus (or any other proce- dure that solves Horn-ALCclassification), we need a rule-based language with ExpTime-hard data complexity!
Implementing the Classification Calculus: Datalog(S)
We study Datalog(S), an extension of Datalog that can model exponential computations.
Example. Consider the following Datalog(S) rule set:
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
LikesAll(x,S)→AllLikeAll({x},S) AllLikeAll(S,T)∧LikesAll(x,T)→AllLikeAll(X∪ {x},T)
AllLikeAll(S,S)∧alice∈S→CliqueOfAlice(S)
Theorem. Checking fact entailment for Datalog(S) is ExpTime-complete for both data and combined complexity.
See (Carral et al. 2019) for a complete proof of the above result.
Implementing the Classification Calculus: Datalog(S)
Using a function to encode the axioms and entities in an input ontology as facts and a fixed Datalog(S) rule set, we can implement the Horn-ALCclassification calculus.
Example. For an ontologyO, let Facts(O)be the fact set such that:
Av ⊥ 7→nf:axiomv(cA,c⊥) ∃R.AvB7→nf:axiom∃v(cA,cR,cB)
> vB7→nf:axiomv(c>,cB) Av ∀R.B7→nf:axiomv∀(cA,cR,cB) AvB7→nf:axiomv(cA,cB) Av ∃R.B7→nf:axiomv∃(cA,cR,cB) AuEvB7→nf:axiomuv(cA,cE,cB) A∈Concepts(O)7→nf:concept(cE) In the above;cA,cB,cE,c>, andc⊥ are fresh constants unique forA,B,E,>, and
⊥, respectively; andcR is a fresh constant uniqueR.
Implementing the Classification Calculus: Datalog(S)
We translate the production rules in the Horn-ALCclassification calculus (left) into analogous Datalog(S) rules (right):
AvA:A∈Concepts(O) nf:concept(a)
→SC({a},a)
Cv ∃R.D
DvD :D∈D
Ex(C,r,D)∧d∈D
→SC(D,d)
CvA
CvB:> vB∈ O SC(C,a)∧nf:axiomv(c>,b)
→SC(C,b)
CvA
CvB:AvB∈ O SC(C,a)∧nf:axiomv(a,b)
→SC(C,b)
CvA CvE
CvB :AuEvB∈ O SC(C,a)∧SC(C,e)∧nf:axiomuv(a,e,b)
→SC(C,b)
Implementing the Classification Calculus: Datalog(S)
We translate the production rules in the Horn-ALCclassification calculus (left) into analogous Datalog(S) rules (right):
CvA
Cv ∃R.B :Av ∃R.B∈ O SC(C,a)∧nf:axiomv∃(a,r,b)
→Ex(C,r,{b})
Cv ∃R.D DvA
CvB :∃R.AvB∈ O Ex(C,r,D)∧SC(D,a)∧nf:axiom∃v(r,a,b)
→SC(C,b)
Cv ∃R.D Dv ⊥ Cv ⊥
Ex(C,r,D)∧SC(D,c⊥)
→SC(C,c⊥)
Cv ∃R.D CvA
Cv ∃R.(DuB) :Av ∀R.B∈ O Ex(C,r,D)∧SC(C,a)∧nf:axiomv∀(a,r,b)
→Ex(C,r,D∪ {b})
Implementing the Classification Calculus: Datalog(S)
Definition. LetRHALCbe the rule set containing all of the above rules:
nf:concept(a)→SC({a},a) SC(C,a)∧nf:axiomv(c>,b)→SC(C,b) Ex(C,r,D)∧d∈D→SC(D,d) SC(C,a)∧nf:axiomv(a,b)→SC(C,b)
SC(C,a)∧SC(C,e)∧nf:axiomuv(a,e,b)→SC(C,b) SC(C,a)∧nf:axiomv∃(a,r,b)→Ex(C,r,{b}) Ex(C,r,D)∧SC(D,a)∧nf:axiom∃v(r,a,b)→SC(C,b)
Ex(C,r,D)∧SC(D,c⊥)→SC(C,c⊥) Ex(C,r,D)∧SC(C,a)∧nf:axiomv∀(a,r,b)→Ex(C,r,D∪ {b})
Theorem. Consider a Horn-ALContologyOand an axiom of the formA v B.
Then,O |=AvBif and only ifRHALC∪Facts(O)|=SC(cA,cB).
Implementing the Classification Calculus: ∃ -Rules
Alas, VLog does not support Datalog(S) reasoning. But there maybe some other rule-based language with ExpTime-hard data complexity that we can use!
The following result is a recent finding by (Krötzsch, Marx, and Rudolph 2019):
Theorem. The data complexity of fact entailment over rule sets that terminate with respect to the restricted chase is ExpTime-hard.
Remark. Note that the data complexity of fact entailment over existential rule sets that terminate with respect to the Skolem chase is in P.
(Carral et al. 2019) have proposed a translation from Datalog(S) into∃-rules such that:
• The resulting rule sets terminate w.r.t. theDatalog-first restricted chase.
• Fact entailment is “preserved”.
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
From Datalog(S) to Existential Rules
Person(x)→LikesAll(x,∅) LikesAll(x,S)∧Likes(x,y)→LikesAll(x,S∪ {y})
Solving ExpTime-hard Problems
Step-by-step procedure to implement an ExpTime algorithm with VLog:
1. Encode input using a set of factsF.
2. Encode ExpTime algorithm using a fixed Datalog(S) rule setR.
3. Apply the translation by (Carral et al. 2019) toRto obtain a setR0of existential rules such that:
– The rule setR0“preserves” fact entailment overR.
– The rule setR0terminates w.r.t. the Datalog-first restricted chase.
4. Use VLog to compute all of the consequences ofR0∪ F.
Remark. For a detailed explanation of the above procedure, see (Carral, Dragoste, and Rudolph 2020).
Evaluation: Classification
ID #Ax. #SC VLog Konclude
00040 223K 1051K 432s 5s
00048 142K 718K 387s 3s
00477 318K 162K 1s 3s
00533 159K 965K 132s 2s
00786 152K 2283K 549s 14s
Figure: Ontologies and results for classification showing: axiom count, number ofSC facts derived, and reasoning times for VLog and Konclude
Remark. Presented in (Carral et al. 2019).
Evaluation: Class Retrieval
Definition. A Horn-ALContology is a set of Horn-ALCaxioms:
Av ⊥ > vB AvB AuEvB
∃R.AvB Av ∀R.B Av ∃R.B A(a) R(a,b) WhereA,B, andEare concepts;Ris a role; andaandbare individuals.
Definition. Class retrieval is the reasoning task of computing all axioms of the formA(a)that are logically entailed by some input ontologyO.
Remark. The Horn-ALCclassification calculus can be extended with 3 rules (as done by (Carral et al. 2019)) to solve class retrieval.
Evaluation: Class Retrieval
sec
1.7M 3.1M 4.4M
100 101 102 103
Number of assertions
Reactome
sec
1.9M 4M 5.9M
100 101 102 103
Number of assertions
UOBM
Experimental results for class retrieval for VLog (pink/grey) and Konclude (black) Remark. Presented in (Carral et al. 2019).
Conclusions and Future Work
Remark. We can use VLog to solve (ExpTime-)hard problems!
Future work:
• Rulewerk Extension: translate Datalog(S) to existential rules
• VLog Extension: native support for Datalog(S)
• Implement existing calculi using our approach
References I
Carral, David, Irina Dragoste, and Sebastian Rudolph (2020). “Reasoner = Logical Calculus + Rule Engine”.In:Künstliche Intell.
Carral, David et al. (2019). “Chasing Sets: How to Use Existential Rules for Expressive Reasoning”.In:P. of the 28th Int. Joint Conf. on AI (IJCAI 2019).
Kazakov, Yevgeny (2009). “Consequence-Driven Reasoning for Horn-SH IQ Ontologies”.In:P. of the 21st Int. Joint Conf. on AI (IJCAI 2009).
Krötzsch, Markus, Maximilian Marx, and Sebastian Rudolph (2019). “The Power of the Terminating Chase (Invited Talk)”.In:P. of the 22nd Int. Conf. on Database Theory (ICDT) 2019).
Krötzsch, Markus, Sebastian Rudolph, and Pascal Hitzler (2013). “Complexities of Horn Description Logics”.In:ACM Trans. Comput. Log.