arXiv is now an independent nonprofit! Learn more
License: CC BY 4.0
arXiv:2608.04945v1 [cs.DB] 05 Aug 2026
11institutetext: 1LIRMM, Inria, University of Montpellier, CNRS, Montpellier, France
2DI ENS, ENS, CNRS, PSL University & Inria, France

A General Sufficient Condition for Rewriting Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} Atomic Queries into GQL

David Carral    Calixte Gruson    and Quentin Manière
Abstract

The emergence of the ISO standard GQL introduces a powerful query language extending first-order logic with controlled recursion, raising the question of its applicability to evaluation of ontology-mediated queries (OMQs). We focus on OMQs consisting of atomic queries over ontologies expressed in Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI}, an expressive Description Logic that is not, in general, first-order rewritable. To address this, we introduce DL automata, a novel formalism that captures the semantics of such OMQs via runs over fact sets. We then identify a large class of DL automata that can be rewritten into unions of conjunctive two-way regular path queries (UC2RPQs), a central fragment of GQL. Our class of automata relies on a stratification of their states, ruling out specific forms of cyclic dependencies known to raise the complexity. This yields a broad class of Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} OMQs that are GQL-rewritable.

1 Introduction

In ontology-mediated query answering, user queries are enriched with conceptual knowledge about the domain of interest, described in the form of an ontology. This conceptual layer enables the use of a more user-friendly vocabulary and supports the retrieval of implicit information derived from the explicit knowledge in the ontology, thereby enriching query answers. Description Logics (DLs) are a predominant formalism for representing ontologies [3]. They provide the logical foundations of the OWL web ontology language, a W3C-standardized language for the Semantic Web [13]. In this work, we focus on the DL Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI}, an expressive language that allows the use of inverse roles and role constructors; the following example illustrates its usefulness.

Example 1

Consider the set 𝒯\mathcal{T} of Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} axioms111In the literature, DL axioms are often presented using a dedicated syntax [17]; we use equivalent first-order formulas, which are more familiar to a broader audience. given below, which formalises the notion of a 𝚃𝚛𝚞𝚜𝚝\mathtt{Trust}ed user in a computer network.

∀x,y.\displaystyle\forall x,y. 𝙻𝚒𝚗𝚔​(x,y)∧𝚂𝚎𝚗𝚜​(y)→𝚂𝚎𝚗𝚜​(x)\displaystyle\mathtt{Link}(x,y)\wedge\mathtt{Sens}(y)\to\mathtt{Sens}(x) ∀x.\displaystyle\forall x. 𝙶𝚊𝚝𝚎​(x)→∃y.𝙻𝚒𝚗𝚔​(x,y)∧𝙾𝚗𝚕​(y)\displaystyle\mathtt{Gate}(x)\to\exists y.\mathtt{Link}(x,y)\wedge\mathtt{Onl}(y)
∀x,y.\displaystyle\forall x,y. 𝙻𝚒𝚗𝚔​(x,y)∧𝙾𝚗𝚕​(y)→𝙾𝚗𝚕​(x)\displaystyle\mathtt{Link}(x,y)\wedge\mathtt{Onl}(y)\to\mathtt{Onl}(x) ∀x,y.\displaystyle\forall x,y. 𝙲𝚛𝚒𝚝​(x)∧𝙰𝚌𝚌​(x,y)→𝚃𝚛𝚞𝚜𝚝​(y)\displaystyle\mathtt{Crit}(x)\wedge\mathtt{Acc}(x,y)\to\mathtt{Trust}(y)
∀x.\displaystyle\forall x. 𝚂𝚎𝚗𝚜​(x)∧𝙾𝚗𝚕​(x)→𝙲𝚛𝚒𝚝​(x)\displaystyle\mathtt{Sens}(x)\wedge\mathtt{Onl}(x)\to\mathtt{Crit}(x)

Furthermore, consider the fact set ℱ\mathcal{F}, defined below and illustrated in Figure˜1.

{\displaystyle\{ 𝙰𝚌𝚌​(c1,alice),𝙻𝚒𝚗𝚔​(c1,c2),𝚂𝚎𝚗𝚜​(c3),𝙻𝚒𝚗𝚔​(c1,c4),𝙻𝚒𝚗𝚔​(c2,c3),\displaystyle\mathtt{Acc}(c_{1},\textit{alice}),\mathtt{Link}(c_{1},c_{2}),\mathtt{Sens}(c_{3}),\mathtt{Link}(c_{1},c_{4}),\mathtt{Link}(c_{2},c_{3}),
𝙶𝚊𝚝𝚎(c4),𝙰𝚌𝚌(c5,bob),𝙻𝚒𝚗𝚔(c5,c4),𝙻𝚒𝚗𝚔(c5,c6),𝙻𝚒𝚗𝚔(c6,c7),𝙾𝚗𝚕(c7)}\displaystyle\mathtt{Gate}(c_{4}),\mathtt{Acc}(c_{5},\textit{bob}),\mathtt{Link}(c_{5},c_{4}),\mathtt{Link}(c_{5},c_{6}),\mathtt{Link}(c_{6},c_{7}),\mathtt{Onl}(c_{7})\}

The Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} ontology ⟨𝒯,ℱ⟩\langle\mathcal{T},\mathcal{F}\rangle entails the fact 𝙲𝚛𝚒𝚝​(c1)\mathtt{Crit}(c_{1}): indeed, node c1c_{1} has a 𝙻𝚒𝚗𝚔\mathtt{Link} path to a 𝚂𝚎𝚗𝚜\mathtt{Sens}itive node and another such path to a 𝙶𝚊𝚝𝚎\mathtt{Gate}way node (see Figure˜1); moreover, by the second axiom of 𝒯\mathcal{T}, every 𝙶𝚊𝚝𝚎\mathtt{Gate}way node has a 𝙻𝚒𝚗𝚔\mathtt{Link} to some 𝙾𝚗𝚕\mathtt{Onl}ine node. Therefore, the ontology also entails 𝚃𝚛𝚞𝚜𝚝​(alice)\mathtt{Trust}(\textit{alice}).

𝚃𝚛𝚞𝚜𝚝:alice\color[rgb]{0.2734375,0.51171875,0.70703125}\definecolor[named]{pgfstrokecolor}{rgb}{0.2734375,0.51171875,0.70703125}\mathtt{Trust}\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}:\textit{alice}c1:𝙲𝚛𝚒𝚝c_{1}:\color[rgb]{0.2734375,0.51171875,0.70703125}\definecolor[named]{pgfstrokecolor}{rgb}{0.2734375,0.51171875,0.70703125}\mathtt{Crit}c2c_{2}c3:𝚂𝚎𝚗𝚜c_{3}:\mathtt{Sens}c4:𝙶𝚊𝚝𝚎c_{4}:\mathtt{Gate}bobc5c_{5}c6c_{6}c7:𝙾𝚗𝚕c_{7}:\mathtt{Onl}𝙰𝚌𝚌\mathtt{Acc}𝙻𝚒𝚗𝚔\mathtt{Link}𝙻𝚒𝚗𝚔\mathtt{Link}𝙻𝚒𝚗𝚔\mathtt{Link}𝙰𝚌𝚌\mathtt{Acc}𝙻𝚒𝚗𝚔\mathtt{Link}𝙻𝚒𝚗𝚔\mathtt{Link}𝙻𝚒𝚗𝚔\mathtt{Link}
Figure 1: The fact set ℱ\mathcal{F} (depicted in black), together with some of the unary facts entailed by the ontology ⟨𝒯,ℱ⟩\langle\mathcal{T},\mathcal{F}\rangle (depicted in blue), defined in Example˜1.

In the presence of DL axioms, a central reasoning task is to decide whether a given unary fact is entailed; together with the axioms, such a query forms a rule query. A common approach to evaluating a rule query over a database is to rewrite it into a classical query language, typically an FO query, while preserving equivalence, that is, ensuring that the original rule query and its rewriting are entailed by the same fact sets. This approach requires a target query language that is expressive enough to capture the ontological knowledge encoded in the axioms, but it also allows one to reuse existing database technologies, thereby avoiding the need to develop new evaluation tools.

The recently released ISO standard GQL,222https://www.iso.org/standard/76120.html for graph query languages, extends the expressive power of traditional FO queries (as captured by the SQL standard) by allowing controlled forms of regular recursion. GQL can express conjunctions of two-way regular path queries and their unions (UC2RPQs), and the evaluation problem for queries at its core has been shown to be NL-complete [7, 11]. As a new standard, GQL is expected to play a central role in a wide range of applications, making it important to understand which rule queries can be rewritten into this language. Example 2 presents an equivalent rewriting into UC2RPQs, and hence into GQL, of a rule query based on Example 1.

Example 2

Consider the Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} query ⟨𝒯,𝚃𝚛𝚞𝚜𝚝​(alice)⟩\langle\mathcal{T},\mathtt{Trust}(\textit{alice})\rangle, where 𝒯\mathcal{T} is the set of DL axioms described in Example˜1. This query is equivalent to the following positive conjunctive regular path query:

qalice𝚃𝚄=𝚃𝚛𝚞𝚜𝚝​(alice)∨∃y.[𝙰𝚌𝚌​(y,alice)∧𝙲𝚛𝚒𝚝​(y)]∨\displaystyle q_{\textit{alice}}^{\mathtt{TU}}=\mathtt{Trust}(\textit{alice})\vee\exists y.\Big[\mathtt{Acc}(y,\textit{alice})\wedge\mathtt{Crit}(y)\Big]~\vee
∃y,z,w.[𝙰𝚌𝚌​(y,alice)∧𝙻𝚒𝚗𝚔∗​(y,z)∧𝚂𝚎𝚗𝚜​(z)∧𝙻𝚒𝚗𝚔∗​(y,w)∧(𝙾𝚗𝚕​(w)∨𝙶𝚊𝚝𝚎​(w))]\displaystyle~~\exists y,z,w.\Big[\mathtt{Acc}(y,\textit{alice})\wedge\mathtt{Link}^{*}(y,z)\wedge\mathtt{Sens}(z)\wedge\mathtt{Link}^{*}(y,w)\wedge\big(\mathtt{Onl}(w)\vee\mathtt{Gate}(w)\big)\Big]

That is, these two boolean queries induce the same partition over the set of all fact sets. Put differently, for any given fact set ℱ′\mathcal{F}^{\prime}, the DL ontology ⟨𝒯,ℱ′⟩\langle\mathcal{T},\mathcal{F}^{\prime}\rangle entails the fact 𝚃𝚛𝚞𝚜𝚝​(alice)\mathtt{Trust}(\textit{alice}) if and only if ℱ′\mathcal{F}^{\prime} satisfies the query qalice𝚃𝚄q_{\textit{alice}}^{\mathtt{TU}}. Consequently, instead of verifying whether ⟨𝒯,ℱ′⟩\langle\mathcal{T},\mathcal{F}^{\prime}\rangle entails 𝚃𝚛𝚞𝚜𝚝​(alice)\mathtt{Trust}(\textit{alice}) using a dedicated DL reasoner, we may simply check whether ℱ′\mathcal{F}^{\prime} satisfies qalice𝚃𝚄q_{\textit{alice}}^{\mathtt{TU}} using a database management system. To conclude the example, observe that the fact set ℱ\mathcal{F} from Example˜1 satisfies qalice𝚃𝚄q_{\textit{alice}}^{\mathtt{TU}}, as expected, since ⟨𝒯,ℱ⟩\langle\mathcal{T},\mathcal{F}\rangle does entail 𝚃𝚛𝚞𝚜𝚝​(alice)\mathtt{Trust}(\textit{alice}). Moreover, the rule query ⟨𝒯,𝚃𝚛𝚞𝚜𝚝​(alice)⟩\langle\mathcal{T},\mathtt{Trust}(\textit{alice})\rangle is not expressible as an FO query, thereby motivating the need for rewriting techniques that go beyond this limited database query language.

Contributions.

We focus on rule queries with unary facts such as the one in the previous example, with rules expressed in the positive fragment of Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} DL, defined in Section˜2. We show that these rules can be normalised into Datalog ones, in Section˜3. We then identify a large class of rule queries that can be rewritten into GQL; we proceed in two main steps. First, in Section˜4, we turn our rule queries into equivalent automata of a new form, closely related to the usual tree automata and which we refer to as DL automata. Second, in Section˜5, we identify a class of DL automata that can be rewritten into positive two-way regular path queries (PQs), and thus into UC2RPQs which in turn fall within GQL (Section˜6). Our criteria for rewritability relies on the existence of a stratification of the DL automata, which forbids some (but not all!) cyclic dependencies within its transition function. Interestingly, rule queries based upon the DL-Lite family trivially enjoy stratified automata, and thus the class we pinpoint extends DL-Lite. Additionally, our class guarantees the rewritability of rule queries that were not covered by prior attempts at rewriting into GQL [18], such as the one from Example˜2. Section˜7 elaborates further on related work; we discuss our conclusions and future work in Section˜8. This extended version of a paper to appear at ISWC 2026 contains proofs for all results in the appendix.

2 Preliminaries

We assume that the reader is familiar with the syntax and semantics of first-order (FO) logic, as well as with basic notions from automata theory.

Existential Rules and FO Facts.

We fix pairwise disjoint, countably infinite sets 𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathsf{Classes}, 𝖱𝗈𝗅𝖾𝗌\mathsf{Roles}, 𝖢𝗈𝗇𝗌\mathsf{Cons}, and 𝖵𝖺𝗋𝗌\mathsf{Vars} of unary predicates, binary predicates, constants, and variables respectively. We often refer to unary and binary predicates as classes and roles, respectively. An inverse role is an element of 𝖨𝗇𝗏𝖱𝗈𝗅𝖾𝗌={𝚁−∣𝚁∈𝖱𝗈𝗅𝖾𝗌}\mathsf{InvRoles}=\{\mathtt{R}^{-}\mid\mathtt{R}\in\mathsf{Roles}\}. A role expression is an element of 𝖱𝗈𝗅𝖾𝖤𝗑𝗉𝗌=𝖱𝗈𝗅𝖾𝗌∪𝖨𝗇𝗏𝖱𝗈𝗅𝖾𝗌\mathsf{RoleExps}=\mathsf{Roles}\cup\mathsf{InvRoles}. A term is an element of 𝖳𝖾𝗋𝗆𝗌=𝖢𝗈𝗇𝗌∪𝖵𝖺𝗋𝗌\mathsf{Terms}=\mathsf{Cons}\cup\mathsf{Vars}. Lists of terms t1,…,tnt_{1},\ldots,t_{n} are written as t→\vec{t} and are often treated as sets.

A class atom is a formula of the form 𝙲​(t)\mathtt{C}(t) with 𝙲∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}\in\mathsf{Classes} and t∈𝖳𝖾𝗋𝗆𝗌t\in\mathsf{Terms}. A role atom is a formula of the form 𝚁​(t,u)\mathtt{R}(t,u) with 𝚁∈𝖱𝗈𝗅𝖾𝗌\mathtt{R}\in\mathsf{Roles} and t,u∈𝖳𝖾𝗋𝗆𝗌t,u\in\mathsf{Terms}. A FO atom is either a class atom or a role atom. Class facts, role facts, and FO facts are variable-free class atoms, role atoms, and FO atoms, respectively.

For an FO formula ψ\psi and a list x→\vec{x} of variables, we write ψ​[x→]\psi[\vec{x}] to indicate that x→\vec{x} is the set of all free variables in ψ\psi. An (existential) rule ϱ\varrho is a FO sentence of the form ∀x→,y→.(β[x→]→∃z→.η[y→,z→])\forall\vec{x},\vec{y}.\big(\beta[\vec{x}]\rightarrow\exists\vec{z}.\eta[\vec{y},\vec{z}]\big) where x→\vec{x}, y→\vec{y}, and z→\vec{z} are lists of variables such that (x→∪y→)∩z→=∅(\vec{x}\cup\vec{y})\cap\vec{z}=\emptyset, and β\beta and η\eta are conjunctions of FO atoms with η≠∅\eta\neq\emptyset.

The rule ϱ\varrho is Datalog if z→\vec{z} is the empty list. We refer to β\beta and ∃z→.η\exists\vec{z}.\eta as the body and the head of ϱ\varrho, respectively. When discussing rules, we omit universal quantifiers and often identify conjunctions of atoms such as β\beta and η\eta above with the corresponding set. We allow rules to contain unsafe variables–universally quantified variables that appear in the head but not in the body of the rule. A knowledge base (KB) is a pair consisting of a finite rule set and a finite fact set.

Description Logics.

A (positive) Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rule is one of the following rules:

𝙰1​(x)∧…∧𝙰n​(x)\displaystyle\mathtt{A}_{1}(x)\wedge\ldots\wedge\mathtt{A}_{n}(x) →𝙱​(x)\displaystyle\to\mathtt{B}(x) 𝙰1⊓…⊓𝙰n\displaystyle\mathtt{A}_{1}\sqcap\ldots\sqcap\mathtt{A}_{n} ⊑𝙱\displaystyle\sqsubseteq\mathtt{B} (1)
𝚁​(x,y)∧𝙰​(y)\displaystyle\mathtt{R}(x,y)\wedge\mathtt{A}(y) →𝙱​(x)\displaystyle\to\mathtt{B}(x) ∃𝚁.𝙰\displaystyle\exists\mathtt{R}.\mathtt{A} ⊑𝙱\displaystyle\sqsubseteq\mathtt{B} (2)
𝙰​(x)∧𝚁​(x,y)\displaystyle\mathtt{A}(x)\wedge\mathtt{R}(x,y) →𝙱​(y)\displaystyle\to\mathtt{B}(y) 𝙰\displaystyle\mathtt{A} ⊑∀𝚁.𝙱\displaystyle\sqsubseteq\forall\mathtt{R}.\mathtt{B} (3)
→𝙱​(x)\displaystyle\to\mathtt{B}(x) ⊤\displaystyle\top ⊑𝙱\displaystyle\sqsubseteq\mathtt{B} (4)
𝙰​(x)\displaystyle\mathtt{A}(x) →∃y.𝚁​(x,y)∧𝙱​(y)\displaystyle\to\exists y.\mathtt{R}(x,y)\wedge\mathtt{B}(y) 𝙰\displaystyle\mathtt{A} ⊑∃𝚁.𝙱\displaystyle\sqsubseteq\exists\mathtt{R}.\mathtt{B} (5)
𝚁​(x,y)\displaystyle\mathtt{R}(x,y) →𝚂​(x,y)\displaystyle\to\mathtt{S}(x,y) 𝚁\displaystyle\mathtt{R} ⊑𝚂\displaystyle\sqsubseteq\mathtt{S} (6)
𝚁​(y,x)\displaystyle\mathtt{R}(y,x) →𝚂​(x,y)\displaystyle\to\mathtt{S}(x,y) 𝚁−\displaystyle\mathtt{R}^{-} ⊑𝚂\displaystyle\sqsubseteq\mathtt{S} (7)

Here, 𝙰\mathtt{A}, 𝙱\mathtt{B}, and 𝙲\mathtt{C} are classes, and 𝚁\mathtt{R} and 𝚂\mathtt{S} are roles. We restrict ourselves to the positive fragment of Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI}, in which the bottom class ⊥\bot is not allowed; in Section˜8, we discuss how our rewriting techniques could be adapted to handle this class. We consider Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rules in a restricted normal form, which is without loss of generality [16]. The right-hand side shows the corresponding Description Logic syntax, included for reference only and not used further in this paper. We adopt the rule-based presentation because rules are FO logic formulas and are therefore accessible to a wider audience, and because this syntax allows us to define fact entailment for Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} naturally via the well-known chase procedure, which we briefly present below. We consider entailment under active domain semantics as discussed later, and hence rules of type (4) are not domain-dependent. A Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} KB is a KB whose rule set is Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI}.

Query Languages.

In this paper, a rule query is a pair consisting of a finite rule set and a class fact. A Datalog query is a rule query whose rule set is Datalog. A Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} query is a rule query whose rule set is Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI}.

A regular expression is an expression generated by the grammar

𝔈::=ε∣𝚁∣𝚁−∣(𝔈∪𝔈)∣(𝔈⋅𝔈)∣(𝔈)∗,\mathfrak{E}::=\varepsilon\mid\mathtt{R}\mid\mathtt{R}^{-}\mid\big(\mathfrak{E}\cup\mathfrak{E}\big)\mid\big(\mathfrak{E}\cdot\mathfrak{E}\big)\mid\big(\mathfrak{E}\big)^{*},

