<<

Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track

Multi-head Guarded Existential Rules Over Fixed Signatures

Georg Gottlob1 , Marco Manna2 , Andreas Pieris3 1Department of Computer Science, 2Department of Mathematics and Computer Science, University of Calabria 3School of , University of Edinburgh [email protected], [email protected], [email protected]

Abstract 2. to understand whether it can be solved by relying on stan- dard technology via query rewriting. Guarded existential rules form a robust rule-based language for modelling ontologies. The central problem of ontology- It is fair to claim that the above aspects of the problem based query answering, as well as the notion of polynomial are rather well-understood. Concerning the first one, OBQA combined rewritability, have been extensively studied during for guarded existential rules is complete for PTIME in data the last years for this formalism. However, the relevant set- complexity (i.e., when the ontology and the query are fixed), ting where the underlying signature is fixed is far from being for NP when the underlying signature (or schema) is fixed well-understood. All the existing results on ontology-based query answering and polynomial combined rewritability im- with the additional implicit assumption that rule-heads have plicitly assume rule-heads with one atom, whereas existential only one atom (further details about the latter assumption are rules in real ontologies are typically coming with multi-heads given below), for EXPTIME over signatures of fixed arity, consisting of several atoms. We aim to fill this gap. and for 2EXPTIME in combined complexity (Cal`ı, Gottlob, and Lukasiewicz 2012; Cal`ı, Gottlob, and Kifer 2013). Concerning query rewriting, the PTIME-hardness in data 1 Introduction complexity immediately implies that the problem in ques- In ontology-based query answering (OBQA), ontologies are tion is not first-order rewritable. On the other hand, we know used to enrich incomplete data with domain knowledge, en- that it is Datalog rewritable (Bar´ any,´ Benedikt, and ten Cate abling more complete answers to queries, typically conjunc- 2013; Gottlob, Rudolph, and Simkus 2014). At this point, let tive queries (CQs). A notable range of ontology formalisms us stress that the above results refer to the pure approach to for OBQA, which vary in syntax, expressivity and complex- query rewriting, where the rewriting phase does not depend ity, has been developed during the last decade. Two promi- on any database. With the aim of obtaining first-order rewrit- nent families of languages, obtained from this extensive ef- ings, and thus being able to use a standard relational engine fort, are description logics (DL) (Baader et al. 2017), and for OBQA purposes, the work (Gottlob, Manna, and Pieris existential rules (a.k.a. tuple-generating dependencies and 2014) adopted the more refined approach to query rewriting Datalog rules) (Baget et al. 2011; Cal`ı et al. 2010). Many known as the combined approach, originally introduced in of the existing DL-based and rule-based ontology languages the context of DLs (Lutz, Toman, and Wolter 2009), which guarantee good computational and model-theoretic proper- allows us to rewrite also the database in a query-independent ties by posing restrictions on the use of quantifiers. They are way. It was shown that indeed OBQA for guarded existential essentially defined through the relativisation of quantifiers rules is combined first-order rewritable. The really interest- by atomic formulas, similar to the guarded fragment of first- ing result of that work, though, is that in the fixed signature order logic (Andreka,´ van Benthem, and Nemeti´ 1998). It is case the rewriting process takes only polynomial time with generally agreed that guardedness is a paradigm that leads the additional implicit assumption that rule-heads mention to reasonably expressive and robust ontology languages. only one atom. Note that beyond fixed signatures, the com- The main rule-based ontology language that originated bined rewriting process is unlikely to be polynomial. from this paradigm, which is the main concern of this work, is the class of guarded existential rules (Cal`ı, Gottlob, and Multi-head Rules and Fixed Signatures. Despite the thor- Kifer 2013). It consists of sets of first-order sentences of the ough analysis of the OBQA problem for guarded existential form ∀x¯∀y¯φ(¯x, y¯) → ∃z¯ ψ(¯x, z¯), where φ (the body) and rules, there is a striking gap, which we reveal below, that ψ (the head) are conjunctions of relational atoms, and φ has passed unnoticed until recently when it was brought to our an atom that contains all the universally quantified variables. attention by a colleague of ours (Benedikt 2018). Recall that an existential rule is typically defined as a first- Guarded Existential Rules. The problem of OBQA has order sentence ∀x¯∀y¯φ(¯x, y¯) → ∃z¯ ψ(¯x, z¯), where φ and been rigorously studied for guarded existential rules during ψ are conjunctions of relational atoms. For OBQA purposes, the last years. The two main research directions were: the fact that in the head we can have a conjunction of atoms 1. to pinpoint its computational complexity, and is usually seen as syntactic sugar. The reason is because we

445 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track