where 𝚁∈𝖱𝗈𝗅𝖾𝗌\mathtt{R}\in\mathsf{Roles}. For a regular expression 𝔈\mathfrak{E}, let 𝐋𝐚𝐧𝐠​(𝔈)\mathbf{Lang}(\mathfrak{E}) denote the set of all words over role expressions generated by 𝔈\mathfrak{E}. A RE atom is a formula of the form 𝔈​(t,u)\mathfrak{E}(t,u) with 𝔈\mathfrak{E} a regular expression and t,u∈𝖳𝖾𝗋𝗆𝗌t,u\in\mathsf{Terms}. A RE fact is a variable-free RE atom. A positive two-way regular path query (PQ) is a formula without occurrences of free variables generated by the grammar

φ::=⊤∣𝙰(t)∣𝔈(t,u)∣(φ∧φ)∣(φ∨φ)∣∃y.φ,\varphi::=\top\mid\mathtt{A}(t)\mid\mathfrak{E}(t,u)\mid\big(\varphi\wedge\varphi\big)\mid\big(\varphi\vee\varphi\big)\mid\exists y.\varphi,

where 𝙰​(t)\mathtt{A}(t) is a class atom, 𝔈​(t,u)\mathfrak{E}(t,u) is a RE atom, and yy is a variable. Note that, under our definition, all PQs are Boolean queries since every occurrence of a variable in a PQ lies within the scope of an existential quantifier. Without loss of generality, we assume that every variable is quantified exactly once in a PQ.

Semantics.

Consider some FO sentence ψ\psi. Given another FO sentence ψ′\psi^{\prime}, we write ψ⊧ψ′\psi\models\psi^{\prime} to denote entailment under under active domain semantics, that is, standard FO semantics with quantifiers ranging over the active domain. Given a finite set SS\SS of FO sentences, we write SS⊧ψ\SS\models\psi to denote ⋀ψ′∈SSψ′⊧ψ\bigwedge_{\psi^{\prime}\in\SS}\psi^{\prime}\models\psi. Given a KB ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle, we write ⟨ℛ,ℱ⟩⊧ψ\langle\mathcal{R},\mathcal{F}\rangle\models\psi to denote ℛ∪ℱ⊧ψ\mathcal{R}\cup\mathcal{F}\models\psi.

A substitution is a function mapping variables to terms. For a substitution σ\sigma and a FO formula ψ​[x→]\psi[\vec{x}], let σ​(ψ)\sigma(\psi) denote the formula obtained from ψ\psi by replacing all occurrences of every variable x∈𝐃𝐨𝐦𝐚𝐢𝐧​(σ)∩x→x\in\mathbf{Domain}(\sigma)\cap\vec{x} with σ​(x)\sigma(x).

Consider a fact set ℱ\mathcal{F}. We define 𝐈𝐧𝐯​(ℱ)={𝚁−​(c,d)∣𝚁​(d,c)∈ℱ}\mathbf{Inv}(\mathcal{F})=\{\mathtt{R}^{-}(c,d)\mid\mathtt{R}(d,c)\in\mathcal{F}\}. A (possibly empty) word over role expressions 𝚁𝟷​…​𝚁𝚗\mathtt{R_{1}}\ldots\mathtt{R_{n}} is a path from a constant cc to a constant dd in ℱ\mathcal{F} if both cc and dd occur in ℱ\mathcal{F}, and there exists a list of constants e0,…,ene_{0},\ldots,e_{n} such that e0=ce_{0}=c, en=de_{n}=d, and 𝚁𝚒​(ei−1,ei)∈ℱ∪𝐈𝐧𝐯​(ℱ)\mathtt{R_{i}}(e_{i-1},e_{i})\in\mathcal{F}\cup\mathbf{Inv}(\mathcal{F}) for every 1≤i≤n1\leq i\leq n. In particular, for n=0n=0, the empty word ε\varepsilon is a path from any constant occuring in ℱ\mathcal{F} to itself. For some constants cc and dd occurring ℱ\mathcal{F}, we write 𝐏𝐚𝐭𝐡𝐬ℱ​(c,d)\mathbf{Paths}_{\mathcal{F}}(c,d) for the set of all paths from cc to dd in ℱ\mathcal{F}. Entailment of a PQ φ\varphi by ℱ\mathcal{F}, written ℱ⊧φ\mathcal{F}\models\varphi, is defined inductively as follows:

  • •

    If φ=⊤\varphi=\top, then ℱ⊧φ\mathcal{F}\models\varphi.

  • •

    If φ\varphi is a class fact, then ℱ⊧φ\mathcal{F}\models\varphi if φ∈ℱ\varphi\in\mathcal{F}.

  • •

    If φ\varphi is a RE fact 𝔈​(c,d)\mathfrak{E}(c,d), then ℱ⊧φ\mathcal{F}\models\varphi if 𝐏𝐚𝐭𝐡𝐬ℱ​(c,d)∩𝐋𝐚𝐧𝐠​(𝔈)≠∅\mathbf{Paths}_{\mathcal{F}}(c,d)\cap\mathbf{Lang}(\mathfrak{E})\neq\emptyset.

  • •

    If φ\varphi is of the form (φ1∧φ2)\big(\varphi_{1}\wedge\varphi_{2}\big), then ℱ⊧φ\mathcal{F}\models\varphi if ℱ⊧φ1\mathcal{F}\models\varphi_{1} and ℱ⊧φ2\mathcal{F}\models\varphi_{2}.

  • •

    If φ\varphi is of the form (φ1∨φ2)\big(\varphi_{1}\vee\varphi_{2}\big), then ℱ⊧φ\mathcal{F}\models\varphi if ℱ⊧φ1\mathcal{F}\models\varphi_{1} or ℱ⊧φ2\mathcal{F}\models\varphi_{2}.

  • •

    If φ\varphi is of the form ∃x.φ′\exists x.\varphi^{\prime}, then ℱ⊧φ\mathcal{F}\models\varphi if ℱ⊧σ​(φ′)\mathcal{F}\models\sigma(\varphi^{\prime}) for some substitution σ\sigma mapping xx to some constant in ℱ\mathcal{F}.

Since PQs contain no free variables, defining ℱ⊧α\mathcal{F}\models\alpha for any ground atom α\alpha suffices to fully specify the semantics of entailment.

For a rule query ⟨ℛ,α⟩\langle\mathcal{R},\alpha\rangle, we write 𝐐𝐌​(⟨ℛ,α⟩)\mathbf{QM}(\langle\mathcal{R},\alpha\rangle) or 𝐐𝐌​(ℛ,α)\mathbf{QM}(\mathcal{R},\alpha) to refer to the set of all finite fact sets ℱ\mathcal{F} such that ⟨ℛ,ℱ⟩⊧α\langle\mathcal{R},\mathcal{F}\rangle\models\alpha. For a PQ φ\varphi, let 𝐐𝐌​(φ)\mathbf{QM}(\varphi) be the set of all finite fact sets that entail φ\varphi. Here, 𝐐𝐌\mathbf{QM} stands for “query mapping”, since it associates every rule query or PQ with its semantic extension, namely the set of finite fact sets that satisfy it. A rule query or PQ γ\gamma is contained in another such query γ′\gamma^{\prime} if 𝐐𝐌​(γ)⊆𝐐𝐌​(γ′)\mathbf{QM}(\gamma)\subseteq\mathbf{QM}(\gamma^{\prime}); these are equivalent if 𝐐𝐌​(γ)=𝐐𝐌​(γ′)\mathbf{QM}(\gamma)=\mathbf{QM}(\gamma^{\prime}).

The Chase.

The chase algorithm can be used to decide fact entailment and is defined here only for Datalog, since Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rules with existentially quantified variables can be normalised away, as explained in the following section. A trigger τ\tau is a pair ⟨ϱ,σ⟩\langle\varrho,\sigma\rangle consisting of a Datalog rule ϱ=β→η\varrho=\beta\to\eta and a substitution σ\sigma that is defined exactly on the set of all variables occurring in ϱ\varrho. The trigger τ\tau is applicable to a fact set ℱ\mathcal{F} if σ​(β)⊆ℱ\sigma(\beta)\subseteq\mathcal{F} and all constants in the range of σ\sigma occur in ℱ\mathcal{F}. We define 𝐎𝐮𝐭𝐩𝐮𝐭​(τ)=σ​(η)\mathbf{Output}(\tau)=\sigma(\eta) and, for a fact set ℱ\mathcal{F}, we define 𝐀𝐩𝐩ϱ​(ℱ)\mathbf{App}_{\varrho}(\mathcal{F}) as the set including 𝐎𝐮𝐭𝐩𝐮𝐭​(τ)\mathbf{Output}(\tau) for every trigger τ\tau with ϱ\varrho that is applicable to ℱ\mathcal{F}. For a Datalog rule set ℛ\mathcal{R} and a fact set ℱ\mathcal{F}, let 𝐀𝐩𝐩ℛ​(ℱ)=⋃ϱ∈ℛ𝐀𝐩𝐩ϱ​(ℱ)\mathbf{App}_{\mathcal{R}}(\mathcal{F})=\bigcup_{\varrho\in\mathcal{R}}\mathbf{App}_{\varrho}(\mathcal{F}). For a Datalog KB 𝒦=⟨ℛ,ℱ⟩\mathcal{K}=\langle\mathcal{R},\mathcal{F}\rangle, let 𝐂𝐡1​(𝒦),𝐂𝐡2​(𝒦),…\mathbf{Ch}_{1}(\mathcal{K}),\mathbf{Ch}_{2}(\mathcal{K}),\ldots be the sequence of fact sets such that (i) 𝐂𝐡1​(𝒦)=ℱ\mathbf{Ch}_{1}(\mathcal{K})=\mathcal{F}, and (ii) 𝐂𝐡i​(𝒦)=𝐂𝐡i−1​(𝒦)∪𝐀𝐩𝐩ℛ​(𝐂𝐡i−1​(𝒦))\mathbf{Ch}_{i}(\mathcal{K})=\mathbf{Ch}_{i-1}(\mathcal{K})\cup\mathbf{App}_{\mathcal{R}}(\mathbf{Ch}_{i-1}(\mathcal{K})) for every i≥2i\geq 2. We define the chase of 𝒦\mathcal{K}, written 𝐂𝐡​(𝒦)\mathbf{Ch}(\mathcal{K}), as the union of all fact sets in this sequence. By our definition of applicable triggers, the chase is always finite, and it yields a set of facts that can be used to decide fact entailment under active domain semantics [1].

Proposition 1

A Datalog KB 𝒦\mathcal{K} entails a fact α\alpha if and only if α∈𝐂𝐡​(𝒦)\alpha\in\mathbf{Ch}(\mathcal{K}).

For a Datalog KB 𝒦\mathcal{K}, the chase depth of a fact α∈𝐂𝐡​(𝒦)\alpha\in\mathbf{Ch}(\mathcal{K}) with respect to 𝒦\mathcal{K} is the least k≥1k\geq 1 such that α∈𝐂𝐡k​(𝒦)\alpha\in\mathbf{Ch}_{k}(\mathcal{K}).

3 From Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} to Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} Queries

This section briefly recalls how to normalize away axioms of the form (5), (6), and (7) from a Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rule set.

Definition 1

A Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.07838pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.53394pt$\scriptscriptstyle\not$\hss}{\exists}}}} rule is a rule of the form (1), (2), (3), or (4). Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} queries and KBs are defined in the obvious way.

To reduce to such rules, we proceed in two main steps. Assume we have a Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rule set ℛ\mathcal{R}. In the first step, we get rid of axioms of the forms (6) and (7). Let ⊑∗\sqsubseteq^{*} be the reflexive and transitive closure of the relation ⊑\sqsubseteq induced by ℛ\mathcal{R} on 𝖱𝗈𝗅𝖾𝖤𝗑𝗉𝗌\mathsf{RoleExps}. Let ℛ′\mathcal{R}^{\prime} be a copy of ℛ\mathcal{R} from which we remove all axioms of the forms (6) and (7) but add, for every 𝚁,𝚂∈𝖱𝗈𝗅𝖾𝗌\mathtt{R},\mathtt{S}\in\mathsf{Roles} such that 𝚁⊑∗𝚂\mathtt{R}\sqsubseteq^{*}\mathtt{S} or 𝚁−⊑∗𝚂−\mathtt{R}^{-}\sqsubseteq^{*}\mathtt{S}^{-}, the axioms:

  • •

    𝙰​(x)∧𝚁​(x,y)→𝙱​(y)\mathtt{A}(x)\wedge\mathtt{R}(x,y)\to\mathtt{B}(y) for every axiom 𝙰​(x)∧𝚂​(x,y)→𝙱​(y)\mathtt{A}(x)\wedge\mathtt{S}(x,y)\to\mathtt{B}(y) in ℛ\mathcal{R}; and

  • •

    𝚁​(x,y)∧𝙰​(y)→𝙱​(x)\mathtt{R}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x) for every axiom 𝚂​(x,y)∧𝙰​(y)→𝙱​(x)\mathtt{S}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x) in ℛ\mathcal{R};

and, for every 𝚁,𝚂∈𝖱𝗈𝗅𝖾𝗌\mathtt{R},\mathtt{S}\in\mathsf{Roles} such that 𝚁−⊑∗𝚂\mathtt{R}^{-}\sqsubseteq^{*}\mathtt{S} or 𝚁⊑∗𝚂−\mathtt{R}\sqsubseteq^{*}\mathtt{S}^{-}, the axioms:

  • •

    𝚁​(x,y)∧𝙰​(y)→𝙱​(x)\mathtt{R}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x) for every axiom 𝙰​(x)∧𝚂​(x,y)→𝙱​(y)\mathtt{A}(x)\wedge\mathtt{S}(x,y)\to\mathtt{B}(y) in ℛ\mathcal{R}; and

  • •

    𝙰​(x)∧𝚁​(x,y)→𝙱​(y)\mathtt{A}(x)\wedge\mathtt{R}(x,y)\to\mathtt{B}(y) for every axiom 𝚂​(x,y)∧𝙰​(y)→𝙱​(x)\mathtt{S}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x) in ℛ\mathcal{R}.

It is then routine to verify that for every class fact α\alpha, the queries ⟨ℛ,α⟩\langle\mathcal{R},\alpha\rangle and ⟨ℛ′,α⟩\langle\mathcal{R}^{\prime},\alpha\rangle are equivalent. We here strongly rely on the queries being based upon class facts, as this procedure would fail already for those based on role facts.

In the second step, we get rid of axioms of the form (5) by applying the translation to Datalog rules proposed in [10, Tables 2 and 3] for the more expressive Horn-​𝒮​ℋ​ℐ​𝒬\textit{Horn-}\mathcal{SHIQ}. This reduction to their procedure is possible as our ℛ′\mathcal{R}^{\prime} is already compliant with their notion of a Horn-​𝒮​ℋ​ℐ​𝒬\textit{Horn-}\mathcal{SHIQ} rule set. We then remark that, given that we only input axioms of the forms (1)–(5) (or (F1), (F2), (F3) in the reference), their translation only outputs axioms of the form (1), (2), (3), or (4), as desired. In summary, we obtain the following:

Theorem 3.1

There is a computable function mapping every Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} query to an equivalent Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.07838pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.53394pt$\scriptscriptstyle\not$\hss}{\exists}}}} query.

Example 3

Consider the set of Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} rules 𝒯NF\mathcal{T}_{\textit{NF}} obtained from the set 𝒯\mathcal{T} from Example˜1 by removing 𝙶𝚊𝚝𝚎​(x)→∃y.𝙻𝚒𝚗𝚔​(x,y)∧𝙾𝚗𝚕​(y)\mathtt{Gate}(x)\to\exists y.\mathtt{Link}(x,y)\wedge\mathtt{Onl}(y) and adding 𝙶𝚊𝚝𝚎​(x)→𝙾𝚗𝚕​(x)\mathtt{Gate}(x)\to\mathtt{Onl}(x). Furthermore, observe that the DL queries ⟨𝒯,𝚃𝚛𝚞𝚜𝚝​(alice)⟩\langle\mathcal{T},\mathtt{Trust}(\textit{alice})\rangle and ⟨𝒯NF,𝚃𝚛𝚞𝚜𝚝​(alice)⟩\langle\mathcal{T}_{\textit{NF}},\mathtt{Trust}(\textit{alice})\rangle are equivalent.

We observe that, in general, the resulting Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query has an exponential size compared to the original Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} query. This blow-up arises in the second step and cannot be avoided and already occurs in the part of the translation borrowed from [10]: when removing even a single axiom of form (5), one may need exponentially-many axioms of form (1) to preserve equivalence of the rule queries. Such pathological cases can be extracted from proofs of the ExpTime-hardness of basic reasoning tasks already in Horn-​𝒜​ℒ​𝒞\textit{Horn-}\mathcal{ALC}, see e.g. [16].

4 From Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} Queries to DL Automata

We introduce DL automata as finite-state devices closely related to regular tree automata, tailored to capture the expressive power of Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} queries. We first formally introduce these in Definition˜2 and then explain their semantics in Definition˜3. Next, in Definition˜4, we present a reduction from Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} queries to DL automata and show that this translation preserves the semantics of the input queries. Finally, in Remark˜1, we state some properties of the automata produced by this translation, which are applied in the following section to develop an equivalence-preserving reduction from a class of DL automata to PQs.

Definition 2

We distinguish a special accepting state qaccq_{\textit{acc}}. A binary transition is an expression of the form q↝𝚂Qq\rightsquigarrow_{\mathtt{S}}Q, where qq is a state, 𝚂∈{ε}∪𝖢𝗅𝖺𝗌𝗌𝖾𝗌∪𝖱𝗈𝗅𝖾𝖤𝗑𝗉𝗌\mathtt{S}\in\{\varepsilon\}\cup\mathsf{Classes}\cup\mathsf{RoleExps}, and QQ is a set of states with |Q|=1|Q|=1. A multi-ary transition is an expression of the form q↝εQq\rightsquigarrow_{\varepsilon}Q, where qq is a state and QQ is a set of states with |Q|≥2|Q|\geq 2. A transition is either a binary transition or a multi-ary transition. A DL automaton is a tuple ⟨s,Q,qinit,δ⟩\langle s,Q,q_{\textit{init}},\delta\rangle, where ss is a constant, QQ is a finite set of states, qinitq_{\textit{init}} is a state, and δ\delta is a transition function over QQ, that is, a finite set of transitions featuring only states in QQ.

Every DL automaton defines a boolean query and thereby partitions the set of all fact sets into those it accepts and those it rejects. As for rule queries and PQs, this partition is formalized by the “query mapping” function 𝐐𝐌\mathbf{QM}, defined below. To characterize the accepted fact sets, we first introduce the notion of a run of a DL automaton, analogous to a run of a tree automaton on a tree.

Definition 3

A run of a DL automaton ⟨s,Q,qinit,δ⟩\langle s,Q,q_{\textit{init}},\delta\rangle over a fact set ℱ\mathcal{F} from ⟨p,e⟩\langle p,e\rangle, where pp is a state and ee is a constant, is a triple ⟨N,E,L⟩\langle N,E,L\rangle such that:

  • •

    The pair ⟨N,E⟩\langle N,E\rangle is a finite rooted directed tree. Moreover, LL is a labeling function that maps every node to a pair consisting of a state and a constant, and maps the root to ⟨p,e⟩\langle p,e\rangle.

  • •

    For every node nn with L​(n)=⟨q,c⟩L(n)=\langle q,c\rangle that has exactly one child mm in the tree, there is a binary transition q↝𝚂{q′}∈δq\rightsquigarrow_{\mathtt{S}}\{q^{\prime}\}\in\delta satisfying all of the following implications: (i) If 𝚂=ε\mathtt{S}=\varepsilon, then L​(m)=⟨q′,c⟩L(m)=\langle q^{\prime},c\rangle. (ii) If 𝚂\mathtt{S} is a class, then 𝚂​(c)∈ℱ\mathtt{S}(c)\in\mathcal{F} and L​(m)=⟨q′,c⟩L(m)=\langle q^{\prime},c\rangle. (iii) If 𝚂\mathtt{S} is a role expression, then there is some constant dd such that 𝚂​(c,d)∈ℱ∪𝐈𝐧𝐯​(ℱ)\mathtt{S}(c,d)\in\mathcal{F}\cup\mathbf{Inv}(\mathcal{F}) and L​(m)=⟨q′,d⟩L(m)=\langle q^{\prime},d\rangle.

  • •

    For every node nn with L​(n)=⟨q,c⟩L(n)=\langle q,c\rangle with at least two children m1,…,mkm_{1},\ldots,m_{k}, there is a multi-ary transition q↝ε{q1,…,qk}∈δq\rightsquigarrow_{\varepsilon}\{q_{1},\ldots,q_{k}\}\in\delta such that L​(mi)=⟨qi,c⟩L(m_{i})=\langle q_{i},c\rangle for every 1≤i≤k1\leq i\leq k.