can always convert a set Σ of existential rules into a set Σ1 over a fixed signature is constant, which in turn implies that of existential rules with only atom in the head such that Σ we can only have a constant number of different single-head and Σ1, although not logically equivalent, are equivalent for guarded rules (up to variable renaming). This is far from OBQA. This, in fact, relies on a very simple transformation being true for multi-head guarded existential rules since we that replaces each existential rule σ ∈ Σ of the form can have an unbounded number of different rules with the same guarded body due to the unguarded multi-heads. ∀x¯∀y¯ φ(¯x, y¯) → ∃z¯ R1(¯x1, z¯1) ∧ · · · ∧ Rn(¯xn, z¯n)), Our Results. The main results of this work are as follows: where x¯i ⊆ x¯ and z¯i ⊆ z¯, with the set of existential rules 1. Before delving into the analysis that will provide answers ∀x¯∀y¯ φ(¯x, y¯) → ∃z¯Auxσ(¯x, z¯)) to our main research questions, we ask ourselves whether ∀x¯∀z¯(Auxσ(¯x, z¯) → Ri(¯xi, z¯i)), for i ∈ {1, . . . , n}, multi-head guarded rules are strictly more expressive than single-head ones. We show that, for each schema S (with with Auxσ being a fresh relation not occurring in Σ. Notice at least one binary relation), there exists a set of multi- further that if Σ is guarded, then also Σ1 is guarded. head guarded existential rules over S that cannot be equiv- Due to the above transformation, all the known complex- alently rewritten as a set of single-head guarded existen- ity results on OBQA for guarded existential rules, as well as tial rules over S for OBQA purposes. In simple words, the result on polynomial combined first-order rewritability, if we are not allowed to introduce new relation symbols, have been shown for existential rules with only one atom in multi-heads are not merely syntactic sugar but come with the head. The reason was purely technical, that is, to sim- additional expressive power. plify the technical definitions and proofs. Although this sim- plifying assumption can be made, in general, without affect- 2. We then show that OBQA for multi-head guarded exis- ing the generality of the results, this is not true in the relevant tential rules over fixed signatures is NP-complete. The setting of fixed signatures. This is because, even if we start non-trivial result is the upper bound; the lower bound is from a set of guarded existential rules over a fixed signature, inherited from CQ evaluation. Towards showing the upper the obtained set of single-head guarded rules after the trans- bound, we obtain several results of independent interest: formation mentions an unbounded number of new relations (i) instance checking for multi-head guarded existential each of unbounded arity (see the auxiliary predicates). rules over fixed signatures is in PTIME, (ii) OBQA for As mentioned above, fixing the signature is a relevant set- multi-head guarded existential rules can be polynomially ting, which is close in spirit to data complexity. Typically, reduced to multi-head linear existential rules (i.e., rules the size of the signature is much smaller than the size of the with only one atom in the body) without increasing the database, and therefore, it can be productively assumed to arity of the signature, and (iii) OBQA for multi-head lin- be fixed. Furthermore, since the typical purpose of an ontol- ear existential rules is NP-complete for signatures of fixed ogy is to model a certain domain of interest, the schema is arity. The above are known for single-head rules, but can- actually predetermined by the application domain in ques- not be directly transferred to multi-head ones. tion, which is another justification for considering the signa- 3. Finally, by exploiting the machinery introduced for es- ture fixed. The above, together with the fact that it is more tablishing the NP upper bound, we can show that OBQA convenient to design ontologies using multi-head existential for multi-head guarded existential rules over fixed signa- rules, it suggests that the gap in the analysis of OBQA for tures is polynomially combined first-order rewritable; in guarded existential rules described above is a fundamental fact, the target is existential positive first- one, which undoubtedly deserves our attention. order queries. Towards this end, we also show the same for multi-head linear rules over signatures of fixed arity. Research Challenges. From the above discussion, we are The latter is known for single-head linear rules, but it can- left with the following key questions concerning the OBQA not be straightforwardly transferred to multi-head ones. problem for guarded existential rules over fixed signatures: 1. Does the NP-completeness result for single-head rules 2 Preliminaries carry over to multi-head rules? We consider the disjoint countably infinite sets C, N and V 2. Does the polynomial combined first-order rewritability of constants, nulls and variables, respectively. We refer to result for single-head rules carry over to multi-head rules? constants, nulls and variables as terms. For an integer n ≥ 1, The goal of this work is to provide answers to the above we may write [n] for the set {1, . . . , n}. questions, which will advance our knowledge on the impor- Relational Instances. A (relational) schema S is a finite set tant problem of OBQA for guarded existential rules. of relation symbols (or predicates) with associated arity. We Contrary to what one might think, the fact that we need write ar(R) for the arity of a predicate R, and ar(S) for the to directly deal with multi-heads causes non-trivial compli- arity of S, i.e., the number maxR∈S{ar(R)}. An atom over cations, which were not an issue for single-head TGDs, that S is an expression of the form R(t¯), where R ∈ S and t¯is a require novel ideas. To better understand the different nature tuple of terms. An instance over S is a (possibly infinite) set of the two settings, let us stress that in the case of single-head of atoms over S with constants and nulls, while a database guarded existential rules, by fixing the underlying signature over S is a finite instance over S with only constants. Given we implicitly fix the whole ontology. The number of differ- a set of of terms T , let B(T, S) be the set of atoms that can ent guarded non-isomorphic rule-bodies that can be formed be formed using terms of T and predicates of S. We write

446 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track dom(I) for the set of terms in an instance I; this notation class of linear TGDs, denoted L, which collects all the sets naturally extends to sets of atoms. of TGDs with one body atom. We also write L1 for the class Homomorphisms. A homomorphism from a set of atoms A of sets of linear TGDs with one head atom. to a set of atoms B is a function h : dom(A) → dom(B) that The Chase Procedure. The chase procedure is a useful tool ¯ ¯ is the identity on C with R(h(t)) ∈ B for every R(t) ∈ A. when reasoning with TGDs. Let us first define a single chase We write A → B for the fact that there is a homomorphism application. A trigger for a set Σ of TGDs on an instance I from A to B. For a set of terms S, we say that A and B are is a pair (σ, h), where σ ∈ Σ and h is a homomorphism S-isomorphic, denoted A 'S B, if there is a 1-1 homomor- body(σ) I application (σ, h) I −1 from to . An of to returns an phism from A to B such that h maps B to A. instance J = I ∪ h0(head(σ)), where h0 extends h in such Queries. A conjunctive query (CQ) over a schema S is a a way that (i) for each existentially quantified variable z of  0 formula of the form q(¯x) := ∃y¯ R1(¯v1) ∧ · · · ∧ Rm(¯vm) , σ, h (z) ∈ N \ dom(I), and (ii) for distinct existentially 0 0 where each Ri(¯vi) is an atom without nulls, each variable quantified variables z and w of σ, h (z) 6= h (w). Such a mentioned in the v¯i’s appears either in x¯ or y¯, and x¯ are the trigger application is denoted as Ihσ, hiJ. free variables of q. If x¯ is empty, then q is a Boolean CQ. Let The main idea of the chase is, starting from a database D, I be an instance, and q(¯x) a CQ as above. The evaluation of to exhaustively apply distinct triggers for the given set Σ of q(¯x) over I, denoted q(I), is the set of tuples c¯ ∈ C|x¯| such TGDs on the instance constructed so far, and keep doing this that q(¯c) → I; we may treat a conjunction of atoms as a set. until a fixpoint is reached. This is formalized as follows: Tuple-generating dependencies. A tuple-generating de- • A finite sequence of instances (Ii)0≤i≤n, with D = I0 pendency (TGD) σ over a schema S is a first-order sentence and n ≥ 0, is a chase derivation of D w.r.t. Σ if: (i) for of the form ∀x¯∀y¯φ(¯x, y¯) → ∃z¯ ψ(¯x, z¯), where φ and ψ each 0 ≤ i < n, there is a trigger (σ, h) for Σ on Ii such are (non-empty) conjunctions of atoms over S that mention that Iihσ, hiIi+1; (ii) for each 0 ≤ i < j < n, assuming only variables. We write σ as φ(¯x, y¯) → ∃z¯ ψ(¯x, z¯), and use that Iihσi, hiiIi+1 and Ijhσj, hjiIj+1, σi = σj implies comma instead of ∧ for joining atoms. We call φ and ψ the hi 6= hj, and (iii) there is no trigger (σ, h) for Σ on In body and head of σ, denoted body(σ) and head(σ), respec- such that (σ, h) 6∈ {(σi, hi)}0≤i 0 such that i 6= j, assuming that Iihσi, hiiIi+1 Ontological Query Answering. Given a database D and a and Ijhσj, hjiIj+1, σi = σj implies hi 6= hj; and (iii) for set Σ of TGDs, a model of D and Σ is a (possibly infinite) each i ≥ 0, and for every trigger (σ, h) for Σ on Ii, there instance I ⊇ D such that I |= Σ. We write mods(D, Σ) for exists j ≥ i such that Ijhσ, hiIj+1; this is the fairness condition, and guarantees that all the triggers eventually the set of models of D and Σ. The certain answers to a CQ q S T will be applied. The result of the chase is Ii. w.r.t. D and Σ is the set cert(q, D, Σ) = I∈mods(D,Σ) q(I). i≥0 The main problem that we study in this work follows: We write chaseδ(D, Σ) for the result of a (finite or infinite) chase derivation δ of D w.r.t. Σ. Here is the key property: PROBLEM : OQA(C) C INPUT : A database D, a set Σ ∈ of TGDs, Proposition 1 Consider a database D, a set Σ of TGDs, a CQ q(¯x), and a tuple c¯ ∈ dom(D)|x¯|. and a chase derivation δ of D w.r.t. Σ. For every instance QUESTION : Does c¯ ∈ cert(q, D, Σ)? I ∈ mods(D, Σ), it holds that chaseδ(D, Σ) → I.