Such a run is accepting if all leaf labels in the tree feature the accepting state, and the constant ss occurs in ℱ\mathcal{F}.

A DL automaton 𝔄=⟨s,qinit,Q,δ⟩\mathfrak{A}=\langle s,q_{\textit{init}},Q,\delta\rangle accepts a fact set ℱ\mathcal{F} if there is an accepting run of 𝔄\mathfrak{A} over ℱ\mathcal{F} from ⟨qinit,s⟩\langle q_{\textit{init}},s\rangle. Furthemore, let 𝐐𝐌​(𝔄)\mathbf{QM}(\mathfrak{A}) be the set of all fact sets accepted by 𝔄\mathfrak{A}. Such an automaton is contained in a rule query or a PQ γ\gamma if 𝐐𝐌​(𝔄)⊆𝐐𝐌​(γ)\mathbf{QM}(\mathfrak{A})\subseteq\mathbf{QM}(\gamma); these two are equivalent if 𝐐𝐌​(𝔄)=𝐐𝐌​(γ)\mathbf{QM}(\mathfrak{A})=\mathbf{QM}(\gamma).

q𝚃𝚛𝚞𝚜𝚝q_{\mathtt{Trust}}qaccq_{\textit{acc}}q𝙶𝚊𝚝𝚎q_{\mathtt{Gate}}q𝚂𝚎𝚗𝚜q_{\mathtt{Sens}}q𝙲𝚛𝚒𝚝q_{\mathtt{Crit}}q𝙾𝚗𝚕q_{\mathtt{Onl}}𝙻𝚒𝚗𝚔\mathtt{Link}𝙻𝚒𝚗𝚔\mathtt{Link}𝚃𝚛𝚞𝚜𝚝\mathtt{Trust}𝙰𝚌𝚌−\mathtt{Acc}^{-}ε\varepsilon𝙲𝚛𝚒𝚝\mathtt{Crit}𝚂𝚎𝚗𝚜\mathtt{Sens}ε\varepsilon𝙾𝚗𝚕\mathtt{Onl}𝙶𝚊𝚝𝚎\mathtt{Gate}n1:⟨q𝚃𝚛𝚞𝚜𝚝,alice⟩n_{1}:\langle q_{\mathtt{Trust}},\textit{alice}\ranglen2:⟨q𝙲𝚛𝚒𝚝,c1⟩n_{2}:\langle q_{\mathtt{Crit}},c_{1}\ranglen3r:⟨q𝚂𝚎𝚗𝚜,c1⟩n_{3}^{r}:\langle q_{\mathtt{Sens}},c_{1}\ranglen4r:⟨q𝚂𝚎𝚗𝚜,c2⟩n_{4}^{r}:\langle q_{\mathtt{Sens}},c_{2}\ranglen5r:⟨q𝚂𝚎𝚗𝚜,c3⟩n_{5}^{r}:\langle q_{\mathtt{Sens}},c_{3}\ranglen6r:⟨qacc,c3⟩n_{6}^{r}:\langle q_{\textit{acc}},c_{3}\ranglen3ℓ:⟨q𝙾𝚗𝚕,c1⟩n_{3}^{\ell}:\langle q_{\mathtt{Onl}},c_{1}\ranglen4ℓ:⟨q𝙾𝚗𝚕,c4⟩n_{4}^{\ell}:\langle q_{\mathtt{Onl}},c_{4}\ranglen5ℓ:⟨q𝙶𝚊𝚝𝚎,c4⟩n_{5}^{\ell}:\langle q_{\mathtt{Gate}},c_{4}\ranglen6ℓ:⟨qacc,c4⟩n_{6}^{\ell}:\langle q_{\textit{acc}},c_{4}\rangle
Figure 2: Consider the DL automaton ⟨alice,Q,q𝚃𝚛𝚞𝚜𝚝,δ⟩\langle\textit{alice},Q,q_{\mathtt{Trust}},\delta\rangle, where δ\delta is the transition function over QQ depicted on the left, and the only accepting run of this automaton from ⟨q𝚃𝚛𝚞𝚜𝚝,alice⟩\langle q_{\mathtt{Trust}},\textit{alice}\rangle over the fact set ℱ\mathcal{F} introduced in Example˜1 depicted on the right.
Example 4

In Figure˜2, we present a DL automaton together with one of its accepting runs over the fact set ℱ\mathcal{F} introduced in Example˜1. We will later argue that this automaton is equivalent to the Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query ⟨𝒯NF,𝚃𝚛𝚞𝚜𝚝​(alice)⟩\langle\mathcal{T}_{\textit{NF}},\mathtt{Trust}(\textit{alice})\rangle introduced in Example˜3; for now, the figure should help the reader understand why this automaton accepts this fact set.

In the following definition, we present a reduction from Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} queries to DL automata that preserves equivalence (cf. Example˜5).

Definition 4

For every 𝙲∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}\in\mathsf{Classes}, let q𝙲q_{\mathtt{C}} be a fresh state unique for 𝙲\mathtt{C}. For a Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ=⟨ℛ,𝙳​(s)⟩\gamma=\langle\mathcal{R},\mathtt{D}(s)\rangle, let 𝐃𝐋𝐀​(γ)=⟨s,Q,q𝙳,δ⟩\mathbf{DLA}(\gamma)=\langle s,Q,q_{\mathtt{D}},\delta\rangle denote the DL automaton where QQ is the set of states containing qaccq_{\textit{acc}} and q𝙲q_{\mathtt{C}} for every class 𝙲\mathtt{C} occurring in γ\gamma, and δ\delta is the transition function containing all of the following:

  • •

    For every class 𝙲\mathtt{C} occurring in γ\gamma, add q𝙲↝𝙲{qacc}∈δq_{\mathtt{C}}\rightsquigarrow_{\mathtt{C}}\{q_{\textit{acc}}\}\in\delta.

  • •

    For every rule such as ⋀i=1n𝙰i​(x)→𝙱​(x)∈ℛ\bigwedge^{n}_{i=1}\mathtt{A}_{i}(x)\to\mathtt{B}(x)\in\mathcal{R}, add q𝙱↝ε{q𝙰𝟷,…,q𝙰𝚗}∈δq_{\mathtt{B}}\rightsquigarrow_{\varepsilon}\{q_{\mathtt{A_{1}}},\ldots,q_{\mathtt{A_{n}}}\}\in\delta.

  • •

    For every rule such as 𝚁​(x,y)∧𝙰​(y)→𝙱​(x)∈ℛ\mathtt{R}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x)\in\mathcal{R}, add q𝙱↝𝚁{q𝙰}∈δq_{\mathtt{B}}\rightsquigarrow_{\mathtt{R}}\{q_{\mathtt{A}}\}\in\delta.

  • •

    For every rule such as 𝙰​(x)∧𝚁​(x,y)→𝙱​(y)∈ℛ\mathtt{A}(x)\wedge\mathtt{R}(x,y)\to\mathtt{B}(y)\in\mathcal{R}, add q𝙱↝𝚁−{q𝙰}∈δq_{\mathtt{B}}\rightsquigarrow_{\mathtt{R}^{-}}\{q_{\mathtt{A}}\}\in\delta.

  • •

    For every rule such as →𝙱​(x)∈ℛ\to\mathtt{B}(x)\in\mathcal{R}, add q𝙱↝ε{qacc}∈δq_{\mathtt{B}}\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\delta.

Example 5

Consider the rule set 𝒯NF\mathcal{T}_{\textit{NF}} and the fact set ℱ\mathcal{F} introduced in Example˜1. Observe that the automaton 𝐃𝐋𝐀​(𝒯NF,𝚃𝚛𝚞𝚜𝚝​(alice))\mathbf{DLA}(\mathcal{T}_{\textit{NF}},\mathtt{Trust}(\textit{alice})), described in Figure˜2, accepts ℱ\mathcal{F}, as witnessed by the accepting run depicted in that same figure. By contrast, the automaton 𝐃𝐋𝐀​(𝒯NF,𝚃𝚛𝚞𝚜𝚝​(bob))\mathbf{DLA}(\mathcal{T}_{\textit{NF}},\mathtt{Trust}(\textit{bob})) does not accept ℱ\mathcal{F}, as there is no accepting run from ⟨q𝚃𝚛𝚞𝚜𝚝,bob⟩\langle q_{\mathtt{Trust}},\textit{bob}\rangle.

{restatable}

theoremCorrespondenceNormHornALCAutomata A Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ\gamma is equivalent to the DL automaton 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma).

Proof(Sketch)

The theorem follows from the fact that, for every fact set ℱ\mathcal{F} and fact 𝙱​(b)\mathtt{B}(b), the KB ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle entails 𝙱​(b)\mathtt{B}(b) if and only if there is an accepting run of 𝐃𝐋𝐀​(ℛ,𝙱​(b))\mathbf{DLA}(\mathcal{R},\mathtt{B}(b)) over ℱ\mathcal{F} starting from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle. The “if” direction is proved by induction on the height of the accepting run, while the “only if” direction is established by induction on the chase depth of 𝙱​(b)\mathtt{B}(b) with respect to ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle.

To conclude the section, the following remark states several properties satisfied by every DL automaton produced by the reduction of Definition˜4.

Remark 1

Consider a Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ\gamma and the DL automaton 𝐃𝐋𝐀​(γ)=⟨s,Q,qinit,δ⟩\mathbf{DLA}(\gamma)=\langle s,Q,q_{\textit{init}},\delta\rangle. Then, all of the following hold:

  1. 1.

    There are no transitions originating from the accepting state; that is, δ\delta does not contain transitions of the form qacc↝𝚂Pq_{\textit{acc}}\rightsquigarrow_{\mathtt{S}}P.

  2. 2.

    Every (binary) transition labelled with a class points to the accepting state; that is, for every q↝𝙲{p}∈δq\rightsquigarrow_{\mathtt{C}}\{p\}\in\delta with 𝙲∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}\in\mathsf{Classes}, we have p=qaccp=q_{\textit{acc}}.

  3. 3.

    Every non-final state directly reaches the accepting state through a binary transition; that is, for every q∈Q∖{qacc}q\in Q\setminus\{q_{\textit{acc}}\}, there is some transition of the form q↝𝚂{qacc}∈δq\rightsquigarrow_{\mathtt{S}}\{q_{\textit{acc}}\}\in\delta.

Properties 1 and 2 together ensure that transitions labelled with classes are considered only at the very end of an accepting run. This, in turn, simplifies the form of the regular expressions used in the following section to encode DL automata, since these only need to involve role expressions. Property 3 ensures that every state admits a path to the accepting state. If not for this restriction, a DL automaton may not accept any fact set. Such an automaton cannot be translated into a PQ, since the empty query is not a PQ under our definition.

5 From Stratified DL Automata to PQs

In this section, we present an equivalence-preserving reduction from a class of DL automata to PQs. More precisely, this reduction applies only to stratified automata, which we formally introduce in the following definition.

Definition 5

Consider a DL automaton 𝔄=⟨s,Q,qinit,δ⟩\mathfrak{A}=\langle s,Q,q_{\textit{init}},\delta\rangle.

  • •

    For states qq and pp, we write q→𝔄2pq\to_{\mathfrak{A}}^{2}p if δ\delta contains a binary transition of the form q↝𝚂{p}q\rightsquigarrow_{\mathtt{S}}\{p\}, and q→𝔄mpq\to_{\mathfrak{A}}^{m}p if δ\delta contains a multi-ary transition of the form q↝εPq\rightsquigarrow_{\varepsilon}P with p∈Pp\in P.

  • •

    We define →𝔄\to_{\mathfrak{A}} as the union of →𝔄2\to_{\mathfrak{A}}^{2} and →𝔄m\to_{\mathfrak{A}}^{m}, and we define →𝔄∗\to_{\mathfrak{A}}^{*} as the reflexive transitive closure of →𝔄\to_{\mathfrak{A}}.

  • •

    For states qq and pp, we write q≻𝔄pq\succ_{\mathfrak{A}}p if there are q′,q′′,p′,p′′∈Qq^{\prime},q^{\prime\prime},p^{\prime},p^{\prime\prime}\in Q and 𝙴∈𝖱𝗈𝗅𝖾𝖤𝗑𝗉𝗌\mathtt{E}\in\mathsf{RoleExps} with q→𝔄∗q′q\to_{\mathfrak{A}}^{*}q^{\prime}, q′↝𝙴{q′′}∈δq^{\prime}\rightsquigarrow_{\mathtt{E}}\{q^{\prime\prime}\}\in\delta, q′′→𝔄∗p′q^{\prime\prime}\to_{\mathfrak{A}}^{*}p^{\prime}, p′→𝔄mp′′p^{\prime}\to_{\mathfrak{A}}^{m}p^{\prime\prime}, and p′′→𝔄∗pp^{\prime\prime}\to_{\mathfrak{A}}^{*}p.

A DL automaton 𝔄\mathfrak{A} is stratified if the relation ≻𝔄\succ_{\mathfrak{A}} is acyclic, and if it satisfies the conditions in Remark˜1. If 𝔄\mathfrak{A} is stratified, we define 𝐒𝐭𝐫𝔄:Q→ℕ\mathbf{Str}_{\mathfrak{A}}:Q\to\mathbb{N} as the function mapping a state q∈Qq\in Q to 11 if qq has no successors with respect to ≻𝔄\succ_{\mathfrak{A}}, and to 𝐌𝐚𝐱​({𝐒𝐭𝐫𝔄​(p)∣q≻𝔄p})+1\mathbf{Max}(\{\mathbf{Str}_{\mathfrak{A}}(p)\mid q\succ_{\mathfrak{A}}p\})+1 otherwise.

Example 6

Consider the DL automaton 𝔄=⟨alice,Q,q𝚃𝚛𝚞𝚜𝚝,δ⟩\mathfrak{A}=\langle\textit{alice},Q,q_{\mathtt{Trust}},\delta\rangle described in Figure˜2. For instance, we have q𝚃𝚛𝚞𝚜𝚝≻𝔄q𝙶𝚊𝚝𝚎q_{\mathtt{Trust}}\succ_{\mathfrak{A}}q_{\mathtt{Gate}}, since all of the following hold:

q𝚃𝚛𝚞𝚜𝚝→𝔄∗q𝚃𝚛𝚞𝚜𝚝q𝚃𝚛𝚞𝚜𝚝↝𝙰𝚌𝚌−{q𝙲𝚛𝚒𝚝}∈δq𝙲𝚛𝚒𝚝→𝔄∗q𝙲𝚛𝚒𝚝\displaystyle q_{\mathtt{Trust}}\to_{\mathfrak{A}}^{*}q_{\mathtt{Trust}}\qquad q_{\mathtt{Trust}}\rightsquigarrow_{\mathtt{Acc}^{-}}\{q_{\mathtt{Crit}}\}\in\delta\qquad q_{\mathtt{Crit}}\to_{\mathfrak{A}}^{*}q_{\mathtt{Crit}}
q𝙲𝚛𝚒𝚝→𝔄mq𝙾𝚗𝚕q𝙾𝚗𝚕→𝔄∗q𝙶𝚊𝚝𝚎\displaystyle q_{\mathtt{Crit}}\to_{\mathfrak{A}}^{m}q_{\mathtt{Onl}}\qquad q_{\mathtt{Onl}}\to_{\mathfrak{A}}^{*}q_{\mathtt{Gate}}

Observe that 𝔄\mathfrak{A} is stratified, since every cycle in its transition function involves only binary transitions.

Our reduction from automata to PQs, formally introduced in Section˜5.2, proceeds by associating with every state qq of a stratified DL automaton 𝔄\mathfrak{A} a PQ describing the behaviour of 𝔄\mathfrak{A} when started in qq. This association is defined inductively: for states in stratum 11, the corresponding PQ is defined directly, whereas for states in stratum k≥2k\geq 2, it is defined using the PQs already associated with states in strictly lower strata. The role of stratification is to guarantee that this recursive construction is well defined. Indeed, the relation ≻𝔄\succ_{\mathfrak{A}} captures precisely those dependencies between states that arise when the translation encounters a path containing a binary transition labelled with a role expression and, possibly after intermediate transitions, a multi-ary transition. In this situation, our inductive construction branches out and introduces additional existentially quantified variables, thereby producing formulas such as the third disjunct of the PQ in Example˜2. If cycles over ≻𝔄\succ_{\mathfrak{A}} were allowed, the translation could follow the same dependencies indefinitely, repeatedly expanding the formula and introducing new existential variables, thus failing to produce a finite PQ.

We point out that in Definition˜5 we require stratified automata to satisfy the conditions of Remark˜1, since these are necessary to prove some of the results that follow. This is without loss of generality when considering DL automata corresponding to Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} queries since, as explained in the previous section, all such automata satisfy these conditions. We define our reduction from automata to PQs in Section˜5.2; its definition relies on a preliminary translation for DL automata without multi-ary transitions, presented in Section˜5.1.

5.1 DL Non-Deterministic Finite Automata

In the following subsection, we present a reduction that transforms DL automata into equivalent PQs, that is, to positive FO formulas featuring regular expressions. To define such a transformation, we leverage existing automata-theoretic techniques defined for automata without multi-ary transitions.

Definition 6

A DL non-deterministic finite automaton (NFA) 𝔄\mathfrak{A} is a DL automaton without multi-ary transitions. Given states qq and pp, constants ss and tt, and a fact set ℱ\mathcal{F}, the automaton 𝔄\mathfrak{A} transitions from ⟨q,s⟩\langle q,s\rangle to ⟨p,t⟩\langle p,t\rangle in ℱ\mathcal{F} if there is a run of 𝔄\mathfrak{A} over ℱ\mathcal{F} from ⟨q,s⟩\langle q,s\rangle whose (unique) leaf is labelled with ⟨p,t⟩\langle p,t\rangle.

Observe that, by Definition˜3, in every run of a DL automaton without multi-ary transitions, each node has at most one child; hence, such a run has exactly one leaf. It is well known from classical automata theory that the set of all paths induced by such an automaton can be characterized by a regular expression [14].

Lemma 1

Consider a DL NFA 𝔑\mathfrak{N} that satisfies Remark˜1,333Recall that NFAs are DL automata by definition 6. and some states qq and pp of 𝔑\mathfrak{N} such that pp is different from qaccq_{\textit{acc}}. Then, there is a regular expression 𝔈q⊳p𝔑\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}} such that, for every fact set ℱ\mathcal{F} and constants ss and tt, the NFA 𝔑\mathfrak{N} can transition from ⟨q,s⟩\langle q,s\rangle to ⟨p,t⟩\langle p,t\rangle in ℱ\mathcal{F} if and only if ℱ⊧𝔈q⊳p𝔑​(s,t)\mathcal{F}\models\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}}(s,t).

Proof

By Kleene’s theorem [15], there is a regular expression such as 𝔈q⊳p𝔑\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}} over role expressions such that 𝐋𝐚𝐧𝐠​(𝔈q⊳p𝔄)\mathbf{Lang}(\mathfrak{E}_{q\triangleright p}^{\mathfrak{A}}) is the set of all words labelling the paths from qq to pp in 𝔑\mathfrak{N}. This applies because no path from qq to pp visits the accepting state qaccq_{\textit{acc}} since p≠qaccp\neq q_{\textit{acc}} and qaccq_{\textit{acc}} is a sink in 𝔑\mathfrak{N} by Item 1 of Remark˜1. Therefore, these paths contain no classes, since by Item 2 of the same remark, all binary transitions of 𝔑\mathfrak{N} labelled with classes have qaccq_{\textit{acc}} as target.

The previous auxiliary result allows us to readily define an equivalence-preserving reduction from NFAs to PQs.

Definition 7

Given an NFA 𝔑=⟨s,Q,qinit,δ⟩\mathfrak{N}=\langle s,Q,q_{\textit{init}},\delta\rangle that satisfies Remark˜1, a state qq of 𝔑\mathfrak{N}, and a term tt, we define 𝐏𝐐NFA​(𝔑,q,t)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,t) as the following PQ:

  • •

    If qq is the accepting state qaccq_{\textit{acc}}, then this PQ is equal to ⊤\top.

  • •

    Otherwise, this PQ is the disjunction containing, for every p∈Q∖{qacc}p\in Q\setminus\{q_{\textit{acc}}\} with q→𝔑∗pq\to_{\mathfrak{N}}^{*}p, all of the following: (i) If p↝𝙲{qacc}∈𝔑p\rightsquigarrow_{\mathtt{C}}\{q_{\textit{acc}}\}\in\mathfrak{N} for some 𝙲∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}\in\mathsf{Classes}, add the disjunct ∃w.[𝔈q⊳p𝔑​(t,w)∧𝙲​(w)]\exists w.\big[\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}}(t,w)\wedge\mathtt{C}(w)\big] with ww a fresh variable. (ii) If p↝ε{qacc}∈𝔑p\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\mathfrak{N}, add the disjunct ∃w.𝔈q⊳p𝔑​(t,w)\exists w.\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}}(t,w) with ww a fresh variable.

Since 𝔑\mathfrak{N} above satisfies Remark˜1, every state distinct from the accepting state reaches it via a binary transition annotated with a class. Therefore, the corresponding PQ is either ⊤\top or a non-empty disjunction.

{restatable}

lemmalemmatransitioncrpq Consider a DL NFA 𝔑\mathfrak{N} that satisfies Remark˜1, a fact set ℱ\mathcal{F}, a state qq of 𝔑\mathfrak{N} different from qaccq_{\textit{acc}}, and a constant ss in ℱ\mathcal{F}. There is an accepting run of 𝔑\mathfrak{N} over ℱ\mathcal{F} starting at ⟨q,s⟩\langle q,s\rangle if and only if ℱ\mathcal{F} satisfies 𝐏𝐐NFA​(𝔑,q,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,s).

The previous result yields an equivalence-preserving reduction from NFAs to PQs illustrated in the following example.

Example 7

Consider the DL automaton ⟨alice,Q,q𝚃𝚛𝚞𝚜𝚝,δ⟩\langle\textit{alice},Q,q_{\mathtt{Trust}},\delta\rangle depicted Figure˜2 and the NFA 𝔑=⟨s,Q,q𝙾𝚗𝚕,δ′⟩\mathfrak{N}=\langle s,Q,q_{\mathtt{Onl}},\delta^{\prime}\rangle where δ′\delta^{\prime} is the set of all binary transitions in δ\delta. By Definition˜7, this NFA is equivalent to the following PQ:

𝐏𝐐NFA​(𝔑,q𝙾𝚗𝚕,s)=∃u1.[𝙻𝚒𝚗𝚔∗​(s,u1)∧𝙾𝚗𝚕​(u1)]∨∃u2.[𝙻𝚒𝚗𝚔∗​(s,u2)∧𝙶𝚊𝚝𝚎​(u2)]\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Onl}},s)=\exists u_{1}.\big[\mathtt{Link}^{*}(s,u_{1})\wedge\mathtt{Onl}(u_{1})\big]\vee\exists u_{2}.\big[\mathtt{Link}^{*}(s,u_{2})\wedge\mathtt{Gate}(u_{2})\big]

In the following subsection, we use the previously discussed reduction as a subroutine in a more general translation applicable to stratified DL automata, which may contain multi-ary transitions. To apply this subroutine, we define the NFA reachable from a given state in a DL automaton.

Definition 8

Given a DL automaton 𝔄\mathfrak{A} and a state qq of 𝔄\mathfrak{A}, we define 𝐍𝐅𝐀​(𝔄,p)\mathbf{NFA}(\mathfrak{A},p) as the NFA obtained from 𝔄\mathfrak{A} by performing the following modifications in sequence: remove all multi-ary transitions, remove all states that are not reachable from pp through the remaining (binary) transitions, and remove all (binary) transitions that mention a state removed in the previous step.

5.2 An Inductive Reduction for Stratified DL Automata

Before presenting our reduction, we define an extension of transition functions that allows adjacent ε\varepsilon-transitions to be handled in single step.

Definition 9

For a transition function δ\delta over a set of states QQ, let δε∗\delta^{*}_{\varepsilon} be the (minimal) set of multi-ary transitions such that: For every q∈Qq\in Q, we have q↝ε{q}∈δε∗q\rightsquigarrow_{\varepsilon}\{q\}\in\delta^{*}_{\varepsilon}. For every q↝εP∈δε∗q\rightsquigarrow_{\varepsilon}P\in\delta_{\varepsilon}^{*} and p↝εP′∈δp\rightsquigarrow_{\varepsilon}P^{\prime}\in\delta with p∈Pp\in P, we have q↝ε(P∖{p})∪P′∈δε∗q\rightsquigarrow_{\varepsilon}(P\setminus\{p\})\cup P^{\prime}\in\delta^{*}_{\varepsilon}.

Every DL automaton ⟨s,Q,qinit,δ⟩\langle s,Q,q_{\textit{init}},\delta\rangle is equivalent to the extended automaton ⟨s,Q,qinit,δ∪δε∗⟩\langle s,Q,q_{\textit{init}},\delta\cup\delta^{*}_{\varepsilon}\rangle, since every transition in δε∗\delta^{*}_{\varepsilon} can be simulated by a finite sequence of ε\varepsilon-transitions already present in δ\delta. Nevertheless, this extension allows every combination of states reachable via ε\varepsilon-transitions to be reached directly in a single step, thus avoiding potential cyclic dependencies in our reduction.

In the following definition, we formally introduce our equivalence-preserving reduction, which is admittedly concise and technically involved. We suggest that the reader first skim through it, then consult the examples that follow, and only then return to the definition for a clearer understanding.

Definition 10

Given a stratified DL automaton 𝔄=⟨s,Q,qinit,δ⟩\mathfrak{A}=\langle s,Q,q_{\textit{init}},\delta\rangle, a state q∈Qq\in Q, a term tt, we inductively define 𝐏𝐐​(𝔄,q,t)\mathbf{PQ}(\mathfrak{A},q,t) as the following PQ:

⋁q↝εP∈δε∗⋀p∈P(𝐏𝐐NFA(𝔑,p,t)∨\displaystyle\bigvee\nolimits_{q\rightsquigarrow_{\varepsilon}P\in\delta^{*}_{\varepsilon}}\bigwedge\nolimits_{p\in P}\Big(\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},p,t)~\vee
⋁∀p′,p1,…,pn∈Q​ such that ​p→𝔑∗p′,p′↝ε{p1,…,pn},p≻𝔄p1,…, and ​p≻𝔄pn∃w.[𝔈p⊳p′𝔑(t,w)∧⋀i=1n𝐏𝐐(𝔄,pi,w)])\displaystyle\quad\bigvee_{\begin{subarray}{c}\forall p^{\prime},p_{1},\ldots,p_{n}\in Q\textit{ such that }p\to_{\mathfrak{N}}^{*}p^{\prime},\\ p^{\prime}\rightsquigarrow_{\varepsilon}\{p_{1},\ldots,p_{n}\},~p\succ_{\mathfrak{A}}p_{1},\ldots,\text{ and }p\succ_{\mathfrak{A}}p_{n}\end{subarray}}\exists w.\big[\mathfrak{E}_{p\triangleright p^{\prime}}^{\mathfrak{N}}(t,w)\wedge\bigwedge\nolimits_{i=1}^{n}\mathbf{PQ}(\mathfrak{A},p_{i},w)\big]\Big)

In the above, 𝔑\mathfrak{N} is the NFA 𝐍𝐅𝐀​(𝔄,q)\mathbf{NFA}(\mathfrak{A},q) and ww is a fresh variable.

In the following, we will sometimes write 𝐏𝐐​(𝔄)\mathbf{PQ}(\mathfrak{A}) to refer to 𝐏𝐐​(𝔄,qinit,s)\mathbf{PQ}(\mathfrak{A},q_{\textit{init}},s).

Observe that the above reduction is well defined since, for every stratified DL automaton 𝔄\mathfrak{A}, the relation ≻𝔄\succ_{\mathfrak{A}} is acyclic. Hence, we can first compute the PQs corresponding to all states in the lowest stratum, that is, states without successors with respect to ≻𝔄\succ_{\mathfrak{A}}. We then proceed stratum by stratum, computing the subsequent PQs by relying on those obtained previously. The following example illustrates both the base case and the inductive step of our construction.

Example 8

Consider the DL automaton 𝔄\mathfrak{A} from Figure˜2 and a constant ss. To illustrate the base case of our construction, we consider the state q𝙲𝚛𝚒𝚝q_{\mathtt{Crit}}, which belongs to the lowest stratum of 𝔄\mathfrak{A}, and present the corresponding PQ.

𝐏𝐐​(𝔄,q𝙲𝚛𝚒𝚝,s)=\displaystyle\mathbf{PQ}(\mathfrak{A},q_{\mathtt{Crit}},s)=~ (𝐏𝐐NFA​(𝔑,q𝚂𝚎𝚗𝚜,s)∧𝐏𝐐NFA​(𝔑,q𝙾𝚗𝚕,s))∨\displaystyle\big(\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Sens}},s)\wedge\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Onl}},s)\big)\,\vee
(𝐏𝐐NFA(𝔑,\displaystyle\big(\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N}, q𝚂𝚎𝚗𝚜,s)∧𝐏𝐐NFA(𝔑,q𝙶𝚊𝚝𝚎,s))∨𝐏𝐐NFA(𝔑,q𝙲𝚛𝚒𝚝,s)\displaystyle\,q_{\mathtt{Sens}},s)\wedge\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Gate}},s)\big)\,\vee\,\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Crit}},s)
𝐏𝐐NFA​(𝔑,q𝙲𝚛𝚒𝚝,s)=\displaystyle\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Crit}},s)=~ 𝙲𝚛𝚒𝚝​(s)\displaystyle\mathtt{Crit}(s)
𝐏𝐐NFA​(𝔑,q𝙶𝚊𝚝𝚎,s)=\displaystyle\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Gate}},s)=~ 𝙶𝚊𝚝𝚎​(s)\displaystyle\mathtt{Gate}(s)
𝐏𝐐NFA​(𝔑,q𝚂𝚎𝚗𝚜,s)=\displaystyle\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Sens}},s)=~ ∃u3.[𝙻𝚒𝚗𝚔∗​(s,u3)∧𝚂𝚎𝚗𝚜​(u3)]\displaystyle\exists u_{3}.\big[\mathtt{Link}^{*}(s,u_{3})\wedge\mathtt{Sens}(u_{3})\big]

The formula 𝐏𝐐NFA​(𝔑,q𝙾𝚗𝚕,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{\mathtt{Onl}},s) was already given in Example˜7. To illustrate the inductive step of our construction, we consider the state q𝚃𝚛𝚞𝚜𝚝q_{\mathtt{Trust}}, which belongs to stratum 22 of 𝔄\mathfrak{A}, and present the corresponding PQ.

𝐏𝐐​(𝔄,q𝚃𝚛𝚞𝚜𝚝,s)=\displaystyle\mathbf{PQ}(\mathfrak{A},q_{\mathtt{Trust}},s)=~ 𝚃𝚛𝚞𝚜𝚝​(s)∨∃u4.[𝙰𝚌𝚌−​(s,u4)∧𝙲𝚛𝚒𝚝​(u4)]∨\displaystyle\mathtt{Trust}(s)\,\vee\,\exists u_{4}.\big[\mathtt{Acc}^{-}(s,u_{4})\wedge\mathtt{Crit}(u_{4})\big]\,\vee\,
∃u5.[𝙰𝚌𝚌−(s,u5)\displaystyle\exists u_{5}.\big[\mathtt{Acc}^{-}(s,u_{5}) ∧𝐏𝐐(𝔄,q𝚂𝚎𝚗𝚜,u5)∧𝐏𝐐(𝔄,q𝙾𝚗𝚕,u5)]\displaystyle\wedge\mathbf{PQ}(\mathfrak{A},q_{\mathtt{Sens}},u_{5})\wedge\mathbf{PQ}(\mathfrak{A},q_{\mathtt{Onl}},u_{5})\big]
{restatable}

theoremCorrespondenceAutomataCTRPQ A stratified DL automaton 𝔄\mathfrak{A} is equivalent to 𝐏𝐐​(𝔄)\mathbf{PQ}(\mathfrak{A}).

Proof(Sketch)

The theorem follows from the fact that, for every fact set ℱ\mathcal{F} and fact 𝙱​(b)\mathtt{B}(b), the automaton 𝔄\mathfrak{A} has an accepting run from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle over ℱ\mathcal{F} if and only if ℱ\mathcal{F} entails 𝐏𝐐​(𝔄,q𝙱,b)\mathbf{PQ}(\mathfrak{A},q_{\mathtt{B}},b). Both directions are proven by induction on the stratum of the state q𝙱q_{\mathtt{B}}.

6 From Positive Queries to GQL Queries

In this section, we show that PQs can be expressed in the Graph Query Language (GQL) [7, 11]. Namely, we present an equivalence-preserving mapping from PQs to a query language that is already known to be expressible in GQL [12].

Definition 11

A union of conjunctive two-way regular path queries (UC2RPQ) is a PQ of the form ⋁i=1n∃y→i.ψi\bigvee\nolimits_{i=1}^{n}\exists\vec{y}_{i}.\psi_{i} where all ψi\psi_{i} are non-empty atom conjunctions.

Definition 12

Given a PQ φ\varphi, we define 𝐔𝐂𝟐𝐑𝐏𝐐​(φ)\mathbf{UC2RPQ}(\varphi) as a PQ obtained by exhaustively applying the following replacement rules:

  1. 1.

    Replace a subformula of the form ∃w.(ψ∨ψ′)\exists w.(\psi\vee\psi^{\prime}) with (∃w.ψ)∨(∃v.ψ′[w/v])(\exists w.\psi)\vee(\exists v.\psi^{\prime}[w/v]), where vv is a fresh variable and ψ′​[w/v]\psi^{\prime}[w/v] is the formula that results from replacing all occurrences of ww in ψ′\psi^{\prime} with vv.

  2. 2.

    Replace a subformula of the form (ψ1∧(ψ2∨ψ3))(\psi_{1}\wedge(\psi_{2}\vee\psi_{3})) with (ψ1∧ψ2)∨(ψ1∧ψ3)(\psi_{1}\wedge\psi_{2})\vee(\psi_{1}\wedge\psi_{3}).

  3. 3.

    Replace a subformula of the form (∃w.ψ)∧(∃v.ψ′)(\exists w.\psi)\wedge(\exists v.\psi^{\prime}) with ∃w,v.(ψ∧ψ′)\exists w,v.(\psi\wedge\psi^{\prime}).

The previous translation is included for completeness and is not an original contribution, as it relies on standard transformations [1, Chapter 5].

Lemma 2

For every PQ φ\varphi, the queries φ\varphi and 𝐔𝐂𝟐𝐑𝐏𝐐​(φ)\mathbf{UC2RPQ}(\varphi) are equivalent, and 𝐔𝐂𝟐𝐑𝐏𝐐​(φ)\mathbf{UC2RPQ}(\varphi) is a UC2RPQ.

Proof

One can prove the equivalence of the above formulas by induction on the sequence of formulas obtained by applying the replacement rules from Definition˜12 in the computation of 𝐔𝐂𝟐𝐑𝐏𝐐​(φ)\mathbf{UC2RPQ}(\varphi). Since the latter formula is obtained by exhaustively applying Rules 1 and 2, disjunctions occur only at the outermost level. Moreover, by the exhaustive application of Rule 3, conjunctions occur only at the innermost level. Therefore, 𝐔𝐂𝟐𝐑𝐏𝐐​(φ)\mathbf{UC2RPQ}(\varphi) is a UC2RPQ.

The following is a corollary of the previous lemma and the equivalence-preserving reduction of unions of C2RPQs to GQL [12, Theorem 11].

Theorem 6.1

There is an equivalence-preserving reduction from PQs to GQL.

7 Related Work

In the line of work on rewriting DL queries, a cornerstone is the first-order rewritability of rule queries of the DL-Lite family, allowing translation into unions of Select-Project-Join SQL queries [5]. It is worth noting that DL automata associated to (the positive versions) of DL-Lite rule queries are always stratified. Indeed, the popular fragments of DL-Lite (DL-Litecore, DL-LiteR) forbid axioms of the form (1) for n≥2n\geq 2. By unraveling the successive steps exposed in Section˜3, it is not difficult to verify that axioms of the form (1), for n≥2n\geq 2, are not introduced throughout the normalization procedure. Multi-ary transitions are therefore absent from the corresponding DL automata, which guarantees the existence of a stratification with a single stratum.

Closer to our setting, rewriting of rule queries from (extensions of) ℰ​ℒ\mathcal{EL} into queries based upon regular expressions has also been studied. In [8], rule queries of linear ℰ​ℒ\mathcal{EL} are rewritten into regular-path queries, and this work was later extended to the so-called harmless linear ℰ​ℒ​ℋ​ℐ\mathcal{ELHI} [9] using UC2RPQs as a target query language. Harmless linear ℰ​ℒ​ℋ​ℐ\mathcal{ELHI} restricts axioms of the form (1) to the case of n=1n=1, as in DL-Lite, and limits the interaction of pairs of roles 𝚂𝟷,𝚂𝟸\mathtt{S_{1}},\mathtt{S_{2}} whenever there exists a third role 𝚁\mathtt{R} such that both 𝚁​(x,y)→𝚂𝟷​(x,y)\mathtt{R}(x,y)\to\mathtt{S_{1}}(x,y) and 𝚁​(x,y)→𝚂𝟸​(y,x)\mathtt{R}(x,y)\to\mathtt{S_{2}}(y,x) are entailed by the set of rules. Already due to the restriction on conjunction, Example˜2 falls outside of the rule queries that their approach can rewrite. The nature of the restrictions in harmless linear ℰ​ℒ​ℋ​ℐ\mathcal{ELHI} makes a more formal comparison with our approach difficult. We have not found an example of a harmless linear ℰ​ℒ​ℋ​ℐ\mathcal{ELHI} rule query that does not have an associated stratified DL automaton.

More recently, and also motivated by the navigational features of GQL, quasi-linear ℰ​ℒ​ℋ\mathcal{ELH} with limited inverses (ℰ​ℒ​ℋiq​l\mathcal{ELH}^{ql}_{i}) was introduced and has been shown to enjoy rewriting into UC2RPQs [18]. The definition of this latter extension of ℰ​ℒ\mathcal{EL} is characterized by a notion of locality. Typically, our axiom 𝙲𝚛𝚒𝚝​(x)∧𝙰𝚌𝚌​(x,y)→𝚃𝚛𝚞𝚜𝚝​(y)\mathtt{Crit}(x)\wedge\mathtt{Acc}(x,y)\to\mathtt{Trust}(y) makes the class 𝙲𝚛𝚒𝚝\mathtt{Crit} non-local, and ℰ​ℒ​ℋiq​l\mathcal{ELH}^{ql}_{i} forbids non-local classes from appearing in the head of an axiom of form 1. As a consequence, an axiom like 𝚂𝚎𝚗𝚜​(x)∧𝙾𝚗𝚕​(x)→𝙲𝚛𝚒𝚝​(x)\mathtt{Sens}(x)\wedge\mathtt{Onl}(x)\to\mathtt{Crit}(x) is not allowed in ℰ​ℒ​ℋiq​l\mathcal{ELH}^{ql}_{i}. This shows that Example 2 is not a ℰ​ℒ​ℋiq​l\mathcal{ELH}^{ql}_{i}rule query, while being rewritable with our approach since its corresponding DL automaton is stratified (see Example 6). We speculate that by examining closely how the notion of (non-)locality is preserved through the different normalization steps exposed in Section˜3, one can establish that every ℰ​ℒ​ℋiq​l\mathcal{ELH}^{ql}_{i} rule query has an associate stratified DL automaton. Together with the previous remark regarding Example 2, such a verification would guarantee that our work strictly subsumes theirs.