We are interested in the complexity of the problem when In the rest of the paper, we will silently use a crucial con- the schema is fixed, i.e., the complexity of OQA(C[S]) for sequence of the above result, namely a tuple c¯ belongs to a fixed schema S. We adopt the usual convention that when cert(q, D, Σ) iff there exists a prefix (Ii)0≤i≤n, for n ≥ 0, we talk about the complexity of OQA(C) for fixed schemas, of a chase derivation of D w.r.t. Σ such that c¯ ∈ q(In). we say that it is C-complete for a complexity class C if, for We conclude our discussion by defining a useful relation each schema S, OQA(C[S]) is in C, and there is a schema over the result of chase derivations. Consider a chase deriva- C S such that OQA( [S]) is C-hard. Analogously, we can talk tion δ = (Ii)i≥0 of a database D w.r.t. a set Σ of TGDs, and C about the complexity of OQA( ) for schemas of fixed arity. assume that for each i ≥ 0, Iihσi, hiiIi+1, i.e., Ii+1 is ob- tained from Ii via the application of the trigger (σi, hi) to Guardedness and Linearity. A TGD σ is guarded if there p Ii. The parent relation of δ, denoted ≺ , is a binary rela- is an atom in body(σ), called guard, that contains all the p δ body variables. By convention, the leftmost body atom of a tion over chaseδ(D, Σ) such that α ≺δ β iff there is i ≥ 0 p,+ guarded TGD σ is the guard, denoted guard(σ), and all the such that α ∈ hi(body(σi)) and β ∈ Ii+1 \ Ii. Let ≺δ be G G p p other atoms are the side atoms of σ. Let (resp., 1) be the the transitive closure of ≺δ . Note that ≺δ is acyclic, i.e., it class of finite sets of guarded TGDs (resp., with one head forms a directed acyclic graph, whereas in the case of linear atom). A subclass of G, which is crucial for our work, is the TGDs it forms a forest, with the atoms of D being the roots.

447 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track

3 Relative Expressiveness The above, together with the fact that Σ1 is guarded, allow We start with the question concerning the expressive power us to conclude that, for every chase derivation δ = (Ii)i≥0 of of multi-head guarded TGDs. We adopt the notion of pro- D w.r.t. Σ with Iihσi, hiiIi+1, σi has the form R(x, y) → ψ, gram expressive power, introduced in (Arenas, Gottlob, and where ψ is one of the following atomic formulas: Pieris 2018), which captures the essence of our question: ∃z∃w R(z, w) ∃z R(x, z) ∃z R(z, y). having available a schema S, is it the case that a set Σ ∈ 0 G[S] can be rewritten as a set Σ ∈ G1[S] that can answer But this implies that cert(line2,DR, Σ1) is empty, which is the exact same CQs? As we shall see below, the answer to a contradiction, and the claim follows. this question is negative. Let us first properly introduce the adopted notion of program expressive power.1 4 Complexity Analysis The expressive power of a set Σ of TGDs over a schema S, OQA(G1) is NP-complete for fixed schemas (Cal`ı, Gottlob, denoted ep(Σ), is the set of triples (D, q(¯x), c¯), where D is and Kifer 2013). The goal of this section is to show that this a database over S, q(¯x) is a CQ over S, and c¯ ∈ dom(D)|x¯|, result carries over to multi-head TGDs: such that c¯ ∈ cert(q, D, Σ). The program expressive power G of a class of TGDs C is defined as the family of triples Theorem 4 OQA( ) is NP-complete for fixed schemas. C C The lower bound is inherited from CQ evaluation, which pep( ) = {ep(Σ) | Σ ∈ }. is NP-hard even for schemas with one binary relation. The For two classes of TGDs C1, C2, we say that C2 is more ex- upper bound, on the other hand, is a rather non-trivial re- pressive than C , written C ≤ C , if pep(C ) ⊆ pep(C ). sult, which cannot be immediately obtained from the fact 1 1 2 1 2 G In addition, we say that C2 is strictly more expressive than that OQA( 1) is in NP. Our proof proceeds in three steps: C2, written C1 < C2, if C1 ≤ C2 and C2 6≤ C1. The next 1. We first focus on the simpler problem of instance check- result provides a definite answer to our first question: ing, and show that it is in PTIME for fixed schemas. 0 Theorem 2 For a schema S with ar(S) > 1, G1[S] < G[S]. 2. We reduce OQA(G[S]), for a schema S, to OQA(L[S ]), 0 0 It is not difficult to verify that to establish Theorem 2 (in where S ⊇ S with ar(S) = ar(S ), and we further show, by exploiting point (1), that the given reduction is a poly- fact, G[S] 6≤ G1[S] since G1[S] ≤ G[S] holds trivially), we simply need to exhibit a set of TGDs Σ ∈ G[S] such that, for nomial time reduction whenever S is fixed. every Σ1 ∈ G1[S], there exist a database D and a CQ q, both 3. We then show that OQA(L) is NP-complete for schemas over the schema S, with cert(q, D, Σ) 6= cert(q, D, Σ1). By of fixed arity. This result, which is of independent interest, assumption, S contains at least one binary predicate R. We together with the above reduction, establishes the desired define Σ as the singleton set consisting of the TGD NP upper bound claimed in Theorem 4. R(v, w) → ∃x∃y∃z R(x, y),R(y, z). 4.1 Step 1: Instance Checking

Towards a contradiction, assume that there exists a set Σ1 ∈ The problem that we study in this section, which is actually G1[S] such that, for every database D and CQ q, both over a special case of ontological query answering, is as follows: S, it holds that cert(q, D, Σ) = cert(q, D, Σ1). Let DR = {R(a, b)}, and consider also the Boolean CQs PROBLEM : IC(C) INPUT : A database D, a set Σ ∈ C of TGDs, line2 = ∃x∃y∃z (R(x, y) ∧ R(y, z)) a CQ R(¯x), and c¯ ∈ dom(D)ar(R). line3 = ∃x∃y∃z∃w (R(x, y) ∧ R(y, z) ∧ R(z, w)), QUESTION : Does c¯ ∈ cert(R(¯x),D, Σ)? and for each P ∈ S \{R}, the Boolean CQ The goal is to show the following complexity result: otherP = ∃x1 · · · ∃xar(P ) P (x1, . . . , xar(P )). Theorem 5 IC(G) is in PTIME for fixed schemas. ∅ Clearly, cert(line2,DR, Σ) 6= , while cert(line3,DR, Σ) IC(G1) is in PTIME for fixed schemas (Cal`ı, Gottlob, and and cert(otherP ,DR, Σ), for each P ∈ S \{R}, are empty. Kifer 2013), which has been shown via a sophisticated alter- Hence, the same holds for Σ1. It is an easy exercise to verify nating that uses logarithmic space. However, this that the following hold; otherwise, it will contradict one of result cannot be straightforwardly transferred to multi-head the above statements concerning certain answers under Σ1: TGDs. We proceed to establish Theorem 5 via a novel alter- Fact 3 For every chase derivation δ of D w.r.t. Σ : nating algorithm that is designed to operate on multi-head R 1 TGDs. But first we need to introduce some auxiliary results. 1. There is no atom of the form R(t, t) in chaseδ(DR, Σ1). 2. There are no atoms of the form R(t, t0),R(t0, t), with t 6= Guarded Types. A key notion when reasoning with guarded t0, in chase (D , Σ ). TGDs is the type of an atom. Consider a database D, and a δ R 1 set Σ ∈ G of TGDs. Let δ = (I ) be a (finite or infinite) 3. There is no atom of the form P (t¯), for a predicate P ∈ S i i≥0 chase derivation of D w.r.t. Σ with Iihσi, hiiIi+1. Given such that P 6= R, in chaseδ(DR, Σ1). an atom α ∈ chaseδ(D, Σ), its δ-type (w.r.t. D and Σ), de- 1 A set of TGDs is also called program, influenced by logic pro- noted typeδ(α), is the set {β ∈ chaseδ(D, Σ) | dom(β) ⊆ gramming, and hence the name program expressive power. dom(α)}, i.e., all the atoms in the result of δ that share terms