A very recent work [2] has also pinpointed a subclass of ℰ​ℒ​ℋ​ℐ\mathcal{ELHI} queries that supports rewriting into nested 2RPQs, another fragment of GQL. The proposed subclass, namely ℰ​ℒ​ℐ⪯⊥\mathcal{ELI}^{\bot}_{\preceq}, relies on the existence of a stratification of class and role expressions, constrained by the rule set. This stratification notably limits recursion to rules with shape 𝚁​(x,y)∧𝙰​(y)→𝙰​(x)\mathtt{R}(x,y)\land\mathtt{A}(y)\to\mathtt{A}(x) or 𝙰​(x)∧𝚁​(x,y)→𝙰​(y)\mathtt{A}(x)\land\mathtt{R}(x,y)\to\mathtt{A}(y). As a consequence, their approach cannot rewrite the query ⟨{𝚁​(x,y)∧𝙰​(y)→𝙱​(x),𝚁​(x,y)∧𝙱​(y)→𝙰​(x)},𝙰​(a)⟩\langle\{\mathtt{R}(x,y)\land\mathtt{A}(y)\to\mathtt{B}(x),\mathtt{R}(x,y)\land\mathtt{B}(y)\to\mathtt{A}(x)\},\mathtt{A}(a)\rangle, whose corresponding DL automaton is trivially stratified. Their work also seemingly varies from ours as the nested 2RPQs they consider support tests along the 2RPQs. However, we did not find an example of an ℰ​ℒ​ℐ⪯⊥\mathcal{ELI}^{\bot}_{\preceq} query that is not already rewritable using our approach; a natural candidate exploiting the presence of tests in their formalism would have been the rule query ⟨{𝙰​(x)∧𝙱​(x)→𝙲​(x),𝚁​(x,y)∧𝙲​(y)→𝙰​(x)},𝙲​(c)⟩\langle\{\mathtt{A}(x)\land\mathtt{B}(x)\to\mathtt{C}(x),\mathtt{R}(x,y)\land\mathtt{C}(y)\to\mathtt{A}(x)\},\mathtt{C}(c)\rangle, but both approaches fail to rewrite this query.

8 Conclusions and Future Work

As our main contribution, we define an equivalence-preserving procedure that transforms a class of Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} queries into equivalent GQL formulas, proceeding in several steps. First, an input Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} query is transformed into a Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query (Theorem˜3.1), which is then translated into a DL automaton (Example˜5). If the resulting automaton is stratified, it can be further translated into a PQ (Example˜8), and subsequently into a GQL query (Theorem˜6.1).

An immediate direction for future work is to extend our translation to handle other constructors available in standard DL languages. For instance, our technique can be readily adapted to incorporate disjointness rules of the form 𝙰𝟷​(x)∧…∧𝙰𝚗​(x)→⊥\mathtt{A_{1}}(x)\wedge\ldots\wedge\mathtt{A_{n}}(x)\to\bot, which are typically allowed in Horn DLs [16]. When computing the rewriting of a Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} query ⟨ℛ,𝙰​(a)⟩\langle\mathcal{R},\mathtt{A}(a)\rangle in the presence of such rules, we may treat ⊥\bot as a normal class and instead compute a GQL rewriting for the rule query ⟨ℛ,𝙰​(a)∨∃w.⊥(w)⟩\langle\mathcal{R},\mathtt{A}(a)\vee\exists w.\bot(w)\rangle; similar ideas have already been considered in e.g. [4]. This approach is correct since, for every fact set ℱ\mathcal{F}, the following hold: the KB ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle is unsatisfiable if and only if it entails ∃w.⊥(w)\exists w.\bot(w); and ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle entails 𝙰​(a)\mathtt{A}(a) if and only if it is unsatisfiable, or ⟨ℛ /⊥,ℱ⟩⊧𝙰​(a)\langle\mathcal{R}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 3.125pt\kern-4.17671pt$\displaystyle\not$\hss}{\bot}}}{\mathrel{\hbox to0.0pt{\kern 3.125pt\kern-4.17671pt$\textstyle\not$\hss}{\bot}}}{\mathrel{\hbox to0.0pt{\kern 1.90555pt\kern-3.0128pt$\scriptstyle\not$\hss}{\bot}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\bot}}}},\mathcal{F}\rangle\models\mathtt{A}(a) with ℛ /⊥\mathcal{R}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 3.125pt\kern-4.17671pt$\displaystyle\not$\hss}{\bot}}}{\mathrel{\hbox to0.0pt{\kern 3.125pt\kern-4.17671pt$\textstyle\not$\hss}{\bot}}}{\mathrel{\hbox to0.0pt{\kern 1.90555pt\kern-3.0128pt$\scriptstyle\not$\hss}{\bot}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\bot}}}} the subset of ℛ\mathcal{R} without syntactic occurrences of ⊥\bot. Extending our translation to other DL constructors, such as role chains, is likely to be more challenging. Nevertheless, complex roles appear amenable to our approach, since these closely correspond to regular languages [6, 21] and could in principle be handled using the techniques from Section˜5.1.

Another direction for future work is to relax the stratification condition in Definition˜5 to capture a broader class of Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} queries expressible in GQL. Indeed, our approach is not complete and fails to characterise queries such as ⟨{𝙰​(x)∧𝙱​(x)→𝙲​(x),𝚁​(x,y)∧𝙰​(x)→𝙰​(x),𝚂​(x,y)∧𝙲​(x)→𝙱​(x)},𝙲​(c)⟩\langle\{\mathtt{A}(x)\wedge\mathtt{B}(x)\to\mathtt{C}(x),\mathtt{R}(x,y)\wedge\mathtt{A}(x)\to\mathtt{A}(x),\mathtt{S}(x,y)\wedge\mathtt{C}(x)\to\mathtt{B}(x)\},\mathtt{C}(c)\rangle because this query is not equivalent to a PQ. Nevertheless, it can be translated into an equivalent nested regular path query, which can in turn be expressed in GQL [12, Theorem 11]. Considering nested regular path queries as a target language for our rewritings may therefore lead to a more general procedure.

Before diving into a deeper theoretical study, an empirical evaluation of our approach may be useful. Namely, one could consider a collection of real-world Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rule sets [20] and determine which are captured by our method, that is, determine how many correspond to a stratified DL automaton (cf. Definitions˜4 and 5). This would help assess (i) whether our translation procedure is sufficiently general to be useful in practice, and (ii) whether simple modifications could be introduced to capture existing queries outside its current scope.

Finally, another relevant direction for future work is to characterize those Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} queries that do not admit an equivalent GQL formulation. In particular, one could aim to obtain results analogous to those in [19], which provide a decidable and complete characterization of ℰ​ℒ\mathcal{EL} queries that admit rewritings into first-order logic and linear Datalog. Our translation into DL automata presented in Section˜4 may prove useful in this regard, as it could enable the transfer of techniques from automata theory, a well-developed area of theoretical computer science, for establishing inexpressibility results.

Acknowledgements.

This research was funded by the Agence Nationale de la Recherche (ANR) under the Expand project (ANR-25-CE23-1215) and the France 2030 project (ANR-23-IACL-0008).

References

  • [1] S. Abiteboul, R. Hull, and V. Vianu (1995) Foundations of databases. Addison-Wesley. External Links: ISBN 0-201-53771-0 Cited by: §2, §6.
  • [2] J. Arpasi, B. J. Bednarczyk, and M. Ortiz (2026) A Horn extension of DL-Lite with NL data complexity. In Proceedings of the 39th International Workshop on Description Logics (DL 2026), CEUR Workshop Proceedings, Vol. 4230. External Links: Link Cited by: §7.
  • [3] F. Baader, D. Calvanese, D. L. McGuinness, D. Nardi, and P. F. Patel-Schneider (Eds.) (2003) The description logic handbook: theory, implementation, and applications. Cambridge University Press. External Links: ISBN 0-521-78176-0 Cited by: §1.
  • [4] A. Calì, G. Gottlob, and T. Lukasiewicz (2012) A general datalog-based framework for tractable query answering over ontologies. J. Web Semant. 14, pp. 57–83. External Links: Link Cited by: §8.
  • [5] D. Calvanese, G. De Giacomo, D. Lembo, M. Lenzerini, and R. Rosati (2007) Tractable reasoning and efficient query answering in description logics: the DL-Lite family. Journal of Automated Reasoning (JAR) 39 (3), pp. 385–429. External Links: ISSN 1573-0670, Link Cited by: Appendix 0.D, §7.
  • [6] D. Carral, L. González, and P. Koopmann (2019) From Horn-𝒮​ℛ​ℐ​𝒬\mathcal{SRIQ} to datalog: A data-independent transformation that preserves assertion entailment. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence (AAAI 2019), pp. 2736–2743. External Links: Link Cited by: §8.
  • [7] A. Deutsch, N. Francis, A. Green, K. Hare, B. Li, L. Libkin, T. Lindaaker, V. Marsault, W. Martens, J. Michels, F. Murlak, S. Plantikow, P. Selmer, O. van Rest, H. Voigt, D. Vrgoč, M. Wu, and F. Zemke (2022) Graph pattern matching in GQL and SQL/PGQ. In Proceedings of the 2022 International Conference on Management of Data (SIGMOD 2022), pp. 2246–2258. External Links: Document Cited by: §1, §6.
  • [8] M. M. Dimartino, A. Calì, A. Poulovassilis, and P. T. Wood (2016) Query rewriting under linear el knowledge bases. In Web Reasoning and Rule Systems, pp. 61–76. External Links: ISBN 978-3-319-45276-0 Cited by: §7.
  • [9] M. M. Dimartino, P. T. Wood, A. Calì, and A. Poulovassilis (2025) Efficient ontology-mediated query answering: extending DL-liteR and linear ℰ​ℒ​ℋ\mathcal{ELH}. Journal of Artificial Intelligence Research 82, pp. 851–899. External Links: Link Cited by: §7.
  • [10] T. Eiter, M. Ortiz, M. Simkus, T. Tran, and G. Xiao (2021) Query rewriting for Horn-𝒮​ℋ​ℐ​𝒬\mathcal{SHIQ} plus rules. Proceedings of the 35th AAAI Conference on Artificial Intelligence (AAAI 2021) 26 (1), pp. 726–733. External Links: Link Cited by: Appendix 0.A, Appendix 0.D, §3, §3.
  • [11] N. Francis, A. Gheerbrant, P. Guagliardo, L. Libkin, V. Marsault, W. Martens, F. Murlak, L. Peterfreund, A. Rogova, and D. Vrgoč (2023) A Researcher’s Digest of GQL. In Proceedings of the 26th International Conference on Database Theory (ICDT 2023), Vol. 255, pp. 1:1–1:22. External Links: Document Cited by: §1, §6.
  • [12] N. Francis, A. Gheerbrant, P. Guagliardo, L. Libkin, V. Marsault, W. Martens, F. Murlak, L. Peterfreund, A. Rogova, and D. Vrgoc (2023) GPC: a pattern calculus for property graphs. In Proceedings of the 42nd ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems (PODS 2023), pp. 241–250. External Links: Document Cited by: §6, §6, §8.
  • [13] P. Hitzler, M. Krötzsch, and S. Rudolph (2010) Foundations of semantic web technologies. Chapman and Hall/CRC Press. External Links: Link, ISBN 9781420090505 Cited by: §1.
  • [14] J. E. Hopcroft, R. Motwani, and J. D. Ullman (2007) Introduction to automata theory, languages, and computation, 3rd edition. Pearson international edition, Addison-Wesley. External Links: ISBN 978-0-321-47617-3 Cited by: §5.1.
  • [15] J. E. Hopcroft and J. D. Ullman (1979) Introduction to automata theory, languages and computation. Addison-Wesley. Cited by: §5.1.
  • [16] M. Krötzsch, S. Rudolph, and P. Hitzler (2013) Complexities of horn description logics. ACM Transactions on Computational Logic (TOCL) 14 (1), pp. 2:1–2:36. External Links: Link Cited by: §2, §3, §8.
  • [17] M. Krötzsch, F. Simancik, and I. Horrocks (2012) A description logic primer. CoRR abs/1201.4089. External Links: Link, 1201.4089 Cited by: footnote 1.
  • [18] B. Löhnert, N. Augsten, C. Okulmus, and M. Ortiz (2025) Towards practicable algorithms for rewriting graph queries beyond DL-Lite. In The Semantic Web, E. Curry, M. Acosta, M. Poveda-Villalón, M. van Erp, A. Ojo, K. Hose, C. Shimizu, and P. Lisena (Eds.), pp. 342–361. External Links: ISBN 978-3-031-94575-5 Cited by: §1, §7.
  • [19] C. Lutz and L. Sabellek (2022) A complete classification of the complexity and rewritability of ontology-mediated queries based on the description logic EL. Artificial Intelligence 308, pp. 103709. External Links: Link Cited by: §8.
  • [20] N. Matentzoglu, D. Tang, B. Parsia, and U. Sattler (2014) The manchester OWL repository: system description. In Proceedings of the 13th International Semantic Web Conference, (ISWC 2014), Posters & Demonstrations Track, CEUR Workshop Proceedings, pp. 285–288. External Links: Link Cited by: §8.
  • [21] F. Simancík (2012) Elimination of complex RIAs without automata. In Proceedings of the 25th International Workshop on Description Logics (DL 2012), Y. Kazakov, D. Lembo, and F. Wolter (Eds.), CEUR Workshop Proceedings. External Links: Link Cited by: §8.

Appendix 0.A Proofs of Section˜3

In this section, we prove the claims leading to Theorem˜3.1. Let ⟨ℛ,α⟩\langle\mathcal{R},\alpha\rangle be a Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} query, and ℛ′\mathcal{R}^{\prime} the rule set obtained as described in Section˜3.

We first verify that ⟨ℛ,α⟩\langle\mathcal{R},\alpha\rangle and ⟨ℛ′,α⟩\langle\mathcal{R}^{\prime},\alpha\rangle are equivalent. Notice that axioms from ℛ′\mathcal{R}^{\prime} are consequences of ℛ\mathcal{R}, and thus it is clear that 𝐐𝐌​(ℛ′,α)⊆𝐐𝐌​(ℛ,α)\mathbf{QM}(\mathcal{R}^{\prime},\alpha)\subseteq\mathbf{QM}(\mathcal{R},\alpha). It remains to prove the converse, that is the following lemma.

Lemma 3

𝐐𝐌​(ℛ′,α)⊇𝐐𝐌​(ℛ,α)\mathbf{QM}(\mathcal{R}^{\prime},\alpha)\supseteq\mathbf{QM}(\mathcal{R},\alpha).

Proof

Let ℱ\mathcal{F} be a fact set such that ⟨ℛ,ℱ⟩⊧α\langle\mathcal{R},\mathcal{F}\rangle\models\alpha, we need to prove that ⟨ℛ′,ℱ⟩⊧α\langle\mathcal{R}^{\prime},\mathcal{F}\rangle\models\alpha. Let ℐ\mathcal{I} be an FO-model of ⟨ℛ′,ℱ⟩\langle\mathcal{R}^{\prime},\mathcal{F}\rangle, we denote Δℐ\Delta^{\mathcal{I}} its domain and ⋅ℐ\cdot^{\mathcal{I}} its interpretation function. We construct an FO-structure 𝒥\mathcal{J} that extends ℐ\mathcal{I} and will be a model of ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle. The domain of 𝒥\mathcal{J} is also Δℐ\Delta^{\mathcal{I}}, it interprets every class as in ℐ\mathcal{I}, and every role 𝚁∈𝖱𝗈𝗅𝖾𝗌\mathtt{R}\in\mathsf{Roles} as follows:

𝚁𝒥:=⋃𝚂∈𝖱𝗈𝗅𝖾𝖤𝗑𝗉𝗌s.t. ​𝚂⊑∗𝚁𝚂ℐ.\mathtt{R}^{\mathcal{J}}:=\bigcup_{\begin{subarray}{c}\mathtt{S}\in\mathsf{RoleExps}\\ \text{s.t.\ }\mathtt{S}\sqsubseteq^{*}\mathtt{R}\end{subarray}}\mathtt{S}^{\mathcal{I}}.

We further refer to the property that, by definition, 𝒥\mathcal{J} and ℐ\mathcal{I} agree on the interpretation of classes as (⋆)(\star). We now verify that 𝒥\mathcal{J} is a model of ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle, which will conclude the proof since it guarantees 𝒥⊧α\mathcal{J}\models\alpha using the assumption that ⟨ℛ,ℱ⟩⊧α\langle\mathcal{R},\mathcal{F}\rangle\models\alpha and consequently ℐ⊧α\mathcal{I}\models\alpha by (⋆)(\star). It is clear that 𝒥⊧ℱ\mathcal{J}\models\mathcal{F}, it thus remains to verify 𝒥⊧ℛ\mathcal{J}\models\mathcal{R}. We examine each possible form of axiom in ℛ\mathcal{R}:

  1. (1)

    Immediate by (⋆)(\star).

  2. (2)

    Assume 𝚁​(x,y)∧𝙰​(y)→𝙱​(x)∈ℛ\mathtt{R}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x)\in\mathcal{R}, (d,e)∈𝚁𝒥(d,e)\in\mathtt{R}^{\mathcal{J}} and e∈𝙰𝒥e\in\mathtt{A}^{\mathcal{J}}. By definition of ℛ′\mathcal{R}^{\prime}, we have 𝚁​(x,y)∧𝙰​(y)→𝙱​(x)∈ℛ′\mathtt{R}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x)\in\mathcal{R}^{\prime} and, by (⋆)(\star), we have e∈𝙰ℐe\in\mathtt{A}^{\mathcal{I}}. By definition of 𝚁𝒥\mathtt{R}^{\mathcal{J}}, we have (d,e)∈𝚂ℐ(d,e)\in\mathtt{S}^{\mathcal{I}} for some 𝚂⊑∗𝚁\mathtt{S}\sqsubseteq^{*}\mathtt{R}. Now, either 𝚂∈𝖱𝗈𝗅𝖾𝗌\mathtt{S}\in\mathsf{Roles}, and then we have 𝚂​(x,y)∧𝙰​(y)→𝙱​(x)∈ℛ′\mathtt{S}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x)\in\mathcal{R}^{\prime} by definition of ℛ′\mathcal{R}^{\prime}, or 𝚂∈𝖨𝗇𝗏𝖱𝗈𝗅𝖾𝗌\mathtt{S}\in\mathsf{InvRoles} and we have 𝙰​(x)∧𝚂​(x,y)→𝙱​(y)∈ℛ′\mathtt{A}(x)\wedge\mathtt{S}(x,y)\to\mathtt{B}(y)\in\mathcal{R}^{\prime}. Either way, ℐ⊧ℛ′\mathcal{I}\models\mathcal{R}^{\prime} yields d∈𝙱ℐd\in\mathtt{B}^{\mathcal{I}}, and we conclude using (⋆)(\star).

  3. (3)

    Assume 𝙰​(x)∧𝚁​(x,y)→𝙱​(y)∈ℛ\mathtt{A}(x)\wedge\mathtt{R}(x,y)\to\mathtt{B}(y)\in\mathcal{R}, (d,e)∈𝚁𝒥(d,e)\in\mathtt{R}^{\mathcal{J}} and d∈𝙰𝒥d\in\mathtt{A}^{\mathcal{J}}. By definition of ℛ′\mathcal{R}^{\prime}, we have 𝙰​(x)∧𝚁​(x,y)→𝙱​(y)∈ℛ′\mathtt{A}(x)\wedge\mathtt{R}(x,y)\to\mathtt{B}(y)\in\mathcal{R}^{\prime} and, by (⋆)(\star), we have d∈𝙰ℐd\in\mathtt{A}^{\mathcal{I}}. By definition of 𝚁𝒥\mathtt{R}^{\mathcal{J}}, we have (d,e)∈𝚂ℐ(d,e)\in\mathtt{S}^{\mathcal{I}} for some 𝚂⊑∗𝚁\mathtt{S}\sqsubseteq^{*}\mathtt{R}. Now, either 𝚂∈𝖱𝗈𝗅𝖾𝗌\mathtt{S}\in\mathsf{Roles}, and then we have 𝙰​(x)∧𝚂​(x,y)→𝙱​(y)∈ℛ′\mathtt{A}(x)\wedge\mathtt{S}(x,y)\to\mathtt{B}(y)\in\mathcal{R}^{\prime} by definition of ℛ′\mathcal{R}^{\prime}, or 𝚂∈𝖨𝗇𝗏𝖱𝗈𝗅𝖾𝗌\mathtt{S}\in\mathsf{InvRoles} and we have 𝚂​(x,y)∧𝙰​(y)→𝙱​(x)∈ℛ′\mathtt{S}(x,y)\wedge\mathtt{A}(y)\to\mathtt{B}(x)\in\mathcal{R}^{\prime}. Either way, ℐ⊧ℛ′\mathcal{I}\models\mathcal{R}^{\prime} yields e∈𝙱ℐe\in\mathtt{B}^{\mathcal{I}}, and we conclude using (⋆)(\star).

  4. (4)

    Immediate by (⋆)(\star).

  5. (5)

    Assume 𝙰​(x)→∃y.𝚁​(x,y)∧𝙱​(y)∈ℛ\mathtt{A}(x)\to\exists y.\mathtt{R}(x,y)\wedge\mathtt{B}(y)\in\mathcal{R} and d∈𝙰𝒥d\in\mathtt{A}^{\mathcal{J}}. By definition of ℛ′\mathcal{R}^{\prime}, we have 𝙰​(x)→∃y.𝚁​(x,y)∧𝙱​(y)∈ℛ′\mathtt{A}(x)\to\exists y.\mathtt{R}(x,y)\wedge\mathtt{B}(y)\in\mathcal{R}^{\prime} and, by (⋆)(\star), we have d∈𝙰ℐd\in\mathtt{A}^{\mathcal{I}}. Since ℐ⊧ℛ′\mathcal{I}\models\mathcal{R}^{\prime}, there exists e∈𝙱ℐe\in\mathtt{B}^{\mathcal{I}} such that (d,e)∈𝚁ℐ(d,e)\in\mathtt{R}^{\mathcal{I}}. Using that ⊑∗\sqsubseteq^{*} is reflexive, the definition of 𝚁𝒥\mathtt{R}^{\mathcal{J}} yields (d,e)∈𝚁𝒥(d,e)\in\mathtt{R}^{\mathcal{J}}. Using (⋆)(\star), we obtain e∈𝙱𝒥e\in\mathtt{B}^{\mathcal{J}} and we are done.

  6. (6)

    Immediate by construction of 𝒥\mathcal{J} and ⊑∗\sqsubseteq^{*} being transitive.

  7. (7)

    Immediate by construction of 𝒥\mathcal{J} and ⊑∗\sqsubseteq^{*} being transitive.

We now explain how the Datalog translation proposed in [10] can be applied to ℛ′\mathcal{R}^{\prime}. Let us highlight that ℛ′\mathcal{R}^{\prime} complies with the normal form demanded in [10]: axioms of ℛ′\mathcal{R}^{\prime} with forms (1) or (4) are exactly in their form (F1); those with forms (2) or (3) are exactly in their form (F2) (since the latter supports inverse roles!); and those with form (5) are exactly in their form (F3). In particular, ℛ′\mathcal{R}^{\prime} does not contain any axiom in their form (F4). In turn, it follows that, when applying the inference rules from Table 2 in [10], their Rules 𝐑≤\mathbf{R}_{\leq} and 𝐑≤−\mathbf{R}^{-}_{\leq} are never applied. The same holds for their Rule 𝐑⊑r\mathbf{R}^{r}_{\sqsubseteq} since ℛ′\mathcal{R}^{\prime} does not contain role inclusions, and Rule 𝐑⊥\mathbf{R}_{\bot} since we restricted our attention to positive Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rules. These observations further guarantee that, applying the final translation in Table 3 [10], only the first two completion rules are ever applied. Therefore, we obtain a set ℛ′′\mathcal{R}^{\prime\prime} of Datalog rules whose rules are of form B​(y)←A​(x),r​(x,y)B(y)\leftarrow A(x),r(x,y) and B​(x)←A1​(x),…,An​(x)B(x)\leftarrow A_{1}(x),\dots,A_{n}(x), where rr is possibly an inverse role. Now, B​(x)←A1​(x),…,An​(x)B(x)\leftarrow A_{1}(x),\dots,A_{n}(x) rules are either in forms (1) or (4) in our formalism, while B​(y)←A​(x),r​(x,y)B(y)\leftarrow A(x),r(x,y) rules are either in form (3) if r∈𝖱𝗈𝗅𝖾𝗌r\in\mathsf{Roles}, or in form (2) if r∈𝖨𝗇𝗏𝖱𝗈𝗅𝖾𝗌r\in\mathsf{InvRoles}. Altogether, we obtained a set ℛ′′\mathcal{R}^{\prime\prime} of Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} rules such that, for every class fact α\alpha, ⟨ℛ′′,α⟩\langle\mathcal{R}^{\prime\prime},\alpha\rangle is equivalent to ⟨ℛ′,α⟩\langle\mathcal{R}^{\prime},\alpha\rangle [10, Theorem 3], thus equivalent to ⟨ℛ,α⟩\langle\mathcal{R},\alpha\rangle. This concludes the proof of Theorem 3.1.

Appendix 0.B Proofs of Section˜4

In this section, we prove Example˜5, which establishes the equivalence between a Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ\gamma and the corresponding automaton 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma). More precisely, we prove Lemmas˜5 and 4, from which the theorem follows directly as a corollary.

Lemma 4

A Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.07838pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.53394pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ\gamma is contained in the DL automaton 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma).

Proof

We fix a Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ=⟨ℛ,𝙰​(a)⟩\gamma=\langle\mathcal{R},\mathtt{A}(a)\rangle, the DL automaton 𝐃𝐋𝐀​(γ)=⟨a,Q,q𝙰,δ⟩\mathbf{DLA}(\gamma)=\langle a,Q,q_{\mathtt{A}},\delta\rangle, and a fact set ℱ\mathcal{F}. To prove the lemma, we assume that ℱ∈𝐐𝐌​(γ)\mathcal{F}\in\mathbf{QM}(\gamma) and show that this implies ℱ∈𝐐𝐌​(𝐃𝐋𝐀​(γ))\mathcal{F}\in\mathbf{QM}(\mathbf{DLA}(\gamma)). More precisely, we establish that for any given fact 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}), there is an accepting run of 𝐃𝐋𝐀​(ℛ,𝙱​(b))\mathbf{DLA}(\mathcal{R},\mathtt{B}(b)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle. Applying this claim to the fact 𝙰​(a)\mathtt{A}(a), we obtain an accepting run of 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma) over ℱ\mathcal{F} from ⟨q𝙰,a⟩\langle q_{\mathtt{A}},a\rangle, and therefore ℱ∈𝐐𝐌​(𝐃𝐋𝐀​(γ))\mathcal{F}\in\mathbf{QM}(\mathbf{DLA}(\gamma)). We prove the claim by induction on the depth of 𝙱​(b)\mathtt{B}(b) with respect to ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle. Recall also that 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}) if and only if ⟨ℛ,ℱ⟩⊧𝙱​(b)\langle\mathcal{R},\mathcal{F}\rangle\models\mathtt{B}(b) by Proposition˜1.

For the base case, we assume that 𝙱​(b)\mathtt{B}(b) has depth 1 with respect to ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle, which implies that 𝙱​(b)∈ℱ\mathtt{B}(b)\in\mathcal{F}. Consider now the directed labelled tree ⟨{r,r′},{r→r′},L⟩\langle\{r,r^{\prime}\},\{r\to r^{\prime}\},L\rangle, where LL is the labelling function mapping rr to ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle and r′r^{\prime} to ⟨qacc,b⟩\langle q_{\textit{acc}},b\rangle. This tree is an accepting run of 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle. Observe that it has a unique leaf labelled with the accepting state. Moreover, the edge r→r′r\to r^{\prime} is valid, since 𝙱​(b)∈ℱ\mathtt{B}(b)\in\mathcal{F} and q𝙱↝𝙱{qacc}∈δq_{\mathtt{B}}\rightsquigarrow_{\mathtt{B}}\{q_{\textit{acc}}\}\in\delta.

For the induction step, we assume that 𝙱​(b)\mathtt{B}(b) has depth k≥2k\geq 2 with respect to ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle. Then at least one of the following cases applies:

  • •

    There is a rule of the form 𝚁​(x,y)∧𝙲​(y)→𝙱​(x)∈ℛ\mathtt{R}(x,y)\land\mathtt{C}(y)\to\mathtt{B}(x)\in\mathcal{R} and a constant cc such that 𝚁​(b,c),𝙲​(c)∈𝐂𝐡k−1​(ℛ,ℱ)\mathtt{R}(b,c),\mathtt{C}(c)\in\mathbf{Ch}_{k-1}(\mathcal{R},\mathcal{F}). By induction hypothesis, there is an accepting run ⟨N,E,L⟩\langle N,E,L\rangle of 𝐃𝐋𝐀​(ℛ,𝙲​(c))\mathbf{DLA}(\mathcal{R},\mathtt{C}(c)) over ℱ\mathcal{F} from ⟨q𝙲,c⟩\langle q_{\mathtt{C}},c\rangle. Consider the directed labelled tree ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle where N′=N∪{r}N^{\prime}=N\cup\{r\} for some fresh node rr, E′=E∪{r→r′}E^{\prime}=E\cup\{r\to r^{\prime}\} where r′r^{\prime} is the root node of ⟨N,E,L⟩\langle N,E,L\rangle, and L′L^{\prime} is the function that extends LL and maps rr to ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle. We argue that ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle is an accepting run for 𝐃𝐋𝐀​(ℛ,𝙱​(b))\mathbf{DLA}(\mathcal{R},\mathtt{B}(b)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle:

    • –

      Since 𝚁​(x,y)∧𝙲​(y)→𝙱​(x)∈ℛ\mathtt{R}(x,y)\land\mathtt{C}(y)\to\mathtt{B}(x)\in\mathcal{R}, we have that q𝙱↝𝚁{q𝙲}∈δq_{\mathtt{B}}\rightsquigarrow_{\mathtt{R}}\{q_{\mathtt{C}}\}\in\delta. Since no rule allows the derivation of binary facts, we have that 𝚁​(b,c)∈ℱ\mathtt{R}(b,c)\in\mathcal{F}, which implies that the edge r→r′r\to r^{\prime} is valid as per Definition˜3. Therefore ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle is a run, as all other edges in this tree satisfy the same definition by induction hypothesis.

    • –

      The leaves in ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle are exactly the leaves of ⟨N,E,L⟩\langle N,E,L\rangle. Hence, all of the leaves in ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle feature the accepting state.

  • •

    There is a rule of the form 𝙲​(y)∧𝚁​(x,y)→𝙱​(x)∈ℛ\mathtt{C}(y)\wedge\mathtt{R}(x,y)\to\mathtt{B}(x)\in\mathcal{R} and a constant cc such that 𝙲​(c),𝚁​(c,b)∈𝐂𝐡k−1​(ℛ,ℱ)\mathtt{C}(c),\mathtt{R}(c,b)\in\mathbf{Ch}_{k-1}(\mathcal{R},\mathcal{F}). This case is analogous to the previous one.

  • •

    There is a rule of the form 𝙲1​(x)∧…∧𝙲n​(x)→𝙱​(x)∈ℛ\mathtt{C}_{1}(x)\wedge\ldots\wedge\mathtt{C}_{n}(x)\to\mathtt{B}(x)\in\mathcal{R} with 𝙲1​(b),…,𝙲n​(b)∈𝐂𝐡k−1​(ℛ,ℱ)\mathtt{C}_{1}(b),\ldots,\mathtt{C}_{n}(b)\in\mathbf{Ch}_{k-1}(\mathcal{R},\mathcal{F}). By induction hypothesis, there is an accepting run ⟨Ni,Ei,Li⟩\langle N_{i},E_{i},L_{i}\rangle of 𝐃𝐋𝐀​(ℛ,𝙲i​(b))\mathbf{DLA}(\mathcal{R},\mathtt{C}_{i}(b)) over ℱ\mathcal{F} from ⟨q𝙲i,b⟩\langle q_{\mathtt{C}_{i}},b\rangle for every 1≤i≤n1\leq i\leq n. Consider the directed labeled tree ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle where N′=N1∪…∪Nn∪{r}N^{\prime}=N_{1}\cup\ldots\cup N_{n}\cup\{r\} with rr a fresh node, E′=E1∪…∪En∪{r→r1,…,r→rn}E^{\prime}=E_{1}\cup\ldots\cup E_{n}\cup\{r\to r_{1},\ldots,r\to r_{n}\} with rir_{i} the root node of ⟨Ni,Ei,Li⟩\langle N_{i},E_{i},L_{i}\rangle for every 1≤i≤n1\leq i\leq n, and L′L^{\prime} is the function that extends Li∪…∪LnL_{i}\cup\ldots\cup L_{n} and maps rr to ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle. We argue that ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle is an accepting run for 𝐃𝐋𝐀​(ℛ,𝙱​(b))\mathbf{DLA}(\mathcal{R},\mathtt{B}(b)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle:

    • –

      As 𝙲1​(x)∧…∧𝙲n​(x)→𝙱​(x)∈ℛ\mathtt{C}_{1}(x)\wedge\ldots\wedge\mathtt{C}_{n}(x)\to\mathtt{B}(x)\in\mathcal{R}, we have that q𝙱↝ε{q𝙲1,…,q𝙲n}∈δq_{\mathtt{B}}\rightsquigarrow_{\varepsilon}\{q_{\mathtt{C}_{1}},\ldots,q_{\mathtt{C}_{n}}\}\in\delta. This implies that the edges r→r1r\to r_{1} through r→rnr\to r_{n} in E′E^{\prime} are valid as per Definition˜3. Therefore ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle is a run, as all other edges in this tree satisfy the same definition by induction hypothesis.

    • –

      The leaves in ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle are exactly the union of the leaves of the ⟨Ni,Ei,Li⟩\langle N_{i},E_{i},L_{i}\rangle. Hence, all of the leaves in ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle feature the accepting state.

  • •

    There is a rule of the form →𝙱​(x)∈ℛ\to\mathtt{B}(x)\in\mathcal{R}. Consider the directed labelled tree ⟨r,ℓ,r→ℓ,L⟩\langle{r,\ell},{r\to\ell},L\rangle, where LL maps rr to ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle and ℓ\ell to ⟨qacc,b⟩\langle q_{\textit{acc}},b\rangle. This tree is an accepting run of 𝐃𝐋𝐀​(ℛ,𝙱​(b))\mathbf{DLA}(\mathcal{R},\mathtt{B}(b)) over ℱ\mathcal{F} starting from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle. Note that q𝙱↝ε{qacc}∈δq_{\mathtt{B}}\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\delta since →𝙱​(x)∈ℛ\to\mathtt{B}(x)\in\mathcal{R}.

In either case, there is an accepting run of 𝐃𝐋𝐀​(ℛ,𝙱​(b))\mathbf{DLA}(\mathcal{R},\mathtt{B}(b)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle.

Lemma 5

A Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.24228pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.07838pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.53394pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ\gamma contains the DL automaton 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma).

Proof

We fix a Horn-​𝒜​ℒ​𝒞 /​∃\textit{Horn-}\mathcal{ALC}_{\mathchoice{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\displaystyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 2.26389pt\kern-4.17671pt$\textstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 1.36111pt\kern-3.0128pt$\scriptstyle\not$\hss}{\exists}}}{\mathrel{\hbox to0.0pt{\kern 0.97221pt\kern-2.46837pt$\scriptscriptstyle\not$\hss}{\exists}}}} query γ=⟨ℛ,𝙰​(a)⟩\gamma=\langle\mathcal{R},\mathtt{A}(a)\rangle and a fact set ℱ\mathcal{F}. To prove the lemma, we assume that ℱ∈𝐐𝐌​(𝐃𝐋𝐀​(γ))\mathcal{F}\in\mathbf{QM}(\mathbf{DLA}(\gamma)) and show that ℱ∈𝐐𝐌​(γ)\mathcal{F}\in\mathbf{QM}(\gamma). More precisely, we argue that, given some fact 𝙱​(b)\mathtt{B}(b), if there is an accepting run of 𝐃𝐋𝐀​(ℛ,𝙰​(a))\mathbf{DLA}(\mathcal{R},\mathtt{A}(a)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle, then 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}). This implies in particular that 𝙰​(a)∈𝐂𝐡​(ℛ,ℱ)\mathtt{A}(a)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}), and therefore that ℱ∈𝐐𝐌​(γ)\mathcal{F}\in\mathbf{QM}(\gamma). The proof proceeds by induction on the height of the accepting run of the fact 𝙱​(b)\mathtt{B}(b). Recall that a fact is entailed by ⟨ℛ,ℱ⟩\langle\mathcal{R},\mathcal{F}\rangle if and only if it is in 𝐂𝐡​(ℛ,ℱ)\mathbf{Ch}(\mathcal{R},\mathcal{F}) by Proposition˜1.

Given some fact 𝙱​(b)\mathtt{B}(b), there is no accepting run of 𝐃𝐋𝐀​(ℛ,𝙰​(a))\mathbf{DLA}(\mathcal{R},\mathtt{A}(a)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle of height 11. Indeed, the unique node of such a run would have to feature both q𝙱q_{\mathtt{B}} and qaccq_{\textit{acc}} in its label, which is impossible since these are distinct states. Hence, the base case of our induction starts with runs of height 22.

Regarding the base case, we assume that there is an accepting run of 𝐃𝐋𝐀​(ℛ,𝙰​(a))\mathbf{DLA}(\mathcal{R},\mathtt{A}(a)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle of height 2. In this case, the root node of this run is labelled ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle and all of the labels of its children feature the accepting state. Therefore, there are only two possible cases:

  • •

    We have that 𝙱​(b)∈ℱ\mathtt{B}(b)\in\mathcal{F}. Note that q𝙱↝𝙱{qacc}q_{\mathtt{B}}\rightsquigarrow_{\mathtt{B}}\{q_{\textit{acc}}\} is a transition of 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma).

  • •

    We have that q𝙱↝ε{qacc}q_{\mathtt{B}}\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\} is a transition of 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma). Note that, in this case, we have that →𝙱​(x)∈ℛ\to\mathtt{B}(x)\in\mathcal{R}.

In either case, we have that 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}). Recall that bb occurs in ℱ\mathcal{F} since there is an accepting run of 𝐃𝐋𝐀​(ℛ,𝙰​(a))\mathbf{DLA}(\mathcal{R},\mathtt{A}(a)) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle.