448 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track with α. The key property of the type, which has been shown The direction (3) ⇒ (2) holds trivially, whereas (2) ⇒ in (Cal`ı, Gottlob, and Kifer 2013) for single-head TGDs, (1) holds since chaseδ[α](typeδ(α), Σ) ⊆ chaseδ(D, Σ). It and it can be easily extended to multi-head TGDs, it roughly remains to show (1) ⇒ (3). Let γ ∈ Q be the atom that con- states that the set of atoms in chaseδ(D, Σ) that can be de- tains all the terms of dom(Q), and let α, β ∈ chaseδ(D, Σ) rived from α (used as a guard) is determined by the δ-type gp gp,+ be atoms such that α ≺δ β, β ≺δ γ, null(α) 6⊆ null(β), of α. To make this precise we need some auxiliary notions. null(β) ⊆ null(γ) α δ gp and . By guardedness, is the -pivotal gp,+ The guarded parent relation of δ, denoted ≺δ , is a binary 0 0 gp atom for Q, and, for each α ∈ Q, it holds that α ≺δ α relation over chaseδ(D, Σ) such that α ≺δ β iff there exists 0 2 gp,+ or α ∈ typeδ(α). Hence, Q ⊆ chaseδ[α](typeδ(α), Σ). i ≥ 0 with α = hi(guard(σi)) and β ∈ Ii+1 \ Ii. Let ≺δ gp gp The Alternating Algorithm be the transitive closure of ≺δ . Note that ≺δ forms a forest with the atoms of D being the roots. We can now define the Given a database D, a set Σ ∈ G, a CQ R(¯x), and a tuple c¯ ∈ notion of projection of δ, which will allow us to state the key dom(D)ar(R) c¯ ∈ cert(R(¯x),D, Σ) property of the type. Consider an atom α ∈ chase (D, Σ), , checking whether boils δ R(¯c) chase (D, Σ) and let (i ) be the sequence of indices, with 0 ≤ i < down to checking whether belongs to δ for j j>0 1 some chase derivation δ of D w.r.t. Σ. Lemma 7 suggests the i2 < i3 < ··· such that, for each ` ≥ 0, ` ∈ {ij}j>0 gp,+ following strategy for the latter task: find σ ∈ Σ and a map- iff h`(guard(σ`)) = α or α ≺δ h`(guard(σ`)). Simply ping h from the variables in body(σ) to dom(D) ∪ N such stated, (ij)j>0 collects all the applications in δ, in ascending gp that R(¯c) ∈ h(head(σ)), and check whether there exists a δ- order, that use α or a ≺δ -descendant of α as the guard. The pivotal atom for the ungrounded subset of h(body(σ)), for α-projection of δ, denoted δ[α], is the sequence of instances some chase derivation δ of D w.r.t. Σ, while for each ground (Ji)i≥0, with J0 = typeδ(α), and, for j > 0, atom in h(body(σ)) recursively apply the above strategy. gp Our alternating algorithm, which is described in detail next, J = J ∪ β ∈ I | h (guard(σ )) ≺ β . j j−1 ij +1 ij ij δ performs the above steps in parallel universal computations, We can now formally state the key property of the notion of which ensures that only logarithmic space is needed. Recall type, which heavily relies on guardedness: that polynomial time coincides with alternating logspace. Lemma 6 Consider a database D, and Σ ∈ G. For a chase Some Preparation. Let us first introduce some useful no- tions. Since we can use only logarithmic space, we cannot derivation δ of D w.r.t. Σ, and an atom α ∈ chaseδ(D, Σ), δ[α] is a chase derivation of type (α) w.r.t. Σ. afford to explicitly store all the atoms generated via a single δ chase step since we deal with multi-heads; this could be pos- Pivotal Atoms. Our alternating algorithm exploits the exis- sible in the case of single-head TGDs. Therefore, we need a tence of some special atoms, called pivotal, for guarded sub- way to compactly represent such a set of atoms, while such sets of the result of a derivation. Roughly, to check whether a a representation should take only logspace. This is done via guarded set of atoms Q is in the result of some chase deriva- a so-called (D, Σ)-step, which is a compact representation tion δ, it suffices to check whether Q is in the result of the of the guard atom of a chase step, together with its type, and α-projection of δ with α being a pivotal atom for Q. the atoms that are generated via this chase step. Consider a database D, and a set Σ ∈ G of TGDs, both Let ∆Σ = {⊥1,..., ⊥2·(ar(Σ)+1)} that collects all the dif- over a schema S. A finite set of atoms Q ⊆ B(C ∪ N, S) ferent sorts of nulls that are needed to perform our check us- is guarded if it has an atom α such that dom(α) = dom(Q). ing a bounded number of nulls, which in turn will ensure that ? i We say that Q is ungrounded if each of its atoms contains we use only logspace. Let ∆Σ = {s | s ∈ ∆Σ}j∈[`Σ] ⊆ N, at least one null of N. Let null(Q) be the set of nulls in Q. where `Σ = maxσ∈Σ{`σ} with `σ be the number of exis- Consider now a chase derivation δ = (Ii)i≥0 of D w.r.t. Σ tential variables in σ.A (D, Σ)-step for a set S ( ∆Σ is a with Iihσi, hiiIi+1, and a set of atoms Q ⊆ B(C ∪ N, S) tuple (σ, h, s, T ) – we assume that Σ is over S – where : that is guarded and ungrounded. An atom α ∈ chase (D, Σ) δ - σ is a TGD of Σ, is δ-pivotal for Q if α = hi(guard(σi)) for some i ≥ 0 such ? that null(Q) 6⊆ dom(Ii), while null(Q) ⊆ dom(Ii+1); i.e., - h : dom(body(σ)) → dom(D) ∪ ∆Σ, a δ-pivotal atom for Q is an atom of chase (D, Σ) in which δ - s ∈ ∆Σ \ S, and the nulls in Q occur together for the first time according to δ. The key lemma concerning pivotal atoms follows: - h(body(σ)) ⊆ T ⊆ B(dom(h(guard(σ))), S). G Such a (D, Σ)-step should be interpreted as follows. The Lemma 7 Consider a database D, and a set Σ ∈ , both triple (σ, h, s) encodes the set of atoms h0(head(σ)), where over a schema S. Let δ be a chase derivation of D w.r.t. Σ, 0 h extends h as follows: if z1, . . . , zk are the existential vari- and Q ⊆ B(C ∪ N, S) be a guarded and ungrounded set of ables of σ, then h0(z ) = si, i.e., the sort s and the variable z atoms. The following are equivalent: i i uniquely determine the null that is assigned to zi. We denote 1. Q ⊆ chaseδ(D, Σ). this set of atoms [[σ, h, s]]. Note that the fresh nulls of sort s 2. There is an atom α ∈ chase (D, Σ) that is δ-pivotal for in [[σ, h, s]] do not occur in h(guard(σ)) since h(guard(σ)) δ does not contain a null of sort s. Moreover, T corresponds Q such that Q ⊆ chaseδ[α](typeδ(α), Σ). ? to the type of h(guard(σ)). For a set N ⊆ ∆Σ, it would be 3. There is exactly one atom α ∈ chaseδ(D, Σ) that is δ- 2 pivotal for Q, and Q ⊆ chaseδ[α](typeδ(α), Σ). Note that δ[α] is well defined due to Lemma 6.

449 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track

? Algorithm 1: Instance Checking to dom(D) ∪ ∆Σ with R(¯c) ∈ h(head(σ)), and check, via the procedure Proof, that h(body(σ)) is derivable via some Entail(D, Σ,R(¯x), c¯) chase derivation. Note that we cannot afford to use an unlim- ited number of null values since we have limited space. The if R(¯c) ∈ D then nulls of ∆? are enough for faithfully checking the above. return Accept Σ else I The procedure Proof checks whether a set of atoms Q is guess σ ∈ Σ and derivable via some chase derivation. Each ground atom of Q ? h : dom(body(σ)) → dom(D) ∪ ∆Σ is proved in a parallel universal computation by recursively if R(¯c) 6∈ h(head(σ)) then calling the procedure Entail. The remaining atoms form a return Reject guarded and ungrounded set Q0; if null(Q) is empty, which else means that Q0 is empty, then the algorithm accepts. In a return Proof(h(body(σ))) parallel universal computation, it checks whether there is a δ-pivotal atom α for Q0, for some chase derivation δ, such Proof(Q) that Q0 is derivable by applying chase steps starting from the δ-type of α (this is enough due to Lemma 7; notice that 0  ar(R) Q := Q \ R(¯c) ∈ Q | c¯ ∈ C here we simply exploit the existence of a δ-pivotal atom, i.e., N := null(Q0) item (2) of Lemma 7). The guessed (D, Σ)-step (σ, h, s, T ), universally do: actually h(guard(σ)), corresponds to the δ-pivotal atom for . universally select every atom R(¯c) ∈ Q \ Q0 Q0, and the algorithm performs in parallel universal compu- return Entail(D, Σ,R(¯x), c¯) tations the following checks: (i) each atom β of Q0, which . if N = ∅ then is not already in the δ-type of h(guard(σ)) given by T , is return Accept derivable by applying chase steps starting from T , which is else done in parallel universal computations by calling the proce- guess (D, Σ)-step (σ, h, s, T ) for sΣ(σ, h) dure Reach, and (ii) T is indeed the δ-type of h(guard(σ)), 1 ` if N ⊆ null(h(guard(σ))) or N 6⊆ {s , . . . , s σ } which is done by recursively calling the procedure Proof. then return Reject I The procedure Reach actually checks whether, for some gp,+ else chase derivation δ of T w.r.t. Σ, h(guard(σ)) ≺δ β. It universally do: starts by guessing an atom α from [[σ, h, s]]. If α is the atom . universally select every atom β ∈ Q0 \ T that we are targeting, namely β, then it accepts; otherwise, return Reach(σ, h, s, T, β) gp,+ it proceeds to check whether α ≺δ β. Due to Lemma 6, . return Proof(T ) gp,+ to check whether α ≺δ β, it suffices to consider only the δ-type of α. In fact, the guessed (D, Σ)-step (σ0, h0, s0,T 0) Reach(σ, h, s, T, β) provides the trigger to apply at the next step, that is, (σ0, h0) with h0(guard(σ0)) = α, the sort of the fresh nulls that will guess α ∈ [[σ, h, s]] an atom appear in the generated atoms, that is, s0, and the δ-type of α, if α = β then 0 gp,+ 0 return Accept that is, T . It remains to verify that (i) α ≺δ β, and (ii) T else is indeed the δ-type of α. The former check is done by recur- sively calling the procedure Reach with input (σ0, h0, s0,T 0). S := sΣ(σ, h) ∪ {s} ∪ sΣ(null(β)) 0 0 0 0 For the latter check, one may suggest that the algorithm can guess (D, Σ)-step (σ , h , s ,T ) for S 0 0 0 simply call Proof(T ). It should not be overlooked, though, if h (guard(σ )) 6= α then 0 return Reject that β and T may share null values, and this fact should be 0 else preserved. However, by calling Proof(T ) in a parallel uni- universally do: versal computation, we loose this connection between β and 0 . return Reach(σ0, h0, s0,T 0, β) T , which may lead to unsound results. The key observation 0 . universally select every atom β0 ∈ T 0 \ T is that T \ T is a guarded and ungrounded set of atoms that 0 return Reach(σ, h, s, T, β0) has the same δ-pivotal atom as Q \ T (the set of atoms from which β is coming from), which, by item (3) of Lemma 7, is unique; this atom is h(guard(σ)). Hence, to prove T 0, the algorithm recursively calls for each atom β0 ∈ T 0 \ T , in a 0 useful to be able to extract the set of sorts of nulls occurring parallel universal computation, Reach(σ, h, s, T, β ). j in N, i.e., the set sΣ(N) = {s | s ∈ N} ⊆ ∆Σ. We write By Lemmas 6 and 7, the algorithm Entail is correct, i.e., sΣ(σ, h) instead of the formal sΣ(null(h(body(σ)))). Entail(D, Σ,R(¯x), c¯) accepts iff R(¯c) ∈ chaseδ(D, Σ), for Description of the Algorithm. Our alternating algorithm is some chase derivation δ of D w.r.t. Σ. Furthermore, at each depicted in the box above. Here is a detailed description: step of its computation, the algorithm uses logarithmic space for storing elements of dom(D), and auxiliary pointers; re- I The procedure Entail implements the strategy discussed call that the schema is fixed. Since polynomial time coin- above: find σ ∈ Σ and a mapping h that maps var(body(σ)) cides with alternating logarithmic space, Theorem 5 follows.

450 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track

4.2 Step 2: Linearization and tuple c¯ ∈ C|x¯|, c¯ ∈ cert(q, D, Σ) implies the existence We now proceed with the second step of the proof for show- of a sequence (Ii)0≤i≤n, with n ≤ pol(||Σ|| + ||q||), that is 3 ing the NP upper bound stated in Theorem 4. We show that: a prefix of a chase derivation of D w.r.t. Σ, and c¯ ∈ q(In). Lemma 8 For a fixed schema S, there exists a schema S0 ⊇ The PWP guarantees that if c¯ ∈ cert(q, D, Σ), then this S with ar(S) = ar(S0) such that OQA(G[S]) can be reduced can be realized after polynomially many chase applications. in polynomial time to OQA(L[S0]). This leads to a simple guess-and-check algorithm for estab- lishing that OQA(C) is in NP for any class C that enjoys the The above has been shown for single-head TGDs in (Got- PWP: guess a sequence of instances δ = (Ii)0≤i≤n, with tlob, Manna, and Pieris 2014). By using the property of the I = D and I ) I , and a sequence of TGD-mapping type for multi-head guarded TGDs discussed in the previous 0 i+1 i pairs ((σi, hi))0≤i

451 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track of quasi chase derivations with total applications only the Lemma 13 Consider a database D, Σ ∈ L, CQ q(¯x), and |x¯| last two reasons apply. Moreover, although triggers may re- c¯ ∈ C . Let δ = (Ii)0≤i≤n be a quasi chase derivation peat in a k-parsimonious quasi chase derivation, at most k with total applications of D w.r.t. Σ with Iihσi, hiiIi+1, and distinct triggers have been used for its generation. assume c¯ ∈ q(In). For a pair of indices 0 ≤ k < ` < n with (σ , h ) = (σ , h ), let δ = (J ) be the (H`, µ−1)- Contractions. Consider a database D, a set Σ ∈ L of TGDs, k k ` ` k,` i 0≤i≤n δ contraction of δ, with µ being the (dom(Hk) ∩ dom(H`))- and a quasi chase derivation δ = (Ii)0≤i≤n, for n ≥ 0, of δ δ isomorphism from Hk to H`. The following hold: D w.r.t. Σ. Let A ⊆ In, and h a mapping from dom(A) δ δ to dom(In). The (A, h)-contraction of δ is the sequence of 1. δk,` is a quasi chase derivation with total applications of 0 instances δ = (Ji)0≤i≤n such that, for each 0 ≤ i ≤ n D w.r.t. Σ with Jihσi, µiiJi+1 for some mapping µi. 2. There is no α ∈ J such that H` ≺p,+ α.  p,+ n δ δk,` Ji = Ii \ α | α ∈ Ii and A ≺ α ∪ δ 3. For each 0 ≤ i, j < n, (σ , h ) = (σ , h ) if and only if  p,+ i i j j h(α) | α ∈ Ii and A ≺δ α . (σi, µi) = (σj, µj). ` p,+ p,+ 4. c¯ ∈ q(Jn \ Hδ ). For brevity, we write A ≺δ α for the fact that β ≺δ α for some atom β ∈ A. Simply stated, the (A, h)-contraction We can now explain how the direction (2) implies (1) is of δ is essentially what we obtain after updating, according shown. Assume that c¯ ∈ cert(q, D, Σ). By hypothesis, there to the mapping h, the atoms in the subtrees of ≺p rooted at exists a pol(||Σ|| + ||q||)-parsimonious quasi chase deriva- p δ A; recall that, due to linearity, ≺δ forms a rooted forest. We tion with total applications δ = (Ii)0≤i≤n of D w.r.t. Σ such can now discuss the details of the proof for Theorem 11. that c¯ ∈ q(In). By iteratively applying Lemma 13, we can eventually construct a pol(||Σ|| + ||q||)-parsimonious quasi PWP and Parsimonious Quasi Chase Derivations 0 chase derivation with total applications δ = (Ji)0≤i≤n of D The characterization of PWP via parsimonious quasi chase w.r.t. Σ with Jihσi, hiiJi+1 such that, for each 0 < j < n derivations (step 1 above) is given by the following result: for which there exists 0 ≤ i < j with (σi, hi) = (σj, hj): j p,+ Proposition 12 For C ⊆ L, the following are equivalent: - There is no α ∈ Jn such that Hδ ≺δ0 α. C j 1. enjoys the PWP. - c¯ ∈ q(Jn \ Hδ ). 2. There is a polynomial pol(·) such that, for every database Therefore, we can drop the applications in δ0 that use a trig- |x¯| 00 D, set Σ ∈ C, CQ q(¯x), and c¯ ∈ C , c¯ ∈ cert(q, D, Σ) ger that has been applied before, and get δ = (Ki)0≤i≤m, implies there exists a pol(||Σ||+||q||)-parsimonious quasi with m ≤ pol(||Σ||+||q||), that is a prefix of a chase deriva- chase derivation with total applications (Ii)0≤i≤n, where tion of D w.r.t. Σ, and c¯ ∈ q(Km), as needed. n ≥ 0, of D w.r.t. Σ such that c¯ ∈ q(I ). n OQA via Parsimonious Quasi Chase Derivations Let k = pol(||Σ|| + ||q||). It is clear that (1) implies (2) We now show that in the case of the class L[S], for a schema since a prefix of a chase derivation of length k of D w.r.t. Σ S, the fact that a tuple is a certain answer can be witnessed is by definition a k-parsimonious quasi chase derivation of via a k-parsimonious quasi chase derivation, where k de- D w.r.t. Σ. The other direction, however, is not immediate pends polynomially on the cardinality of the set of TGDs Σ, since a k-parsimonious quasi chase derivation δ of D w.r.t. Σ the cardinality of the schema S, and the number of atoms in with total applications is not necessarily a prefix of length at the CQ q, and exponentially on ar(S). This in turn implies most k of a chase derivation of D w.r.t. Σ since triggers may that in the case of a schema of fixed arity, k is a polynomial repeat. Thus, if we could eliminate from δ the repeated trig- (step 2 above). More precisely, assuming that gers, without introducing more repetitions of triggers, then ar(S) we will end up with a finite prefix of a chase derivation of D T = |Σ| · |S| · 2 · |q| · ar(S) + ar(S) , w.r.t. Σ of length at most k, which in turn implies the PWP. q,Σ This can be achieved via iterative contractions. we can show the following result: Assume that a trigger (σ, h) has been applied at steps i, j, Proposition 14 Consider a database D, a set Σ ∈ L[S], a for i < j, with H and H being the set of atoms generated i j CQ , and |x¯|. If , then there is a at the i-th and j-th step, respectively. The key observation is q(¯x) c¯ ∈ C c¯ ∈ cert(q, D, Σ) Tq,Σ-parsimonious quasi chase derivation with total appli- that Hi 'S Hj, where S = dom(Hi) ∩ dom(Hj). Due to cations (Ji)0≤i≤n of D w.r.t. Σ such that c¯ ∈ q(Jn). linearity, we can safely move the subtrees rooted at Hj un- der the corresponding atoms of Hi, and consistently update To establish the above result it suffices to show that the the atoms, without introducing more repetitions of triggers. prefix (Ii)0≤i≤n of some chase derivation of D w.r.t. Σ that −1 This is essentially what the (Hj, µ )-contraction of δ does, witnesses the fact that c¯ ∈ cert(q, D, Σ), i.e., c¯ ∈ q(In), can with µ being the S-isomorphism from Hi to Hj. This is for- be converted into a Tq,Σ-parsimonious quasi chase deriva- malized by the following technical lemma. For a quasi chase tion with total applications (Ji)0≤i≤n of D w.r.t. Σ such that i derivation δ = (Ii)0≤i≤n with Iihσi, hiiIi+1, we write Hδ c¯ ∈ q(Jn). We can rely again on iterative contractions. for the set of atoms generated at the i-th step, i.e., the set Consider two S-isomorphic atoms α and β of In, where 0 0 of atoms hi(head(σi)), where hi is the extension of hi em- S is the set of terms occurring in h(q(¯c)) with h being a ho- ployed during the trigger application Iihσi, hiiIi+1. momorphism that maps q(¯c) to In. Due to linearity, we can

452 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track safely move the subtree rooted at β under α, and consistently Since in δ0 only canonical atoms trigger TGDs (the first update its atoms, without affecting the fact that c¯ is a certain property of δ stated above, which is inherited by δ0), it suf- answer. We can achieve this via the (β, µ−1)-contraction of fices to count how many triggers for Σ on the instance 4 (Ii)0≤i≤n, with µ being the S-isomorphism from α to β. Notice, however, that such a contraction may create partial K = {α | α is the canonical atom of a set C ∈ Jn/'S} applications and repeated triggers. Hence, the result is not can be formed. We can assume, w.l.o.g. due to linearity, that necessarily a prefix of a chase derivation, but a quasi chase in δ0 at most |q| atoms from D trigger a TGD of Σ, which derivation. This is formalized by the following lemma. implies that K contains at most |q| atoms of D. Therefore, ar(S) Lemma 15 Consider a database D, Σ ∈ L, a CQ q(¯x), and |K| ≤ |S|·2·|q|·ar(S)+ar(S) , which is the number of |x¯| + c¯ ∈ C . Let δ = (Ii)0≤i≤n be a quasi chase derivation of non-S -isomorphic atoms over S that can be formed, where + D w.r.t. Σ such that q(¯c) → In via h. For atoms α, β ∈ In S consists of the set S, and the set of constants T occurring p,+ such that β 6≺δ α, and α 'S β, where S = dom(h(q(¯c))), in the atoms of D that trigger a TGD. Actually, the above −1 let δα,β = (Ji)0≤i≤n be the (β, µ )-contraction of δ, with upper bound is a consequence of the fact that |S| ≤ |q|·ar(S) µ being the S-isomorphism from α to β. Then: and |T | ≤ |q| · ar(S). Since each atom of K can trigger several TGDs of Σ, the total number of triggers for Σ on K 1. δα,β is a quasi chase derivation of D w.r.t. Σ. that can be formed is Tq,Σ, and Proposition 14 follows. p,+ 2. There is no γ ∈ Jn such that β ≺ γ. δα,β Theorem 11 follows from Propositions 12 and 14. 0 0 0 3. For each γ, γ ∈ Jn, γ 'S γ iff µ(γ) 'S µ(γ ). 4. q(¯c) → Jn via h. 5 Polynomial Combined Rewritability We can now explain how Proposition 14 is shown. By hy- We now turn our attention to the notion of polynomial com- pothesis, there exists a prefix δ = (Ii)0≤i≤n, for n ≥ 0, of bined first-order rewritability. A database rewriter is a func- a chase derivation of D w.r.t. Σ such that q(¯c) → In via a tion that receives as input a database and a set of TGDs, and homomorphism h. By definition, δ is a quasi chase deriva- outputs a database. A query rewriter is a function that takes tion of D w.r.t. Σ. The binary relation 'S over In, where a CQ and a set of TGDs, and outputs a first-order query. S = dom(h(q(¯c))), is an equivalence relation. Let In/'S Definition 16 A class C ⊆ TGD of TGDs is polynomially be the set of all equivalence classes in In w.r.t. 'S. For each combined first-order rewritable if there are polynomial time equivalence class C in In/'S, its canonical atom is arbitrar- computable database and query rewriters f and f , re- ily chosen from the set of atoms {α ∈ C | there is no β ∈ DB Q p,+ spectively, such that the following holds: for every database C such that β ≺δ α}. For an atom α ∈ In, we write [α] D, set Σ ∈ C of TGDs, and CQ q, cert(q, D, Σ) = qΣ(DΣ) for the canonical atom of its equivalence class, and ια for the with DΣ = fDB(D, Σ) and qΣ = fQ(q, Σ). We also say that S-isomorphism that maps [α] to α. We proceed to construct C is polynomially combined first-order rewritable targeting + + a Tq,Σ-parsimonious quasi chase derivation with total appli- existential positive queries (∃FO ) if qΣ is an ∃FO query. 0 cations δ = (Ji)0≤i≤n of D w.r.t. Σ such that c¯ ∈ q(Jn)). −1 For a fixed schema S, G1[S] is polynomially combined Let α ∈ In with α 6= [α]. By Lemma 15, the (α, ια )- α first-order rewritable targeting ∃FO+ (Gottlob, Manna, and contraction δα = (Ii )0≤i≤n of δ enjoys the following: Pieris 2014). This carries over to multi-head TGDs: - δ is a quasi chase derivation of D w.r.t. Σ. α G p,+ Theorem 17 For a fixed schema S, [S] is polynomially - There is no β ∈ Jn such that α ≺ β. + δα combined first-order rewritable targeting ∃FO . 0 0 0 - For each β, β ∈ Jn, β 'S β iff µ(β) 'S µ(β ). Interestingly, the above result can be obtained by exploit- - q(¯c) → Jn via h. ing the machinery introduced in the previous section. In par- We can therefore iteratively apply Lemma 15 as discussed ticular, Theorem 11, and the fact that every class of TGDs   that enjoys the PWP is polynomially combined first-order above, until we get a quasi chase derivation δ = (Ii )0≤i≤n + of D w.r.t. Σ such that the following hold: rewritable targeting ∃FO (Gottlob et al. 2014), imply that: L α ∈ I α 6= [α] β ∈ I Theorem 18 For a schema S of fixed arity, [S] is polyno- 1. For each n, implies there is no n such + that α ≺δ β. mially combined first-order rewritable targeting ∃FO .  2. q(¯c) → In via h. The above result, and the polynomial time reduction from OQA(G[S]) to OQA(L[S0]) with ar(S) = ar(S0) provided Note that δ is not necessarily with total applications. How- by Lemma 8, allow us to establish Theorem 17. ever, it can be converted into one with total applications by simply adding the atoms that are needed in order to ensure  0 6 Conclusions that every application in δ is total. Let δ = (Ji)0≤i≤n be the resulted quasi chase derivation with total applications In this work, we closed a gap in the analysis of ontology- of D w.r.t. Σ. It is clear that q(¯c) → Jn via h, and thus based query answering for guarded TGDs in the case of fixed 0 c¯ ∈ q(In). It remains to show that δ is Tq,Σ-parsimonious. schemas. In particular, we proved that the problem is NP- complete, and polynomially combined first-order rewritable, 4For a singleton instance {γ} we simply write γ. even if we consider multi-head guarded TGDs.

453 Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning (KR 2020) Main Track

Acknowledgments Gottlob is a Royal Society Research Professor and acknowl- edges support by the Royal Society for the present work in the context of the project ”RAISON DATA” (project ref- erence: RP/R1/201074). Manna has been partially sup- ported by MISE under the project “S2BDW” (F/050389/01- 03/X32) - Horizon 2020 PON I&C2014-20 and by Re- gione Calabria under the project “DLV LargeScale” (CUP J28C17000220006) - POR Calabria 2014-20. Pieris was supported by the EPSRC grant EP/S003800/1 “EQUID”. References Andreka,´ H.; van Benthem, J.; and Nemeti,´ I. 1998. Modal languages and bounded fragments of predicate logic. J. Philosophical Logic 27:217–274. Arenas, M.; Gottlob, G.; and Pieris, A. 2018. Expres- sive languages for querying the semantic web. ACM Trans. Database Syst. 43(3):13:1–13:45. Baader, F.; Horrocks, I.; Lutz, C.; and Sattler, U. 2017. An Introduction to Description Logic. Cambridge University Press. Baget, J.-F.; Leclere,` M.; Mugnier, M.-L.; and Salvat, E. 2011. On rules with existential variables: Walking the de- cidability line. Artif. Intell. 175(9-10):1620–1654. Bar´ any,´ V.; Benedikt, M.; and ten Cate, B. 2013. Rewriting guarded negation queries. In MFCS, 98–110. Benedikt, M. 2018. Personal Communication. Cal`ı, A.; Gottlob, G.; Lukasiewicz, T.; Marnette, B.; and Pieris, A. 2010. Datalog+/-: A family of logical knowledge representation and query languages for new applications. In LICS, 228–242. Cal`ı, A.; Gottlob, G.; and Kifer, M. 2013. Taming the in- finite chase: Query answering under expressive relational constraints. J. Artif. Intell. Res. 48:115–174. Cal`ı, A.; Gottlob, G.; and Lukasiewicz, T. 2012. A gen- eral Datalog-based framework for tractable query answering over ontologies. J. Web Sem. 14:57–83. Gottlob, G.; Kikot, S.; Kontchakov, R.; Podolskii, V. V.; Schwentick, T.; and Zakharyaschev, M. 2014. The price of query rewriting in ontology-based data access. Artif. Intell. 213:42–59. Gottlob, G.; Manna, M.; and Pieris, A. 2014. Polynomial combined rewritings for existential rules. In KR. Gottlob, G.; Rudolph, S.; and Simkus, M. 2014. Expres- siveness of guarded existential rule languages. In PODS, 27–38. Lutz, C.; Toman, D.; and Wolter, F. 2009. Conjunctive query answering in the description logic EL using a rela- tional database system. In IJCAI, 2070–2075.

454