Regarding the induction step, let us consider an accepting run ⟨N,E,L⟩\langle N,E,L\rangle for 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma) over ℱ\mathcal{F} from ⟨q𝙱,b⟩\langle q_{\mathtt{B}},b\rangle of height k>2k>2. We consider two different cases depending if the root node rr of this run has one child or more.

  • •

    Assume that the root rr has a unique child r′r^{\prime}, which does not feature qaccq_{\textit{acc}} in its label by Remark˜1. Then, by Definition˜3 and Remark˜1, one of the following cases must hold:

    • –

      There is some class 𝙲\mathtt{C} such that r′r^{\prime} is labelled with ⟨q𝙲,b⟩\langle q_{\mathtt{C}},b\rangle, q𝙱↝ε{q𝙲}∈𝐃𝐋𝐀​(γ)q_{\mathtt{B}}\rightsquigarrow_{\varepsilon}{\{q_{\mathtt{C}}\}}\in\mathbf{DLA}(\gamma), and 𝙲​(b)∈ℱ\mathtt{C}(b)\in\mathcal{F}. Now consider the tree ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle obtained by removing rr from ⟨N,E,L⟩\langle N,E,L\rangle, which is of height k−1k-1 and is an accepting run for 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma) from ⟨q𝙲,b⟩\langle q_{\mathtt{C}},b\rangle over ℱ\mathcal{F}. Hence, 𝙲​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{C}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}) by induction hypothesis. Therefore, 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}) since 𝙲​(x)→𝙱​(x)∈ℛ\mathtt{C}(x)\to\mathtt{B}(x)\in\mathcal{R}.

    • –

      There are a class 𝙲\mathtt{C} and a constant cc such that r′r^{\prime} is labelled with ⟨q𝙲,c⟩\langle q_{\mathtt{C}},c\rangle, q𝙱↝𝚁q𝙲∈𝐃𝐋𝐀​(γ)q_{\mathtt{B}}\rightsquigarrow_{\mathtt{R}}{q_{\mathtt{C}}}\in\mathbf{DLA}(\gamma), and 𝚁​(b,c)∈ℱ\mathtt{R}(b,c)\in\mathcal{F}. Now consider the tree ⟨N′,E′,L′⟩\langle N^{\prime},E^{\prime},L^{\prime}\rangle obtained by removing rr from ⟨N,E,L⟩\langle N,E,L\rangle, which is of height k−1k-1 and is accepting for 𝐃𝐋𝐀​(ℛ,𝙲​(c))\mathbf{DLA}(\mathcal{R},\mathtt{C}(c)) over ℱ\mathcal{F} from ⟨q𝙲,c⟩\langle q_{\mathtt{C}},c\rangle. Hence, 𝙲​(c)∈𝐂𝐡​(ℛ,ℱ)\mathtt{C}(c)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}) by the induction hypothesis. Therefore, 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}) since 𝚁​(x,y)∧𝙲​(y)→𝙱​(x)∈ℛ\mathtt{R}(x,y)\wedge\mathtt{C}(y)\to\mathtt{B}(x)\in\mathcal{R}.

    • –

      There are a class 𝙲\mathtt{C} and a constant cc such that r′r^{\prime} is labelled with ⟨q𝙲,c⟩\langle q_{\mathtt{C}},c\rangle, q𝙱↝𝚁−q𝙲∈𝐃𝐋𝐀​(ℛ,𝙲​(c))q_{\mathtt{B}}\rightsquigarrow_{\mathtt{R}^{-}}{q_{\mathtt{C}}}\in\mathbf{DLA}(\mathcal{R},\mathtt{C}(c)), and 𝚁​(c,b)∈ℱ\mathtt{R}(c,b)\in\mathcal{F}. This case is analogous to the previous one.

  • •

    Consider the root rr and its multiple children r1,…,rnr_{1},\ldots,r_{n}. By Definition˜3, there are some 𝙲1,…,𝙲n∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}_{1},\ldots,\mathtt{C}_{n}\in\mathsf{Classes} such that r1r_{1} is labelled with ⟨q𝙲1,b⟩\langle q_{\mathtt{C}_{1}},b\rangle, r2r_{2} with ⟨q𝙲2,b⟩\langle q_{\mathtt{C}_{2}},b\rangle, and so on. Moreover, q𝙱↝ε{q𝙲1,…,q𝙲n}q_{\mathtt{B}}\rightsquigarrow_{\varepsilon}\{q_{\mathtt{C}_{1}},\ldots,q_{\mathtt{C}_{n}}\} in 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma). Now, for every 1≤i≤n1\leq i\leq n, consider the subtree ⟨Ni,Ei,Li⟩\langle N_{i},E_{i},L_{i}\rangle of ⟨N,E,L⟩\langle N,E,L\rangle rooted at rir_{i}, which is of height at most k−1k-1 and is an accepting run of 𝐃𝐋𝐀​(γ)\mathbf{DLA}(\gamma) over ℱ\mathcal{F} from ⟨q𝙲i,b⟩\langle q_{\mathtt{C}_{i}},b\rangle. From the existence of this trees, we conclude that 𝙲1​(b),…,𝙲n​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{C}_{1}(b),\ldots,\mathtt{C}_{n}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}) by induction hypothesis. Therefore, 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}) since 𝙲1​(x)∧…∧𝙲n​(x)→𝙱​(x)∈ℛ\mathtt{C}_{1}(x)\wedge\ldots\wedge\mathtt{C}_{n}(x)\to\mathtt{B}(x)\in\mathcal{R}.

In either case above, we have 𝙱​(b)∈𝐂𝐡​(ℛ,ℱ)\mathtt{B}(b)\in\mathbf{Ch}(\mathcal{R},\mathcal{F}).

Appendix 0.C Proofs of Section˜5

In this section, we provide complete proofs of the results from Section˜5. More precisely, we prove Lemmas 7, 7, and 8. Note that Example˜8 follows directly as a corollary of the latter two lemmas.

\lemmatransitioncrpq

*

Proof

We first prove the forward implication of the equivalence stated in the lemma. Assume that there is an accepting run of 𝔑\mathfrak{N} on ℱ\mathcal{F} starting from ⟨q,s⟩\langle q,s\rangle, and let n1,…,nkn_{1},\ldots,n_{k} be the sequence of nodes occurring, in order, along the unique branch of this run. Note that k≥2k\geq 2 since qq is different from the accepting state. Then we are in one of the following cases:

  • •

    If k=2k=2, then either q↝ε{qacc}∈𝔑q\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\mathfrak{N} or, otherwise, q↝𝙲{qacc}∈𝔑q\rightsquigarrow_{\mathtt{C}}\{q_{\textit{acc}}\}\in\mathfrak{N} for some 𝙲∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}\in\mathsf{Classes}. In the first case, the disjunct ⊤\top is in 𝐏𝐐NFA​(𝔑,q,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,s), and that disjunct is entailed by ℱ\mathcal{F}. In the second case, the disjunct 𝙲​(s)\mathtt{C}(s) is in 𝐏𝐐NFA​(𝔑,q,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,s), and that disjunct is entailed by ℱ\mathcal{F} since 𝙲​(s)∈ℱ\mathtt{C}(s)\in\mathcal{F}. Note that this fact is in ℱ\mathcal{F} because the run is accepting and q↝ε{qacc}∉𝔑q\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\notin\mathfrak{N}.

  • •

    If k≥3k\geq 3, then consider the node nk−1n_{k-1} and its label ⟨p,t⟩\langle p,t\rangle. Since the NFA can transition from ⟨q,s⟩\langle q,s\rangle to ⟨p,t⟩\langle p,t\rangle in ℱ\mathcal{F}, we have that ℱ\mathcal{F} entails 𝔈q⊳p𝔑​(s,t)\mathfrak{E}^{\mathfrak{N}}_{q\triangleright p}(s,t) from Lemma˜1. Now, one of the following cases must hold:

    • –

      If p↝ε{qacc}∈𝔑p\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\mathfrak{N}, then the disjunct ∃x.𝔈q⊳p𝔑​(s,x)\exists x.\mathfrak{E}^{\mathfrak{N}}_{q\triangleright p}(s,x) is in 𝐏𝐐NFA​(𝔑,q,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,s) and ℱ\mathcal{F} entails this disjunct, since this fact set entails 𝔈q⊳p𝔑​(s,t)\mathfrak{E}^{\mathfrak{N}}_{q\triangleright p}(s,t).

    • –

      If not, then there is some 𝙲∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}\in\mathsf{Classes} such that p↝𝙲qacc∈𝔑p\rightsquigarrow_{\mathtt{C}}{q_{\textit{acc}}}\in\mathfrak{N}, and, since the run is accepting, 𝙲​(t)∈ℱ\mathtt{C}(t)\in\mathcal{F}. In this case, the disjunct ∃x.𝔈q⊳p𝔑​(s,x)∧𝙲​(x)\exists x.\mathfrak{E}^{\mathfrak{N}}_{q\triangleright p}(s,x)\wedge\mathtt{C}(x) occurs in 𝐏𝐐NFA​(𝔑,q,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,s) and is entailed by ℱ\mathcal{F}. This is indeed the case since ℱ\mathcal{F} entails both 𝔈q⊳p𝔑​(s,t)\mathfrak{E}^{\mathfrak{N}}_{q\triangleright p}(s,t) and 𝙲​(t)\mathtt{C}(t).

In either case, we have that ℱ\mathcal{F} satisfies 𝐏𝐐NFA​(𝔑,q,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,s).

For the reverse direction of the equivalence, assume that ℱ\mathcal{F} satisfies 𝐏𝐐NFA​(𝔑,q,s)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,s). Then ℱ\mathcal{F} satisfies at least one disjunct ψ\psi of this PQ. Depending on the type of disjunct satisfied by ℱ\mathcal{F}, one of the following cases applies:

  • •

    If ψ=⊤\psi=\top, then there is a transition q↝ε{qacc}∈𝔑q\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\mathfrak{N}. In that case, the run from ⟨q,s⟩\langle q,s\rangle to ⟨qacc,s⟩\langle q_{\textit{acc}},s\rangle is accepting for ℱ\mathcal{F} in 𝔑\mathfrak{N}.

  • •

    If ψ=𝙲​(s)\psi=\mathtt{C}(s) for some 𝙲∈𝖢𝗅𝖺𝗌𝗌𝖾𝗌\mathtt{C}\in\mathsf{Classes}, then we have q↝𝙲{qacc}∈𝔑q\rightsquigarrow_{\mathtt{C}}\{q_{\textit{acc}}\}\in\mathfrak{N}. In that case, the run ℱ\mathcal{F} from ⟨q,s⟩\langle q,s\rangle to ⟨qacc,s⟩\langle q_{\textit{acc}},s\rangle is accepting since 𝙲​(s)∈ℱ\mathtt{C}(s)\in\mathcal{F}.

  • •

    Assume that ψ\psi is of the form ∃w.𝔈q⊳p𝔑​(s,w)∧𝙲​(w)\exists w.\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}}(s,w)\wedge\mathtt{C}(w). Then, there is some constant tt such that ℱ\mathcal{F} entails 𝔈q⊳p𝔑​(s,t)\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}}(s,t) and 𝙲​(t)\mathtt{C}(t), and p↝𝙲{qacc}∈𝔑p\rightsquigarrow_{\mathtt{C}}\{q_{\textit{acc}}\}\in\mathfrak{N}. From Lemma˜1, we conclude that 𝔑\mathfrak{N} can transition from ⟨q,s⟩\langle q,s\rangle to ⟨p,t⟩\langle p,t\rangle in ℱ\mathcal{F}, that is, that there is a run of 𝔑\mathfrak{N} over ℱ\mathcal{F} that starts on a node labelled with ⟨q,s⟩\langle q,s\rangle and ends on a node labelled ⟨p,t⟩\langle p,t\rangle. If we append one more node at the end of this run labelled with ⟨qacc,t⟩\langle q_{\textit{acc}},t\rangle, we obtain an accepting run of 𝔑\mathfrak{N} starting ⟨q,s⟩\langle q,s\rangle over ℱ\mathcal{F}; recall that p↝𝙲{qacc}∈𝔑p\rightsquigarrow_{\mathtt{C}}\{q_{\textit{acc}}\}\in\mathfrak{N} and that 𝙲​(t)∈ℱ\mathtt{C}(t)\in\mathcal{F}.

  • •

    Assume that ψ\psi is of the form ∃w.𝔈q⊳p𝔑​(s,w)\exists w.\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}}(s,w). Then, there is some constant tt such that ℱ\mathcal{F} entails 𝔈q⊳p𝔑​(s,t)\mathfrak{E}_{q\triangleright p}^{\mathfrak{N}}(s,t), and p↝ε{qacc}∈𝔑p\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\mathfrak{N}. From Lemma˜1, we conclude that 𝔑\mathfrak{N} can transition from ⟨q,s⟩\langle q,s\rangle to ⟨p,t⟩\langle p,t\rangle in ℱ\mathcal{F}, that is, that there is a run of 𝔑\mathfrak{N} over ℱ\mathcal{F} that starts on a node labelled with ⟨q,s⟩\langle q,s\rangle and ends on a node labelled ⟨p,t⟩\langle p,t\rangle. If we append one more node at the end of this run labelled with ⟨qacc,t⟩\langle q_{\textit{acc}},t\rangle, we obtain an accepting run of 𝔑\mathfrak{N} starting ⟨q,s⟩\langle q,s\rangle over ℱ\mathcal{F}; recall that p↝ε{qacc}∈𝔑p\rightsquigarrow_{\varepsilon}\{q_{\textit{acc}}\}\in\mathfrak{N}.

In any case, we have an accepting run for 𝔑\mathfrak{N} from ⟨q,s⟩\langle q,s\rangle over ℱ\mathcal{F}.

We then show a preliminary lemma allowing us to substitute an automaton 𝔄\mathfrak{A} to its extended version: for the following, we will assume that 𝔄\mathfrak{A} is in extended form.

Lemma 6

Consider an automaton 𝔄=⟨s,Q,qinit,δ⟩\mathfrak{A}=\langle s,Q,q_{\textit{init}},\delta\rangle and its extended version 𝔄ε=⟨s,Q,qinit,δ∪δε∗⟩\mathfrak{A}_{\varepsilon}=\langle s,Q,q_{\textit{init}},\delta\cup\delta_{\varepsilon}^{*}\rangle. For every fact set ℱ\mathcal{F}, state p∈Qp\in Q, and constant cc, there is an accepting run of 𝔄\mathfrak{A} over ℱ\mathcal{F} from ⟨c,p⟩\langle c,p\rangle if and only if there is an accepting run of 𝔄ε\mathfrak{A}_{\varepsilon} over ℱ\mathcal{F} from ⟨c,p⟩\langle c,p\rangle. Therefore, 𝔄\mathfrak{A} and 𝔄ε\mathfrak{A}_{\varepsilon} are equivalent.

Proof

The inclusion of 𝔄\mathfrak{A} in 𝔄ε\mathfrak{A}_{\varepsilon} is trivial. For the other direction, we show that every ε\varepsilon- transition of 𝔄ε\mathfrak{A}_{\varepsilon} can be simulated by a finite sequence of ε\varepsilon-transitions in δ\delta: from this, it follows that if there is an accepting run on 𝔄ε\mathfrak{A}_{\varepsilon} for some fact set ℱ\mathcal{F}, starting node ⟨p,c⟩\langle p,c\rangle then there is an accepting run on 𝔄\mathfrak{A} for the same fact set and starting node.

First note that we can express δε∗\delta_{\varepsilon}^{*} as the (finite) limit of some δ0,…,δn,…\delta_{0},\ldots,\delta_{n},\ldots defined such that δ0={q↝εq∣q∈Q}\delta_{0}=\{q\rightsquigarrow_{\varepsilon}q\mid q\in Q\} and for every i≥0i\geq 0, δi+1=δi∪{q↝ε(P∖{p})∪P′∣q∈Q}\delta_{i+1}=\delta_{i}\cup\{q\rightsquigarrow_{\varepsilon}(P\setminus\{p\})\cup P^{\prime}\mid q\in Q\} where pp is a state, and PP and P′P^{\prime} are sets of states such that q↝εP∈δiq\rightsquigarrow_{\varepsilon}P\in\delta_{i}, and p↝εP′∈δp\rightsquigarrow_{\varepsilon}P^{\prime}\in\delta, and p∈Pp\in P. We then show, by induction on ii, that every δi\delta_{i} can be simulated by a finite sequence of transitions of δ\delta. For the base case, if the transition is of form q↝ε{q}q\rightsquigarrow_{\varepsilon}\{q\}, then the transition can be simulated by an empty sequence of transitions: therefore δ0\delta_{0} can be simulated by a finite sequence of transitions of δ\delta.

For the induction step, we assume that δi⊆δε∗\delta_{i}\subseteq\delta_{\varepsilon}^{*}, and consider δi+1=δi∪{q↝εQ′}\delta_{i+1}=\delta_{i}\cup\{q\rightsquigarrow_{\varepsilon}Q^{\prime}\}. Then there are some PP, pp, P′P^{\prime} so that q↝εP∈δiq\rightsquigarrow_{\varepsilon}P\in\delta_{i}, and p∈Pp\in P, and p↝εP′∈δp\rightsquigarrow_{\varepsilon}P^{\prime}\in\delta, and Q′=(P∖{p})∪P′Q^{\prime}=(P\setminus\{p\})\cup P^{\prime}. Since q↝εP∈δiq\rightsquigarrow_{\varepsilon}P\in\delta_{i}, it can be simulated by a finite sequence t1,…,tnt_{1},\ldots,t_{n} of transitions in δ\delta. Then, the sequence of transitions t1,…,tn,p↝εP′t_{1},\ldots,t_{n},p\rightsquigarrow_{\varepsilon}P^{\prime} simulates q↝εQ′q\rightsquigarrow_{\varepsilon}Q^{\prime}: indeed, the transition p↝εP′p\rightsquigarrow_{\varepsilon}P^{\prime} can be added to the sequence since p∈Pp\in P. Doing so removes pp and adds P′P^{\prime} to the states at the end of the sequence: therefore, the states at the end of the new sequence are (P∖{p})∪P′=Q′(P\setminus\{p\})\cup P^{\prime}=Q^{\prime}. Therefore we can simulate δi+1\delta_{i+1} with a finite sequence of transitions of δ\delta.

We then move on to the two main lemmas.

Lemma 7

A stratified DL automaton 𝔄\mathfrak{A} contains 𝐏𝐐​(𝔄)\mathbf{PQ}(\mathfrak{A}).

Proof

We fix a stratified DL automaton 𝔄=⟨s,Q,qinit,δ⟩\mathfrak{A}=\langle s,Q,q_{\textit{init}},\delta\rangle, its extended version 𝔄ε=⟨s,Q,qinit,δ∪δε∗⟩\mathfrak{A}_{\varepsilon}=\langle s,Q,q_{\textit{init}},\delta\cup\delta_{\varepsilon}^{*}\rangle, the query 𝐏𝐐​(𝔄)\mathbf{PQ}(\mathfrak{A}), and a fact set ℱ\mathcal{F}. To prove the lemma, we assume that ℱ\mathcal{F} entails 𝐏𝐐​(𝔄)\mathbf{PQ}(\mathfrak{A}) and show that 𝔄ε\mathfrak{A}_{\varepsilon} accepts ℱ\mathcal{F}. More precisely, we prove the following claim by induction on k≥1k\geq 1: if ℱ\mathcal{F} entails 𝐏𝐐​(𝔄,p,c)\mathbf{PQ}(\mathfrak{A},p,c) for some state pp of 𝔄\mathfrak{A} in stratum kk and some constant cc, then there is an accepting run of 𝔄ε\mathfrak{A}_{\varepsilon} on ℱ\mathcal{F} starting from ⟨p,c⟩\langle p,c\rangle. Applying this claim to p=qinitp=q_{\textit{init}} and c=sc=s, we obtain an accepting run of 𝔄ε\mathfrak{A}_{\varepsilon} on ℱ\mathcal{F} starting from ⟨qinit,s⟩\langle q_{\textit{init}},s\rangle, and hence 𝔄ε\mathfrak{A}_{\varepsilon} accepts ℱ\mathcal{F}. Recall that 𝔄\mathfrak{A} and 𝔄ε\mathfrak{A}_{\varepsilon} are equivalent by Lemma˜6 and therefore, the lemma follows.

For the base case, let pp be a state in stratum 11 and cc a constant such that ℱ\mathcal{F} satisfies 𝐏𝐐​(𝔄,p,c)\mathbf{PQ}(\mathfrak{A},p,c). Since pp belongs to stratum 11, no state succeeds pp with respect to ≻𝔄\succ_{\mathfrak{A}}. Therefore, by Definition˜10, we have:

𝐏𝐐​(𝔄,p,c)=⋁p↝εP∈δε∗⋀q∈P𝐏𝐐NFA​(𝐍𝐅𝐀​(𝔄,p),q,c)\mathbf{PQ}(\mathfrak{A},p,c)=\bigvee\nolimits_{p\rightsquigarrow_{\varepsilon}P\in\delta^{*}_{\varepsilon}}\bigwedge\nolimits_{q\in P}\mathbf{PQ}_{\textit{NFA}}(\mathbf{NFA}(\mathfrak{A},p),q,c)

Since this PQ is entailed by ℱ\mathcal{F}, there is some p↝ε{q1,…,qm}∈δε∗p\rightsquigarrow_{\varepsilon}\{q_{1},\ldots,q_{m}\}\in\delta^{*}_{\varepsilon} such that ℱ\mathcal{F} satisfies ⋀1≤i≤m𝐏𝐐NFA​(𝐍𝐅𝐀​(𝔄,p),qi,c)\bigwedge\nolimits_{1\leq i\leq m}\mathbf{PQ}_{\textit{NFA}}(\mathbf{NFA}(\mathfrak{A},p),q_{i},c). Since this formula is a conjunction, ℱ\mathcal{F} satisfies 𝐏𝐐NFA​(𝐍𝐅𝐀​(𝔄,p),qi,c)\mathbf{PQ}_{\textit{NFA}}(\mathbf{NFA}(\mathfrak{A},p),q_{i},c) for every 1≤i≤m1\leq i\leq m. Hence, there is an accepting run for 𝔄\mathfrak{A} over ℱ\mathcal{F} from every ⟨qi,c⟩\langle q_{i},c\rangle by Definition˜7. Therefore, for every 1≤i≤m1\leq i\leq m, there is an accepting run ⟨Ni,Ei,Li⟩\langle N_{i},E_{i},L_{i}\rangle for 𝔄ε\mathfrak{A}_{\varepsilon} over ℱ\mathcal{F} from ⟨qi,c⟩\langle q_{i},c\rangle by Lemma˜6. Without loss of generality, we assume that the sets N1,…,NmN_{1},\ldots,N_{m} are mutually disjoint. Now, consider the tree ⟨N,E,L⟩\langle N,E,L\rangle defined as follows:

  • •

    Let N=N1∪…∪Nm∪{r}N=N_{1}\cup\ldots\cup N_{m}\cup\{r\} with rr a fresh node that is the root of this tree.

  • •

    Let E=E1∪…∪Em∪{r→r1,…,r→rm}E=E_{1}\cup\ldots\cup E_{m}\cup\{r\to r_{1},\ldots,r\to r_{m}\} with r1r_{1} the root of ⟨N1,E1,L1⟩\langle N_{1},E_{1},L_{1}\rangle, r2r_{2} the root of ⟨N2,E2,L2⟩\langle N_{2},E_{2},L_{2}\rangle, and so on.

  • •

    Let LL be the mapping extending LiL_{i} for every 1≤i≤m1\leq i\leq m and maps rr to ⟨p,c⟩\langle p,c\rangle.

We argue that ⟨N,E,L⟩\langle N,E,L\rangle is an accepting run for 𝔄ε\mathfrak{A}_{\varepsilon} over ℱ\mathcal{F} from ⟨p,c⟩\langle p,c\rangle. This follows because p↝ε{q1,…,qm}∈δε∗p\rightsquigarrow_{\varepsilon}\{q_{1},\ldots,q_{m}\}\in\delta^{*}_{\varepsilon} and hence, the edges {r→r1,…,r→rm}\{r\to r_{1},\ldots,r\to r_{m}\} in this tree satisfy Definition˜3. Moreover, for every 1≤i≤m1\leq i\leq m, we have that ⟨Ni,Ei,Li⟩\langle N_{i},E_{i},L_{i}\rangle is an accepting run over ℱ\mathcal{F} from ⟨qi,c⟩\langle q_{i},c\rangle. Hence, all of the edges in E1∪…∪EmE_{1}\cup\ldots\cup E_{m} also satisfy this definition, and all of the leaves in ⟨N,E,L⟩\langle N,E,L\rangle feature the accepting state.

For the induction step, we consider a state pp of stratum k≥2k\geq 2 and a constant cc such that ℱ\mathcal{F} satisfies 𝐏𝐐​(𝔄,p,c)\mathbf{PQ}(\mathfrak{A},p,c). Since ℱ\mathcal{F} satisfies 𝐏𝐐​(𝔄,p,c)\mathbf{PQ}(\mathfrak{A},p,c), it satisfies some disjunct, there is some p↝ε{q1,…,qm}∈δε∗p\rightsquigarrow_{\varepsilon}\{q_{1},\ldots,q_{m}\}\in\delta_{\varepsilon}^{*} such that ℱ\mathcal{F} satisfies the following:

⋀1≤i≤m(𝐏𝐐NFA(𝐍𝐅𝐀(𝔄,p),qi,c)\displaystyle\bigwedge\nolimits_{1\leq i\leq m}\Big(\mathbf{PQ}_{\textit{NFA}}(\mathbf{NFA}(\mathfrak{A},p),q_{i},c)
⋁∀p′,p1,…,pn∈Q​ such that ​qi→𝔑∗p′,p′↝ε{p1,…,pn},qi≻𝔄p1,…,qi≻𝔄pn(∃w.𝔈qi⊳p′𝔑(c,w)⋀1≤j≤n𝐏𝐐(𝔄,pj,w)))\displaystyle\bigvee_{\begin{subarray}{c}\forall p^{\prime},p_{1},\ldots,p_{n}\in Q\textit{ such that }q_{i}\to_{\mathfrak{N}}^{*}p^{\prime},\\ p^{\prime}\rightsquigarrow_{\varepsilon}\{p_{1},\ldots,p_{n}\},~q_{i}\succ_{\mathfrak{A}}p_{1},\ldots,q_{i}\succ_{\mathfrak{A}}p_{n}\end{subarray}}\big(\exists w.\mathfrak{E}_{q_{i}\triangleright p^{\prime}}^{\mathfrak{N}}(c,w)\bigwedge_{1\leq j\leq n}\mathbf{PQ}(\mathfrak{A},p_{j},w)\big)\Big)

In the remainder of our argument, we define an accepting run ⟨N,E,L⟩\langle N,E,L\rangle for 𝔄ε\mathfrak{A}_{\varepsilon} over ℱ\mathcal{F} from ⟨p,c⟩\langle p,c\rangle. The root node r∈Nr\in N of this run is mapped by LL to ⟨p,c⟩\langle p,c\rangle. Moreover, there are some distinct nodes r1,…,rm∈Nr_{1},\ldots,r_{m}\in N such that, for every 1≤i≤m1\leq i\leq m, we have that r→ri∈Er\to r_{i}\in E and L​(ri)=⟨qi,c⟩L(r_{i})=\langle q_{i},c\rangle. Now, for every 1≤i≤m1\leq i\leq m, we extend the run ⟨N,E,L⟩\langle N,E,L\rangle in the following manner:

  • •

    If ℱ⊧𝐏𝐐NFA​(𝐍𝐅𝐀​(𝔄,p),qi,c)\mathcal{F}\models\mathbf{PQ}_{\textit{NFA}}(\mathbf{NFA}(\mathfrak{A},p),q_{i},c), there is an accepting run on 𝔄\mathfrak{A} over ℱ\mathcal{F} from ⟨qi,c⟩\langle q_{i},c\rangle as argued in the base case. We attach this directed tree to the node rir_{i}.

  • •

    Otherwise, there is a constant tt and some states p′,p1,…,pn∈Qp^{\prime},p_{1},\ldots,p_{n}\in Q such that q→𝔑∗p′q\rightarrow_{\mathfrak{N}}^{*}p^{\prime}, p′↝ε{p1,…​pn}p^{\prime}\rightsquigarrow_{\varepsilon}\{p_{1},\ldots p_{n}\}, q≻𝔄p1q\succ_{\mathfrak{A}}p_{1}, …, q≻𝔄pnq\succ_{\mathfrak{A}}p_{n}, and ℱ\mathcal{F} satisfies the following PQ:

    𝔈qi⊳p′𝔑​(c,t)∧⋀1≤i≤n𝐏𝐐​(𝔄,pi,t)\mathfrak{E}_{q_{i}\triangleright p^{\prime}}^{\mathfrak{N}}(c,t)\wedge\bigwedge\nolimits_{1\leq i\leq n}\mathbf{PQ}(\mathfrak{A},p_{i},t)

    Since ℱ\mathcal{F} satisfies 𝔈qi⊳p′𝔑​(c,t)\mathfrak{E}_{q_{i}\triangleright p^{\prime}}^{\mathfrak{N}}(c,t), we have from Lemma˜1 that there is a run whose root node is labeled ⟨qi,c⟩\langle q_{i},c\rangle and whose unique leaf is labeled ⟨p′,t⟩\langle p^{\prime},t\rangle : we attach this directed tree to rir_{i}, and call the fresh leaf node ri′r_{i}^{\prime}.

    Since ℱ\mathcal{F} satisfies p′↝ε{p1,…,pn}p^{\prime}\rightsquigarrow_{\varepsilon}\{p_{1},\ldots,p_{n}\}, the edge ⟨p′,t⟩→{⟨pj,t⟩∣j≤n}\langle p^{\prime},t\rangle\rightarrow\{\langle p_{j},t\rangle\mid j\leq n\} is valid: we attach it to ri′r_{i}^{\prime}, and label the fresh leaves nodes ri,j′r^{\prime}_{i,j}.

    Since ℱ\mathcal{F} satisfies 𝐏𝐐​(𝔄,p1,t)\mathbf{PQ}(\mathfrak{A},p_{1},t),…, 𝐏𝐐​(𝔄,pn,t)\mathbf{PQ}(\mathfrak{A},p_{n},t), by induction hypothesis, there are accepting runs ⟨Nj′,Ej′,Lj′⟩\langle N^{\prime}_{j},E^{\prime}_{j},L^{\prime}_{j}\rangle from ⟨p1,t⟩\langle p_{1},t\rangle , …, ⟨pn,t⟩\langle p_{n},t\rangle. We attach each ⟨Nj′,Ej′,Lj′⟩\langle N^{\prime}_{j},E^{\prime}_{j},L^{\prime}_{j}\rangle to ri,j′r^{\prime}_{i,j}.

After the modifications, ⟨N,E,L⟩\langle N,E,L\rangle has only accepting leaves: we have built an accepting run for 𝔄\mathfrak{A} over ℱ\mathcal{F} from ⟨p,c⟩\langle p,c\rangle. We conclude that there is an accepting run of 𝔄\mathfrak{A} over ℱ\mathcal{F} from ⟨p,c⟩\langle p,c\rangle, and the induction step holds. Therefore, if some ℱ\mathcal{F} satisfies the PQ φ​(𝔄)\varphi(\mathfrak{A}), we have an accepting run of 𝔄\mathfrak{A} from ⟨qinit,s⟩\langle q_{\textit{init}},s\rangle over ℱ\mathcal{F}.

Lemma 8

A DL automaton 𝔄\mathfrak{A} is contained in 𝐏𝐐​(𝔄)\mathbf{PQ}(\mathfrak{A}).

Proof

We fix a DL automaton 𝔄=⟨s,Q,qinit,δ⟩\mathfrak{A}=\langle s,Q,q_{\textit{init}},\delta\rangle and a fact set ℱ\mathcal{F}. To prove the lemma, we assume that there is an accepting run of 𝔄\mathfrak{A} from ⟨qinit,s⟩\langle q_{\textit{init}},s\rangle over ℱ\mathcal{F}, and show that this implies that ℱ\mathcal{F} satisfies 𝐏𝐐​(𝔄,qinit,s)\mathbf{PQ}(\mathfrak{A},q_{\textit{init}},s). More precisely, we show the following claim by induction on k≥1k\geq 1: for any state pp of 𝔄\mathfrak{A} in stratum kk and any constant cc, if 𝔄\mathfrak{A} has an accepting run from some ⟨p,c⟩\langle p,c\rangle we have ℱ⊧𝐏𝐐​(𝔄,p,c)\mathcal{F}\models\mathbf{PQ}(\mathfrak{A},p,c). Applying this claim to qinitq_{\textit{init}} and ss, it follows that if there is an accepting run for ℱ\mathcal{F} from ⟨qinit,s⟩\langle q_{\textit{init}},s\rangle, then ℱ\mathcal{F} satisfies 𝐏𝐐​(𝔄,qinit,s)\mathbf{PQ}(\mathfrak{A},q_{\textit{init}},s).

For the base case, consider a state pp of stratum 1 and an accepting run ⟨N,E,L⟩\langle N,E,L\rangle whose root is labeled ⟨p,c⟩\langle p,c\rangle and whose leaves are labeled with {⟨qacc,w1⟩,…,⟨qacc,wn⟩}\{\langle q_{\textit{acc}},w_{1}\rangle,\ldots,\langle q_{\textit{acc}},w_{n}\rangle\} for some w1,…,wnw_{1},\ldots,w_{n} in 𝔄\mathfrak{A}. We define the epsilon-section of ⟨N,E,L⟩\langle N,E,L\rangle, noted ⟨N,E,L⟩ε\langle N,E,L\rangle_{\varepsilon}, as the (maximal) subset run starting from the root using only edges matched with ε\varepsilon-transitions. By the definition of δε∗\delta_{\varepsilon}^{*}, there is a transition p↝εQ′∈δε∗p\rightsquigarrow_{\varepsilon}Q^{\prime}\in\delta_{\varepsilon}^{*} such that the leaves of ⟨N,E,L⟩ε\langle N,E,L\rangle_{\varepsilon} are labeled with the states of Q′Q^{\prime}. Since pp is of stratum 1, there can be only binary edges below these nodes: if that was not the case, some states of leaves of the run would be of a lower strata than the state of the root. Moreover, for every q∈Q′q\in Q^{\prime}, there is an accepting run from ⟨q,c⟩\langle q,c\rangle in 𝔑=𝐍𝐅𝐀​(𝔄,p)\mathfrak{N}=\mathbf{NFA}(\mathfrak{A},p) over ℱ\mathcal{F}. By Definition˜7, this means that 𝐏𝐐NFA​(𝔑,q,c)\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,c) accepts. Therefore, the PQ ⋁p↝εQ′⋀q∈Q′𝐏𝐐NFA​(𝔑,q,c)=𝐏𝐐​(𝔄,qinit,c)\bigvee_{p\rightsquigarrow_{\varepsilon}Q^{\prime}}\bigwedge_{q\in Q^{\prime}}\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q,c)=\mathbf{PQ}(\mathfrak{A},q_{\textit{init}},c) accepts and the property is verified.

For the induction step, if pp is of strata k≥2k\geq 2, we consider an accepting run for ⟨p,c⟩\langle p,c\rangle on 𝔄\mathfrak{A}. Similarly to the base case, we consider the epsilon-section of the run: if there are only binary edges outside of it, then we are in the same situation as in the base case. If not, we consider the leaves r1,…,rmr_{1},\ldots,r_{m} of the epsilon-section of the run, labeled {⟨qi,c⟩∣i≤m}\{\langle q_{i},c\rangle\mid i\leq m\}. For each ii, we are in one of two cases:

  • •

    If rir_{i} has only binary edges descending from it, then the part of the tree rooted at rir_{i} is an accepting run for 𝐍𝐅𝐀​(𝔄,q)\mathbf{NFA}(\mathfrak{A},q). In that case, 𝐏𝐐NFA​(𝐍𝐅𝐀​(𝔄,p),qi,c)\mathbf{PQ}_{\textit{NFA}}(\mathbf{NFA}(\mathfrak{A},p),q_{i},c) is satisfied.

  • •

    If that is not the case, consider the first multi-ary edge descending from rir_{i}, called ri′→{ri,1′,…,ri,n′}r^{\prime}_{i}\to\{r^{\prime}_{i,1},\ldots,r^{\prime}_{i,n}\} with ri′r^{\prime}_{i} labeled ⟨p′,t⟩\langle p^{\prime},t\rangle and each ri,j′r^{\prime}_{i,j} labeled ⟨pj,t⟩\langle p_{j},t\rangle.

    • –

      By definition, ⟨q,c⟩\langle q,c\rangle can transition to ⟨p′,t⟩\langle p^{\prime},t\rangle in 𝔑=𝐍𝐅𝐀​(𝔄,q)\mathfrak{N}=\mathbf{NFA}(\mathfrak{A},q): therefore, by Lemma˜1 we have ∃w.𝔈q⊳p′𝔑​(c,t)\exists w.\mathfrak{E}_{q\triangleright p^{\prime}}^{\mathfrak{N}}(c,t).

    • –

      Moreover, in the automaton, we have that p′↝ε{p1,…,pn}p^{\prime}\rightsquigarrow_{\varepsilon}\{p_{1},\ldots,p_{n}\}, and since p1p_{1} , …, and pnp_{n} follow a multi-ary transition outside the epsilon-section of the run qi≻𝔄p1q_{i}\succ_{\mathfrak{A}}p_{1}, …, and qi≻𝔄pnq_{i}\succ_{\mathfrak{A}}p_{n}.

    • –

      Since the run is accepting, the sub-runs starting at ri,1′r^{\prime}_{i,1}, …, ri,n′r^{\prime}_{i,n} are valid runs with only accepting leaves: they are also accepting for 𝔄\mathfrak{A} over ℱ\mathcal{F}. As p1,…,pnp_{1},\ldots,p_{n} have strata at most kk, by induction hypothesis, ⋀1≤j≤n𝐏𝐐​(𝔄,pj,t)\bigwedge_{1\leq j\leq n}\mathbf{PQ}(\mathfrak{A},p_{j},t) is satisfied by ℱ\mathcal{F}.

It follows that

⋀i≤m(𝐏𝐐NFA(𝔑,qi,t)∨\displaystyle\bigwedge\nolimits_{i\leq m}\Big(\mathbf{PQ}_{\textit{NFA}}(\mathfrak{N},q_{i},t)~\vee
⋁∀p′,p1,…,pn∈Q​ such that ​qi→𝔑∗p′,p′↝ε{p1,…,pn},qi≻𝔄p1,…, and ​qi≻𝔄pn(∃w.𝔈qi⊳p′𝔑(t,w)∧⋀1≤j≤n𝐏𝐐(𝔄,pj,w)))\displaystyle\quad\bigvee_{\begin{subarray}{c}\forall p^{\prime},p_{1},\ldots,p_{n}\in Q\textit{ such that }q_{i}\to_{\mathfrak{N}}^{*}p^{\prime},\\ p^{\prime}\rightsquigarrow_{\varepsilon}\{p_{1},\ldots,p_{n}\},~q_{i}\succ_{\mathfrak{A}}p_{1},\ldots,\text{ and }q_{i}\succ_{\mathfrak{A}}p_{n}\end{subarray}}\big(\exists w.\mathfrak{E}_{q_{i}\triangleright p^{\prime}}^{\mathfrak{N}}(t,w)\wedge\bigwedge_{1\leq j\leq n}\mathbf{PQ}(\mathfrak{A},p_{j},w)\big)\Big)

is satisfied for some QQ, and therefore that 𝐏𝐐​(𝔄,p,c)\mathbf{PQ}(\mathfrak{A},p,c) is.

Therefore, we have that for any state pp and constant cc, if there is an accepting run of 𝔄\mathfrak{A} from ⟨p,c⟩\langle p,c\rangle over ℱ\mathcal{F}, then ℱ\mathcal{F} satisfies 𝐏𝐐​(𝔄,p,c)\mathbf{PQ}(\mathfrak{A},p,c).

Appendix 0.D Claim of Section˜7

We provide more details regarding our claim that positive fragments of DL-Litecore and DL-LiteR sets of rules always have stratified associate DL automata. We assume familiarity with DL-Lite and refer the reader to [5]; we discuss positive DL-LiteR since it subsumes DL-Litecore.

Let us first highlight that, to be seen as Horn-​𝒜​ℒ​𝒞​ℋ​ℐ\textit{Horn-}\mathcal{ALCHI} rules in our normal form, positive DL-LiteR rules requires the introduction of a placeholder class 𝙲⊤\mathtt{C_{\top}} that replaces ⊤\top in every occurrence of a DL-Lite concept of form ∃𝚁.⊤\exists\mathtt{R}.\top (or, as is common, simply ∃𝚁\exists\mathtt{R}), where 𝚁\mathtt{R} is possibly an inverse role. We add the rule →𝙲⊤​(x)\rightarrow\mathtt{C_{\top}}(x) (axiom of form (4)) to witness this behavior.

Let us now examine the normalization exposed in Section˜3. Getting rid of axioms of form (6) and (7) does not introduce any axiom of form (1) with n≥2n\geq 2, as desired. In Appendix˜0.A, we already established that inference rules Rules 𝐑≤\mathbf{R}_{\leq}, 𝐑≤−\mathbf{R}^{-}_{\leq}, 𝐑⊑r\mathbf{R}^{r}_{\sqsubseteq} and 𝐑⊥\mathbf{R}_{\bot} never apply. Therefore, the only inference rule in [10, Table 2] that may introduce axioms of form (1) with n≥2n\geq 2 is the rule 𝐑∀\mathbf{R}_{\forall}. To apply, this rule requires an axiom with shape 𝙰⊑∀𝚁.𝙱\mathtt{A}\sqsubseteq\forall\mathtt{R}.\mathtt{B}. However, none of the other rules may produce such axiom, therefore it must come directly from our DL-LiteR rules. This implies that 𝙰=𝙲⊤\mathtt{A}=\mathtt{C_{\top}}. The body of the inferred rule thus, syntactically, takes the form (1) with n≥2n\geq 2. However, due to our rule →𝙲⊤​(x)\rightarrow\mathtt{C_{\top}}(x), it is equivalent to the exact same inferred rule, but in which every occurrence of 𝙲⊤\mathtt{C_{\top}} has been removed from its body, which restores n≤1n\leq 1.