Abstract
An ontology language for ontology mediated query answering (OMQAlanguage) isuniversal for a family of OMQAlanguages if it is the most expressive one amongthis family. In this paper, we focus on three families of tractableOMQAlanguages, including firstorder rewritable languages and languages whosedata complexity of the query answering is in AC0 or PTIME. On the negativeside, we prove that there is, in general, no universal language for each ofthese families of languages. On the positive side, we propose a novel property,the locality, to approximate the firstorder rewritability, and show that thereexists a language of disjunctive embedded dependencies that is universal forthe family of OMQAlanguages with locality. All of these results apply to OMQAwith query languages such as conjunctive queries, unions of conjunctive queriesand acyclic conjunctive queries.
Quick Read (beta)
Towards Universal Languages for Tractable Ontology Mediated Query Answering
Abstract
An ontology language for ontology mediated query answering (OMQAlanguage) is universal for a family of OMQAlanguages if it is the most expressive one among this family. In this paper, we focus on three families of tractable OMQAlanguages, including firstorder rewritable languages and languages whose data complexity of the query answering is in AC${}^{0}$ or PTIME. On the negative side, we prove that there is, in general, no universal language for each of these families of languages. On the positive side, we propose a novel property, the locality, to approximate the firstorder rewritability, and show that there exists a language of disjunctive embedded dependencies that is universal for the family of OMQAlanguages with locality. All of these results apply to OMQA with query languages such as conjunctive queries, unions of conjunctive queries and acyclic conjunctive queries.
Towards Universal Languages for Tractable Ontology Mediated Query Answering
Heng Zhang,^{1} Yan Zhang,^{2,3} JiaHuai You,^{4} Zhiyong Feng,^{1} Guifei Jiang ^{5} ^{1}College of Intelligence and Computing, Tianjin University, Tianjin, China ^{2}School of Computing, Engineering and Mathematics, Western Sydney University, Penrith, Australia ^{3}School of Computer Science and Technology, Huazhong University of Technology and Science, Wuhan, China ^{4}Department of Computing Science, University of Alberta, Edmonton, Canada ^{5}College of Software, Nankai University, Tianjin, China [email protected], [email protected], [email protected], [email protected], [email protected]
Copyright © 2020, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.
Introduction
Ontology mediated query answering (OMQA) is a paradigm that generalizes the traditional database querying by enriching the database with a domain ontology (?). This paradigm has played an important role in the semantic web (?; ?), data modelling (?), data exchange (?) and data integration (?), and has recently emerged as one of the central issues in knowledge representation as well as in databases.
A longterm major topic for OMQA is to identify proper languages that specify ontologies. There have been a large number of ontology languages proposed for OMQA since the mid 2000s. For instance, in description logics, the DLLite family (?), $\mathcal{E}\mathcal{L}$family (?) and other variants have been proposed and extensively studied. More recently, the Datalog$\pm $ family, a.k.a. existential rule languages, or dependencies in databases, have been rediscovered as promising languages for OMQA, see, e.g., (?; ?; ?). Most of these languages enjoy good computational properties such as the firstorder rewritability or PTIME data complexity.
While all these languages are of their specific features and hence are useful in different applications, it is not realistic to implement OMQAsystems for all of them. So a natural question arises: Can we find the largest one (in the expressiveness) among the family of firstorder rewritable (or PTIMEtractable) OMQAlanguages? Let us call the largest language in the above sense a universal language. Clearly, it is of great theoretical and practical importance to identify the existence of universal language w.r.t. some kind of tractability, which is also the main task of this paper.
It is worth noting that the universality is one of the major principles for designing languages in both computer science and logic. For example, almost all the traditional programming languages, including C, Java and Prolog, are known to be universal for the family of Turing complete programming languages; propositional logic can express all boolean functions; and by the wellknown Lindström theorem the firstorder logic is the largest one among the logics that enjoy both the compactness and the LöwenheimSkolem property; see, e.g., (?). In databases, firstorder language is shown to be universal for the family of query languages with data complexity in AC${}^{0}$, and Datalog universal for the family of query languages with data complexity in PTIME; see, e.g., (?).
Some recent work in OMQA has been done along the line of identifying universal languages. ? (?) proved that, under a certain syntactic classification, some languages in the DLLite family are the maximal fragments of description logic with the firstorder rewritability. By regarding OMQA as traditional database querying, ? (?) showed that weaklyguarded tuplegenerating dependencies (TGDs) capture the class of EXPTIME queries; ? (?) proved that general TGDs capture the class of recursively enumerable queries. In the setting of schema mapping, ? (?) showed that the language of weaklyacyclic TGDs is universal for languages of TGDs with finite semioblivious chase. All of these results shed new insights on understanding the expressiveness of existential rules, but it is worth noting that OMQA is significantly different from both traditional database querying and schema mapping. To understand the expressiveness in the framework of OMQA, ? (?) proved that the language of disjunctive embedded dependencies is universal for the family of recursively enumerable OMQAlanguages. Along this line, this paper will focus on tractable OMQA.
Aimed at exploiting universal languages for the tractable OMQA, in this paper we focus on three families of OMQAlanguages, including firstorder rewritable languages and languages whose data complexity is in AC${}^{0}$ or PTIME. Our contributions are summarized as follows. On one hand, we prove that there is, in general, no universal language for each of the above families of languages. On the other hand, by restricting the number of database constants involved in query answering, we propose a novel property, called the locality, to approximate the firstorder rewritability, and identify the existence of universal language for the family of local OMQAlanguages. All of these results hold for OMQA with query languages such as conjunctive queries, unions of conjunctive queries and acyclic conjunctive queries.
Preliminaries
Databases and Instances. We use a countably infinite set of constants and a countably infinite set of variables, and assume they are disjoint. Every term is either a constant or a variable. A relational schema $\mathcal{R}$ consists of a set of relation symbols. Each relation symbol has an arity which is a natural number. An atoms over $\mathrm{R}$ (or $\mathcal{R}$atom) is either an equality, or a relational atom built upon terms and relation symbols in $\mathcal{R}$. A fact is a variablefree relational atom. Each instance over $\mathrm{R}$ (or $\mathcal{R}$instance) consists of a set of facts over $\mathcal{R}$. Instances that are finite are called databases. Suppose $I$ is an instance. Let $adom(I)$ denote the set of constants that occur in $I$. Let DB$[\mathcal{R}]$ denote the class of all databases over schema $\mathcal{R}$. Given a set $A$ of constants, by ${I}_{A}$ we denote the subset of $I$ in which each fact involves only constants in $A$.
Let $I$ and $J$ be instances over a relational schema $\mathcal{R}$, and $C\subseteq adom(I)\cap adom(J)$. Then every $C$homomorphism from $I$ to $J$ is a function $h:adom(I)\to adom(J)$ such that (i) $R(\overrightarrow{a})\in I$ implies $R(h(\overrightarrow{a}))\in J$ for all relation symbols $R\in \mathcal{R}$ and all tuples $\overrightarrow{a}$ of constants, and (ii) $h(c)=c$ for all $c\in C$. If such $h$ exists, we say that $I$ is $C$homomorphic to $J$, and write $I{\to}_{C}J$; in addition, we write $I{\twoheadrightarrow}_{C}J$ if $h$ is injective. For simplicity, $C$ will be dropped if it is empty.
Queries. Fix $\mathcal{R}$ as a relational schema. By a query over $\mathcal{R}$ (or $\mathcal{R}$query) we mean a formula built upon atoms over $\mathcal{R}$ in some logic. The logic could be firstorder logic, secondorder logic, or other variants. A query is boolean if it has no free variables. For convenience, given any query $q$, let $const(q)$ denote the set of constants that occur in $q$.
Every firstorder formula is called a firstorder query. A conjunctive query (CQ) is a query of the form $\exists \overrightarrow{y}.\phi (\overrightarrow{x},\overrightarrow{y})$ where $\phi $ is a finite but nonempty conjunction of relational atoms. Let $q$ be a boolean CQ. We use $[q]$ to denote the database that consists of all the atoms that appear in $q$, where variables in atoms are regarded as special constants. The Gaifman graph of $q$ is an undirected graph with each term in $q$ as a vertex, and with each pair of distinct terms as an edge if they cooccur in some atom in $q$. A boolean CQ is called acyclic if its Gaifman graph is acyclic. A union of conjunctive query (UCQ) is a firstorder formula built upon atoms by connectives $\wedge ,\vee $ and quantifier $\exists $. Clearly, every UCQ is equivalent to a disjunction of CQs.
Every Datalog${}^{\mathrm{\neg}}$ program consists of a finite set of rules of the form $\forall \overrightarrow{x}\forall \overrightarrow{y}(\phi (\overrightarrow{x},\overrightarrow{y})\to \alpha (\overrightarrow{x}))$, where $\alpha $ is a relational atom and $\phi $ is a finite conjunction of atoms or negated atoms; $\alpha $ and $\phi $ are called the head and the body of the rule, respectively. Each variable in $\overrightarrow{x}$ should have at least one positive occurrence in $\phi $. A relation symbol is called intentional if it has at least one occurrence in the head of some rule, and extensional otherwise. No intensional relation symbol is allowed to appear in a negated atom. A Datalog${}^{\mathrm{\neg}}$ query is of the form $(\mathrm{\Pi},\text{\mathit{P}})(\overrightarrow{x})$ where $\mathrm{\Pi}$ is a Datalog${}^{\mathrm{\neg}}$ program, P an extensional relation symbol, and $\overrightarrow{x}$ a variable tuple of a proper length. It is wellknown that every Datalog${}^{\mathrm{\neg}}$ query can be translated to an equivalent formula in least fixpoint logic, see, e.g., (?).
Only boolean queries will be used in this work. For convenience, we employ CQ, ACQ and UCQ to denote the classes of boolean CQs, boolean acyclic CQs and boolean UCQs, respectively. Let FO denote the class of boolean firstorder queries, FO$(+,\times )$ denote the class of boolean firstorder queries that involve two builtin arithmetic relations $+$ and $\times $, and Datalog${}^{\mathrm{\neg}}(\le )$ denote the class of boolean Datalog${}^{\mathrm{\neg}}$ queries that involve a builtin successor relation Succ, and special constants min and max, denoting the minimum and the maximum elements, respectively, under the underlying order. Given a class $\mathcal{C}$ of queries and a relational schema $\mathcal{R}$, let $\mathcal{C}[\mathcal{R}]$ denote the class of $\mathcal{R}$queries that belong to $\mathcal{C}$.
In the theory of descriptive complexity (?), it was proved that FO$(+,\times )$ and Datalog${}^{\mathrm{\neg}}(\le )$ exactly capture complexity classes AC${}^{0}$ and PTIME respectively, where AC${}^{0}$ denotes the class of languages recognized by a uniform family of circuits with constant depth and polynomial size, and PTIME denotes the class of languages recognized by a deterministic Turing machine in polynomial time.
Dependencies. A disjunctive embedded dependency (DED) over a relational schema $\mathcal{R}$ is a sentence $\sigma $ of the form
$$\forall \overrightarrow{x}\forall \overrightarrow{y}(\varphi (\overrightarrow{x},\overrightarrow{y})\to \exists {\overrightarrow{z}}_{1}.{\psi}_{1}(\overrightarrow{x},{\overrightarrow{z}}_{1})\vee \mathrm{\cdots}\vee \exists {\overrightarrow{z}}_{k}.{\psi}_{k}(\overrightarrow{x},{\overrightarrow{z}}_{k}))$$ 
where $k\ge 0$, $\varphi $ is a conjunction of relational $\mathcal{R}$atoms involving terms from $\overrightarrow{x}\cup \overrightarrow{y}$ only, each ${\psi}_{i}$ is a conjunction of atoms over $\mathcal{R}$ involving terms from $\overrightarrow{x}\cup {\overrightarrow{z}}_{i}$ only, and each variable in $\overrightarrow{x}$ has at least one occurrence in $\varphi $. In particular, $\sigma $ is called a tuplegenerating dependency (TGD) if it is equalityfree and $k=1$. For simplicity, we omit the universal quantifiers and the brackets appearing outside the atoms.
Let $D$ be a database, $\mathrm{\Sigma}$ a set of (firstorder) sentences, and $q$ a boolean query; all of them are over a common relational schema $\mathcal{R}$. We write $D\cup \mathrm{\Sigma}\models q$ if, for all $\mathcal{R}$instances $I$ with $D\subseteq I$, if $I\vDash \sigma $ for all sentences $\sigma \in \mathrm{\Sigma}$ then $I\vDash q$, where the satisfaction relation $\vDash $ is defined in the standard way.
Ontologies and Languages in OMQA
Before identifying the existence of universal languages for OMQA, we need some notions to clarify what an ontology in OMQA is, and what an ontology language in OMQA is. To make the presented results more applicable, we will define these notions in a languageindependent way.
To define ontologies in OMQA, below we generalize the notion introduced in (?) from CQs to more general query languages such as UCQs.
Definition 1.
Let $\mathcal{D}$ and $\mathcal{Q}$ be relational schemas, and $\mathcal{Q}$ a class of queries. A quasiOMQA[$\mathrm{Q}$]ontology over $(\mathcal{D},\mathcal{Q})$ is a set of ordered pairs $(D,q)$, where $D$ is a $\mathcal{D}$database and $q$ a boolean $\mathcal{Q}$query in $\mathcal{Q}$ such that $\text{\mathit{c}\mathit{o}\mathit{n}\mathit{s}\mathit{t}}(q)\subseteq adom(D)$.
Moreover, a quasiOMQA[$\mathcal{Q}$]ontology $O$ over $(\mathcal{D},\mathcal{Q})$ is called an OMQA[$\mathrm{Q}$]ontology if all of the following hold:

1.
$O$ is closed under query conjunctions, i.e.,
$(D,q)\in O\&(D,p)\in O\&q\wedge p\in \mathcal{Q}\u27f9(D,q\wedge p)\in O$. 
2.
$O$ is closed under query implications, i.e.,
$(D,q)\in O\&p\in \mathcal{Q}\&q\models p\u27f9(D,p)\in O$. 
3.
$O$ is closed under injective database homomorphisms, i.e.,
$(D,q)\in O\&D{\twoheadrightarrow}_{\mathit{\text{const(q)}}}{D}^{\prime}\u27f9({D}^{\prime},q)\in O$.
Given any logical theory $\mathrm{\Sigma}$, we can interpret it as a quasiOMQA[$\mathcal{Q}$]ontology over $(\mathcal{D},\mathcal{Q})$ as follows:
$${[[\mathrm{\Sigma}]]}_{\mathcal{D},\mathcal{Q}}^{\mathcal{Q}}=\{(D,q):D\in \text{DB}[\mathcal{D}]\&q\in \mathcal{Q}[\mathcal{Q}]\&D\cup \mathrm{\Sigma}\models q\}.$$ 
It is easy to see that, for theories $\mathrm{\Sigma}$ in almost all the classical logic, ${[[\mathrm{\Sigma}]]}_{\mathcal{D},\mathcal{Q}}^{\mathcal{Q}}$ is indeed an OMQA$[\mathcal{Q}]$ontology.
With the notion of ontology, we are then able to present an abstract definition for ontology languages in OMQA.
Definition 2.
Let $V$ be a finite but nonempty set, $\mathcal{D}$ and $\mathcal{Q}$ relational schemas, and $\mathcal{Q}$ a class of queries. Then every OMQA[$\mathrm{Q}$]language $\mathcal{L}$ over $(\mathcal{D},\mathcal{Q})$ (with vocabulary $V$) is defined as an ordered pair $(T,M)$ such that:

1.
$T$ consists of a decidable set of theories, each of which is a finite string over $V$ (i.e., an element of ${V}^{\ast}$);

2.
$M$ is a semantic mapping, i.e., a function that maps each theory in $T$ to an OMQA[$\mathcal{Q}$]ontology over $(\mathcal{D},\mathcal{Q})$.
Example 1.
Let $\mathcal{D}$ and $\mathcal{Q}$ be relational schemas, $\mathcal{Q}$ a class of queries, and $T$ a decidable class of finite sets of DEDs. Let $M$ be a function that maps each set $\mathrm{\Sigma}\in T$ to ${[[\mathrm{\Sigma}]]}_{\mathcal{D},\mathcal{Q}}^{\mathcal{Q}}$. It is easy to see that $\mathcal{L}=(T,M)$ is an OMQA[$\mathcal{Q}$]language.
The language $\mathcal{L}$ defined above is called a DEDlanguage over $(\mathcal{D},\mathcal{Q})$ (induced by $T$). In particular, if $T$ consists of all finite sets of DEDs, we call it the full DEDlanguage over $(\mathcal{D},\mathcal{Q})$. Unfortunately, it had been proved in (?) that query answering with the full DEDlanguage is uncomputable. In this work, we thus focus on tractable OMQAlanguages. We will consider two kinds of tractability:
Definition 3.
Let $\mathcal{D}$ and $\mathcal{Q}$ be relational schemas, $\mathcal{C}$ and $\mathcal{Q}$ classes of queries, and $\mathcal{K}$ a complexity class. An OMQA[$\mathcal{Q}$]language $\mathcal{L}=(T,M)$ over $(\mathcal{D},\mathcal{Q})$ is

1.
$\mathcal{C}$rewritable if there is a computable function $rew$ that maps each ordered pair $(t,q)\in T\times \mathcal{Q}[\mathcal{Q}]$ to a boolean query ${\phi}_{t,q}\in \mathcal{C}[\mathcal{D}]$ such that $(D,q)\in M(t)$ iff $D\vDash {\phi}_{t,q}$; in this case, $rew$ is called a $\mathcal{C}$rewriting function of $\mathcal{L}$.

2.
$\mathcal{K}$compilable if there is a computable function $com$ that maps each ordered pair $(t,q)\in T\times \mathcal{Q}[\mathcal{Q}]$ to a Turing machine ${\mathbb{M}}_{t,q}$, whose running time belongs to the class $\mathcal{K}$, such that $(D,q)\in M(t)$ iff ${\mathbb{M}}_{t,q}$ accepts on the input $D$; in this case, $com$ is called a $\mathcal{K}$compiler of $\mathcal{L}$.
Example 2.
According to (?), the language of linear TGDs is both FOrewritable and AC${}^{0}$compilable, and the language of guarded TGDs is both Datalog${}^{\mathrm{\neg}}(\le )$rewritable and PTIMEcompilable.
Remark 1.
Clearly, there is a nonuniform way to redefine notions in Definition 3 by allowing rewriting functions and compilers to be uncomputable. However, it is worth noting that languages defined in such a way could be intractable. In fact, there is a nonuniform FOrewritable OMQAlanguage in which the query answering is highly undecidable.
Next we give the definition of universal OMQAlanguage.
Definition 4.
Let $\mathcal{Q}$ be a class of queries, $\mathcal{D}$ and $\mathcal{Q}$ relational schemas, and $\mathcal{L}=(T,M)$ and ${\mathcal{L}}^{\prime}=({T}^{\prime},{M}^{\prime})$ OMQA[$\mathcal{Q}$]languages over $(\mathcal{D},\mathcal{Q})$. Then we say that ${\mathcal{L}}^{\prime}$ is at least as expressive as $\mathcal{L}$, written $\mathcal{L}\le {\mathcal{L}}^{\prime}$, if for each theory $t\in T$ there is a theory ${t}^{\prime}\in {T}^{\prime}$ such that $M(t)={M}^{\prime}(t)$; and ${\mathcal{L}}^{\prime}$ has the same expressiveness as $\mathcal{L}$ if both $\mathcal{L}\le {\mathcal{L}}^{\prime}$ and ${\mathcal{L}}^{\prime}\le \mathcal{L}$.
An OMQA[$\mathcal{Q}$]language $\mathcal{L}$ is called universal for a family $\mathcal{L}$ of OMQA[$\mathcal{Q}$]languages over $(\mathcal{D},\mathcal{Q})$ if (i) $\mathcal{L}\in \mathcal{L}$, and (ii) for all languages ${\mathcal{L}}^{\prime}\in \mathcal{L}$, we have that ${\mathcal{L}}^{\prime}\le \mathcal{L}$.
Nonexistence for the General Case
One ambitious goal in OMQA is to find some universal language for the tractable OMQA. Unfortunately, the following theorem shows that this goal is in general unachievable.
Theorem 1.
Let $\mathrm{D}$ and $\mathrm{Q}$ be relational schemas such that $\mathrm{Q}$ contains a relation symbol of arity $\mathrm{\ge}\mathrm{2}$, and suppose $\mathrm{C}\mathrm{\in}\mathrm{\{}\text{\mathit{F}\mathit{O}}\mathrm{,}\text{\mathit{F}\mathit{O}}\mathit{}\mathrm{(}\mathrm{+}\mathrm{,}\mathrm{\times}\mathrm{)}\mathrm{,}{\text{\mathit{D}\mathit{a}\mathit{t}\mathit{a}\mathit{l}\mathit{o}\mathit{g}}}^{\mathrm{\neg}}\mathit{}\mathrm{(}\mathrm{\le}\mathrm{)}\mathrm{\}}$ and ACQ $\mathrm{\subseteq}$ $\mathrm{Q}\mathrm{\subseteq}\text{\mathit{U}\mathit{C}\mathit{Q}}$. Then there is no universal language for the family of $\mathrm{C}$rewritable OMQA[$\mathrm{Q}$]languages over $\mathrm{(}\mathrm{D}\mathrm{,}\mathrm{Q}\mathrm{)}$.
Since AC${}^{0}$ and PTIME are exactly captured by FO$(+,\times )$ and Datalog${}^{\mathrm{\neg}}(\le )$ respectively, by Theorem 1 we have
Corollary 2.
Let $\mathrm{D}$ and $\mathrm{Q}$ be relational schemas such that $\mathrm{Q}$ contains at least one relation symbol of arity $\mathrm{\ge}\mathrm{2}$, and suppose $\mathrm{K}\mathrm{\in}\mathrm{\{}$AC${}^{\mathrm{0}}$, PTIME$\mathrm{\}}$ and ACQ $\mathrm{\subseteq}$ $\mathrm{Q}\mathrm{\subseteq}\text{\mathit{U}\mathit{C}\mathit{Q}}$. Then there is no universal language for the family of $\mathrm{K}$compilable OMQA[$\mathrm{Q}$]languages over $\mathrm{(}\mathrm{D}\mathrm{,}\mathrm{Q}\mathrm{)}$.
To prove Theorem 1, the general idea is to implement a diagonalization argument as follows. Assume by contradiction that there is a universal language for the desired family. We first give an effective enumeration for all nontrivial ontologies defined in the universal language. With this enumeration, we then construct a new OMQA[$\mathcal{Q}$]ontology $O$ and a new language ${\mathcal{L}}^{\prime}$ in which $O$ is definable; Finally we show that ${\mathcal{L}}^{\prime}$ is still $\mathcal{C}$rewritable, which leads to a contradiction.
Proof of Theorem 1.
Only consider the case where $\mathcal{C}=\text{FO}$ and $\mathcal{Q}=\text{UCQ}$. Assume by contradiction that there is a universal language for FOrewritable OMQA[UCQ]languages over $(\mathcal{D},\mathcal{Q})$. Let $\mathcal{L}=(T,M)$ be such a language. Our task is to define another FOrewritable OMQA[UCQ]language that is strictly more expressive than $\mathcal{L}$. To do this, we first construct an ontology that is not definable in $\mathcal{L}$.
Before we present the construction, some notations are needed. W.l.o.g., we assume that there is a binary relation symbol $R$ in $\mathcal{Q}$. Note that, by a repetition of the parameters, $R$ can be always simulated by another relation symbol of arity $>2$. For example, one can use $S(x,x,y)$ to simulate $R(x,y)$. With this assumption, we first define a sequence of acyclic CQs. For all integers $n\ge 1$, we define
$${q}_{n}=\exists {x}_{0}\mathrm{\cdots}\exists {x}_{n}(R({x}_{0},{x}_{1})\wedge \mathrm{\cdots}\wedge R({x}_{n1},{x}_{n})).$$ 
Intuitively, ${q}_{n}$ asserts that there is a cyclefree path (via $R$) of length $n+1$ in the intended model.
Let $\overrightarrow{s}=({s}_{1},{s}_{2},\mathrm{\dots})$ be an effective enumeration^{1}^{1} 1 I.e., there is a Turing machine to generate such an enumeration. of all the theories in $T$. Such an enumeration clearly exists. Now our task is to construct countably infinite sequences $\overrightarrow{N}$ and $\overrightarrow{t}$, where $\overrightarrow{N}=({N}_{1},{N}_{2},\mathrm{\dots})$ is a sequence of positive integers, and $\overrightarrow{t}=({t}_{1},{t}_{2},\mathrm{\dots})$ is a sequence of theories in $T$. The sequences are required to have the following properties:

1.
$\overrightarrow{N}$ is monotonic increasing, i.e., ${N}_{i}\le {N}_{j}$ if $$;

2.
For all $k\ge 1$ there exists a database $D$ with $(D,{q}_{k})\in M({t}_{k})$ and $adom(D)\le {N}_{k}$;

3.
For all $t\in T\setminus \overrightarrow{t}$ there exists $i>0$ such that $adom(D)>{N}_{i}+1$ for all databases $D$ with $(D,{q}_{i})\in M(t)$.
Procedure 1 is devoted to generate the desired sequences.
Now we have the following property:
Claim 1. The sequences $\overrightarrow{N}$ and $\overrightarrow{t}$ generated by Procedure 1 satisfy Properties (13).
Proof.
Properties 1 and 2 are clear from Procedure 1. So it remains to show Property 3. Suppose $t={s}_{k}$ for some $k\ge 1$. Since $t$ has no occurrence in $\overrightarrow{t}$, according to Procedure 1, we know that, whenever lines 5 and 6 are executed for $j=k$, conditions in both “if” statements must be false. (Otherwise we will have $t\in \overrightarrow{t}$.) In addition, as $n$ increases arbitrarily, we know that line 6 must be executed. This means that there is some $i\ge 1$ such that $adom(D)>{N}_{i}+1$ for all databases $D$ with $(D,{q}_{i})\in M(t)$, which then yields the claim. ∎
Now we are able to construct the desired ontology. To do this, we first define some notations. For $n\ge 1$, let ${\lambda}_{n}$ denote the sentence $$, which asserts that the intended domain contains at least $n$ elements. Given a boolean UCQ $q$, if there exists an integer $k\ge 1$ such that ${q}_{k}\models q$, let ${\phi}_{q}$ denote ${\lambda}_{{N}_{m}+1}$ where $m$ is the least integer among such $k$s, and let ${\phi}_{q}$ denote the sentence $\exists x\mathrm{\neg}(x=x)$ (always false) if no such $k$s exist. Furthermore, we define
$$O=\{(D,q):D\in \text{DB}[\mathcal{D}]\&q\in \text{UCQ}[\mathcal{Q}]\&D\vDash {\phi}_{q}\}.$$ 
It is not difficult to prove the following properties:
Claim 2. Let $p$ and ${p}^{\mathrm{\prime}}$ be boolean UCQs. Then we have:

1.
If $p\models {p}^{\prime}$ then ${\phi}_{p}\models {\phi}_{{p}^{\prime}}$;

2.
${\phi}_{p\wedge {p}^{\prime}}\equiv {\phi}_{p}\wedge {\phi}_{{p}^{\prime}}$
Proof.
1. For the case where there exists no integer $i\ge 1$ such that ${q}_{i}\models p$, we have that ${\phi}_{p}=\exists x\mathrm{\neg}(x=x)$, which is always unsatisfiable. This implies that ${\phi}_{p}\models {\phi}_{{p}^{\prime}}$ trivially.
Now it remains to show the case where there exists $i\ge 1$ such that ${q}_{i}\models p$. Let $m$ be the least integer such that ${q}_{m}\models p$. Then we have ${\phi}_{p}={\lambda}_{{N}_{m}+1}$. From $p\models {p}^{\prime}$, we then have ${q}_{m}\models {p}^{\prime}$. Let $n$ be the least integer such that ${q}_{n}\models {p}^{\prime}$. Then it is clear that $n\le m$. According to Property 1, we also know that ${N}_{n}\le {N}_{m}$, which implies that ${\lambda}_{{N}_{m}+1}\models {\lambda}_{{N}_{n}+1}$, or equivalently, ${\phi}_{p}\models {\phi}_{{p}^{\prime}}$. This proves Statement 1.
2. For the case where there is no integer $i\ge 1$ such that ${q}_{i}\models p$, we have that ${\phi}_{p}=\exists x\mathrm{\neg}(x=x)={\phi}_{p\wedge {p}^{\prime}}$, which implies the desired equivalence. The same argument applies to the case where there is no integer $i\ge 1$ such that ${q}_{i}\models {p}^{\prime}$.
Now, it remains to consider the case where there are integers $i$ and $j$ such that ${q}_{i}\models p$ and ${q}_{j}\models {p}^{\prime}$. Let $m$ and $n$ denote the least integers among such $i$s and $j$s, respectively. W.l.o.g., suppose $m\ge n$. Then we have both ${q}_{m}\models {q}_{n}\models {p}^{\prime}$ and ${q}_{m}\models p$. Combining both of them, we know that $m$ is the least integer such that ${q}_{m}\models p\wedge {p}^{\prime}$. Thus, we have that ${\phi}_{p}={\lambda}_{{N}_{m}+1}={\phi}_{p\wedge {p}^{\prime}}$. On the other hand, it is also clear that ${\lambda}_{{N}_{m}+1}\models {\lambda}_{{N}_{n}+1}$, or equivalently ${\phi}_{p}\models {\phi}_{{p}^{\prime}}$, which implies that ${\phi}_{p}\wedge {\phi}_{{p}^{\prime}}\equiv {\phi}_{p}$. Consequently, we obtain that ${\phi}_{p\wedge {p}^{\prime}}\equiv {\phi}_{p}\wedge {\phi}_{{p}^{\prime}}$, which completes the proof. ∎
Claim 3. $O$ is an OMQA[UCQ]ontology.
Proof.
The closure property of $O$ under injective database homomorphisms is clear since, for any boolean UCQ $q$, ${\phi}_{q}$ is preserved under injective homomorphisms.
Next we show that $O$ is closed under query conjunctions. Suppose $(D,p)\in O$ and $(D,{p}^{\prime})\in O$. By definition, we have both $D\vDash {\phi}_{p}$ and $D\vDash {\phi}_{{p}^{\prime}}$, which means that $D\vDash {\phi}_{p}\wedge {\phi}_{{p}^{\prime}}$. By Statement 2 of Claim 2, we then have that $D\vDash {\phi}_{p\wedge {p}^{\prime}}$, which implies that $(D,p\wedge {p}^{\prime})\in O$ as desired.
Now it remains to show the closure of $O$ under query implications. Suppose $(D,p)\in O$ and $p\models {p}^{\prime}$. We need to prove $(D,{p}^{\prime})\in O$. From $(D,p)\in O$ we have $D\vDash {\phi}_{p}$, and from $p\models {p}^{\prime}$, we have ${\phi}_{p}\models {\phi}_{{p}^{\prime}}$ by Statement 1 of Claim 2. Combining both of these, we obtain $D\vDash {\phi}_{{p}^{\prime}}$. By definition, it follows that $(D,{p}^{\prime})\in O$, which completes the proof. ∎
Claim 4. $O\mathrm{\ne}M\mathit{}\mathrm{(}t\mathrm{)}$ for any theory $t\mathrm{\in}T$.
Proof.
First consider the case where $t$ occurs in $\overrightarrow{t}$, and suppose $t={t}_{k}$ for some $k\ge 1$. According to the definition of $\overrightarrow{t}$, we know that there is a database $D$ with $(D,{q}_{k})\in M({t}_{k})$ and $adom(D)\le {N}_{k}$. On the other hand, by the definition of ${\phi}_{{q}_{k}}$ has no model $D$ with $adom(D)\le {N}_{k}$, which means that there is no database $D$ with $(D,{q}_{k})\in O$ and $adom(D)\le {N}_{k}$. Consequently, we have $O\ne M(t)$.
Now it remains to consider the case where $t$ does not occur in $\overrightarrow{t}$. By Claim 1, it suffices to show that for every integer $k\ge 1$ there exists a database $D$ with $(D,{q}_{k})\in O$ and $adom(D)\le {N}_{k}+1$, or equivalently, ${\phi}_{{q}_{k}}$ has a model that contains at most ${N}_{k}+1$ elements. According to the definition of ${\phi}_{{q}_{k}}$, the latter is indeed true. This also implies that $O\ne M(t)$, and completes the proof immediately. ∎
With Claims 3 and 4, we are now in the position to prove the desired theorem. Let ${t}^{\prime}$ be a binary string such that ${t}^{\prime}\notin T$, and let ${T}^{\prime}=T\cup \{{t}^{\prime}\}$. Following the decidability of $T$, we have the decidability of ${T}^{\prime}$. Let ${M}^{\prime}$ be a function that extends $M$ by mapping ${t}^{\prime}$ to $O$, and let ${\mathcal{L}}^{\prime}=({T}^{\prime},{M}^{\prime})$. By Claim 3, we know that ${\mathcal{L}}^{\prime}$ is an OMQA[UCQ]language. Suppose $rew$ is an FOrewriting function. Let $re{w}^{\prime}$ be a function that extends $rew$ by mapping $({t}^{\prime},q)$ to ${\phi}_{q}$ for all boolean UCQs $q$. By a slight modification to Procedure 1, one can easily devise an algorithm to compute ${N}_{i}$ (and ${s}_{i}$) on given integer $i\ge 1$. This implies that $re{w}^{\prime}$ is computable. By definition, we know that $rew$ is an FOrewriting function, which implies that ${\mathcal{L}}^{\prime}$ is FOrewritable. By Claim 4, we also know that ${\mathcal{L}}^{\prime}$ is strictly more expressive than $\mathcal{L}$, a contradiction as desired. And this completes the proof. ∎
Remark 2.
Since the sentence ${\phi}_{q}$ defined in the above proof is also an FO$(+,\times )$sentence, so the proof directly applies to the case of FO$(+,\times )$. For a proof of the remaining case, one can convert ${\phi}_{q}$ to a Datalog${}^{\mathrm{\neg}}(\le )$program.
Locality to the Rescue
In the last section, we proved that there is no universal language for tractable OMQA in general. Then, a natural question arises as to whether one can find a natural property that approximates the tractability but still allows the existence of a universal language. The challenge here is that the property should be manageable enough to avoid a diagonalization argument (see the proof of Theorem 1). Below we propose a property as an approximation of the FOrewritability.
Locality as Approximation of FOrewritability
A bound function is a computable function $\mathrm{\ell}:\mathbb{N}\to \mathbb{N}$ such that $\mathrm{\ell}(n)\ge n$ for $n\in \mathbb{N}$. To simplify the presentation, we fix a way to represent bound functions, e.g., one can represent each bound function by a Turing machine that computes it. A class of bound functions is called decidable if the class of representations of those bound functions is decidable.
To measure the size of a query, we fix a computable function $\cdot $ that maps each UCQ to a positive integer. Clearly, there are many methods to define $\cdot $. The only restriction is that we require $p\wedge q\ge p+q$ for all UCQs $p$ and $q$.
Definition 5.
Let $\mathcal{D}$ and $\mathcal{Q}$ be relational schemas, and $\mathcal{Q}$ a class of queries, $O$ an OMQA[$\mathcal{Q}$]ontology over $(\mathcal{D},\mathcal{Q})$, and $\mathrm{\ell}$ a bound function. Then $O$ is called $\mathrm{\ell}$local if for all boolean $\mathcal{Q}$queries $q\in \mathcal{Q}$ and all $\mathcal{D}$databases $D$ there is a set $A$, which consists of at most $\mathrm{\ell}(q)$ constants, such that
$$(D,q)\in O\mathit{\hspace{1em}}\text{iff}\mathit{\hspace{1em}}({D}_{A},q)\in O.$$ 
Furthermore, given an OMQA[$\mathcal{Q}$]language $\mathcal{L}$, a bound function $\mathrm{\ell}$ and a class $\U0001d5a5$ of bound functions, $\mathcal{L}$ is called $\mathrm{\ell}$local if allOMQA[$\mathcal{Q}$] ontologies defined in $\mathcal{L}$ is $\mathrm{\ell}$local, and $\mathcal{L}$ is $\U0001d5a5$local if it is ${\mathrm{\ell}}^{\prime}$local for some bound function ${\mathrm{\ell}}^{\prime}\in \U0001d5a5$.
One might question why the bounded locality is a good approximation to the firstorder rewritability. Let ${\exists}^{+}\text{FO}(\ne )$ denote the class of firstorder sentences built on atoms and inequalities by using connectives $\wedge ,\vee $ and the quantifier $\exists $. Obviously, this class is exactly the class of UCQs with inequalities. It had been observed by ? that ${\exists}^{+}\text{FO}(\ne )$ captures the class of firstorder sentences that preserved under injective homomorphisms (?). It remains open whether such a preservation theorem holds on finite structures (or databases). If this is indeed true, by the following proposition we then have that an OMQAlanguage is FOrewritable iff it is $\mathrm{\ell}$local for some bound function $\mathrm{\ell}$.
Proposition 3.
Let $\mathrm{D}$ and $\mathrm{Q}$ be relational schemas, $O$ an OMQA[UCQ]ontology over $\mathrm{(}\mathrm{D}\mathrm{,}\mathrm{Q}\mathrm{)}$, and $\mathrm{\ell}$ a bound function. Then $O$ is $\mathrm{\ell}$local iff for each boolean $\mathrm{Q}$UCQ $q$ there is a ${\mathrm{\exists}}^{\mathrm{+}}\text{\mathit{F}\mathit{O}}\mathit{}\mathrm{(}\mathrm{\ne}\mathrm{)}$sentence $\phi $ involving at most $\mathrm{\ell}\mathit{}\mathrm{(}\mathrm{}q\mathrm{}\mathrm{)}$ terms such that $\mathrm{(}D\mathrm{,}q\mathrm{)}\mathrm{\in}O$ iff $D\mathrm{\vDash}\phi $ for all $\mathrm{D}$databases $D$.
Proof.
For the direction of “if”, let us assume that for each boolean $\mathcal{Q}$UCQ $q$ there is a ${\exists}^{+}\text{FO}(\ne )$sentence $\phi $ involving at most $\mathrm{\ell}(q)$ terms such that $(D,q)\in O$ iff $D\vDash \phi $ for all $\mathcal{D}$databases $D$. We need to show that $O$ is $\mathrm{\ell}$local. Let $q$ be a boolean $\mathcal{Q}$UCQ, and $\phi $ a ${\exists}^{+}\text{FO}(\ne )$sentence involving at most $\mathrm{\ell}(q)$ terms such that $(D,q)\in O$ iff $D\vDash \phi $ for all $\mathcal{D}$databases $D$. By the assumption, such a sentence does exist. Suppose $\phi =\exists \overrightarrow{x}\psi $ where $\psi $ is a quantifierfree existential positive firstorder formula with inequalities and involving at most $\mathrm{\ell}(q)$ terms. Let $D$ be a $\mathcal{D}$database. If $D\vDash \phi $, then let $A=\{s(x):x\in \overrightarrow{x}\}\cup const(\phi )$, where $s$ is an assignment such that $D\vDash \psi [s]$. Otherwise, let $A$ be any subset of $adom(D)$ such that $A\le k$. In both cases we have the following: (i) $A\le k$, and (ii) $D\vDash \phi $ iff ${D}_{A}\vDash \phi $. From the latter, we know that $(D,q)\in O$ iff $({D}_{A},q)\in O$. We thus yields that $O$ is $\mathrm{\ell}$local as desired.
Conversely, suppose $O$ is $\mathrm{\ell}$local. Let $q$ be a boolean $\mathcal{Q}$UCQ. Given a $\mathcal{D}$database $D$, let $A\subseteq adom(D)$ be a witness of the locality of $O$ w.r.t. $q$, let ${\phi}_{D}$ denote the conjunction of all facts in $D$; let ${\widehat{\phi}}_{D}$ be the formula obtained from ${\phi}_{D}$ by replacing each constant that does not occur in $q$ by a fresh variable; and let ${\psi}_{D}$ denote the sentence $\exists \overrightarrow{x}({\widehat{\phi}}_{D}\wedge {\lambda}_{\overrightarrow{x}})$, where $\overrightarrow{x}$ is the tuple of all variables occurring in ${\widehat{\phi}}_{D}$, and ${\lambda}_{\overrightarrow{x}}$ denotes the conjunction of ${x}_{i}\ne {x}_{j}$ for each pair of distinct variables ${x}_{i},{x}_{j}\in \overrightarrow{x}$. It is easy to see that, up to logical equivalence, there is only a finite number of ${\psi}_{D}$ for all $\mathcal{D}$databases $D$ such that $(D,q)\in O$. Let ${\psi}_{q}$ be a disjunction of ${\psi}_{D}$ for all $\mathcal{D}$databases $D$ with $adom(D)\le \mathrm{\ell}(q)$ and $(D,q)\in O$. Clearly, ${\psi}_{q}$ is equivalent to a ${\exists}^{+}\text{FO}(\ne )$sentence that involves at most $\mathrm{\ell}(q)$ terms. To complete the proof, it suffices to show the following property:
Claim. $(D,q)\in O$ iff $D\vDash {\psi}_{q}$ for all databases $D$ over $\mathcal{D}$.
Now it remains to prove the claim. Let $D$ be a database over $\mathcal{D}$. We first prove the direction of “only if”. Suppose $(D,q)\in O$. Since $O$ is $\mathrm{\ell}$local, there should be a $\mathcal{D}$database ${D}^{\prime}\subseteq D$ such that $({D}^{\prime},q)\in O$ and $adom({D}^{\prime})\le \mathrm{\ell}(q)$. By the definition of ${\psi}_{q}$, we know that ${\psi}_{{D}^{\prime}}$ is equivalent to a disjunct of ${\psi}_{q}$. It is clear that ${D}^{\prime}\vDash {\psi}_{{D}^{\prime}}$. From ${D}^{\prime}\subseteq D$ we the have $D\vDash {\psi}_{{D}^{\prime}}$, which implies $D\vDash {\psi}_{q}$ as desired.
For the converse, we assume that $D\vDash {\psi}_{q}$. Then there is a database ${D}^{\prime}$ over $\mathcal{D}$ with $adom({D}^{\prime})\le \mathrm{\ell}(q)$ such that (i) $({D}^{\prime},q)\in O$ and (ii) ${\psi}_{{D}^{\prime}}$ is a disjunct of ${\psi}_{q}$. From (ii) we have $D\vDash {\psi}_{{D}^{\prime}}$, which means that there is an injective $C$homomorphism from ${D}^{\prime}$ to $D$, where $C=const(q)$. As $O$ is closed under injective database homomorphisms, we have $(D,q)\in O$ as desired, which completes the proof. ∎
Remark 3.
Proposition 3 reveals an intrinsic connection between the bounded locality and the complexity of rewritings. We will elaborate this in an extended version of this paper.
Universal Language for Local OMQA
Now it remains to know whether the bounded locality allows the existence of universal languages. For convenience, in the rest of this section, we fix $\mathrm{F}$ as a decidable class of bound functions; fix $\mathrm{D}$ and $\mathrm{Q}$ as a pair of disjoint relational schemas. The disjointness will not introduce any real limitation. For instance, in a DEDlanguage, given any set $\mathrm{\Sigma}$ of DEDs, one can construct another set ${\mathrm{\Sigma}}^{\prime}$ of DEDs by introducing a fresh relation symbol ${\text{\mathit{R}}}^{\prime}$ for each $\text{\mathit{R}}\in \mathcal{D}$, and adding copy rules of the form ${\text{\mathit{R}}}^{\prime}(\overrightarrow{x})\to \text{\mathit{R}}(\overrightarrow{x})$. Clearly, ${\mathrm{\Sigma}}^{\prime}$ has the same behaviour over $({\mathcal{D}}^{\prime},\mathcal{Q})$ as $\mathrm{\Sigma}$ over $(\mathcal{D},\mathcal{Q})$, where ${\mathcal{D}}^{\prime}$ denotes the schema consisting of all the fresh symbols.
Surprisingly, we have the following result.
Theorem 4.
Let $\mathrm{Q}$ be a decidable class of UCQs. Then there exists a DEDlanguage that is universal for the family of $\mathrm{F}$local OMQA[$\mathrm{Q}$]languages over $\mathrm{(}\mathrm{D}\mathrm{,}\mathrm{Q}\mathrm{)}$.
Let $\mathrm{\ell}$ be any bound function in $\U0001d5a5$. To prove Theorem 4, the general idea is to develop a transformation that converts every DED set to an $\mathrm{\ell}$local DED set. In addition, for each DED set that is already $\mathrm{\ell}$local, the transformation is required to preserve the semantics of query answering. If such a transformation exists, since DED is universal for the family of OMQAlanguages in which query answering is recursively enumerable, we then obtain a universal language for the family of $\U0001d5a5$local OMQAlanguages.
Let us begin with a finite set $\mathrm{\Sigma}$ of DEDs over a relational schema $\mathcal{R}\supseteq \mathcal{D}\cup \mathcal{Q}$. To implement the desired transformation, we first show how to construct an $\mathrm{\ell}$local OMQA[$\mathcal{Q}$]ontology from $\mathrm{\Sigma}$. As a natural idea, one may expect to define the desired ontology by removing all the pairs $(D,q)$ from the original ontology (defined by $\mathrm{\Sigma}$) where $q$ is not $\mathrm{\ell}$local on $D$. Unfortunately, the ontology defined above is in general not welldefined. To construct the desired ontology, the $\mathrm{\ell}$locality and the closure under both query conjunctions and query implications should be maintained simultaneously.
Below we explain how to construct the ontology. We need to fix a strict linear order $\prec $ over $\mathcal{Q}$UCQs firstly. The strict linear order is required to satisfy $p\prec q$ for all $\mathcal{Q}$UCQs $p$ and $q$ such that $$. Clearly, such an order always exists. For the given set $\mathrm{\Sigma}$ of DEDs, let ${S}_{\mathrm{\Sigma}}$ be the set that consists of the ordered pair $(D,q)$ if $D$ is a $\mathcal{D}$database, $q$ is a $\mathcal{Q}$UCQ in $\mathcal{Q}$, and the following condition holds:
$\forall p$  $\in \mathcal{Q}[\mathcal{Q}]:p\le \widehat{pr}(q)\&\widehat{pr}(q)\models p$  (1)  
$\u27f9\exists A\subseteq adom(D)\text{s.t.}A\le \mathrm{\ell}(p){D}_{A}\cup \mathrm{\Sigma}\models p$ 
where $pr(q)$ is the set of boolean UCQs $p$ such that $p\prec q$ and $(D,p)\in {S}_{\mathrm{\Sigma}}$, and $\widehat{pr}(q)$ denotes the conjunction of $q$ and all UCQs in $pr(q)$. Moreover, we define ${O}_{\mathrm{\Sigma}}$ as the minimum superset of ${S}_{\mathrm{\Sigma}}$ that is closed under query conjunctions, query implications and injective database homomorphisms.
The constructed ontology enjoys several properties which will play important roles in our proof for Theorem 4.
Lemma 5.
If ${\mathrm{[}\mathrm{[}\mathrm{\Sigma}\mathrm{]}\mathrm{]}}_{\mathrm{D}\mathrm{,}\mathrm{Q}}^{\mathrm{Q}}$ is $\mathrm{\ell}$local, then ${O}_{\mathrm{\Sigma}}\mathrm{=}{\mathrm{[}\mathrm{[}\mathrm{\Sigma}\mathrm{]}\mathrm{]}}_{\mathrm{D}\mathrm{,}\mathrm{Q}}^{\mathrm{Q}}$.
Proof.
Follows from the definition of ${O}_{\mathrm{\Sigma}}$. ∎
Lemma 6.
${O}_{\mathrm{\Sigma}}$ is an $\mathrm{\ell}$local OMQA[$\mathrm{Q}$]ontology.
Proof.
We first claim that, for all UCQs $q$ with $(D,q)\in {O}_{\mathrm{\Sigma}}$, there exists an integer $k\ge 1$ and UCQs ${p}_{1},\mathrm{\dots},{p}_{k}$ such that $(D,{p}_{i})\in {S}_{\mathrm{\Sigma}}$ for each ${p}_{i}$ and ${p}_{1}\wedge \mathrm{\cdots}\wedge {p}_{k}\models q$. This can be proved by a routine induction of the construction of ${O}_{\mathrm{\Sigma}}$.
With the claim, w.l.o.g., we assume ${p}_{1}\prec {p}_{2}\prec \mathrm{\cdots}\prec {p}_{k}$. Let $p$ denote the query ${p}_{1}\wedge \mathrm{\cdots}\wedge {p}_{k}$. Obviously, it holds that $\widehat{pr}({p}_{k})\models p$, which implies that $\widehat{pr}({p}_{k})\models q$ immediately. On the other hand, by definition we know that ${p}_{i}$ is $\mathrm{\ell}$local on $D$, i.e., there is a set ${A}_{i}\subseteq adom(D)$ such that ${D}_{{A}_{i}}\cup \mathrm{\Sigma}\models {p}_{i}$. Let $A={A}_{1}\cup \mathrm{\cdots}\cup {A}_{k}$. We then have ${D}_{A}\cup \mathrm{\Sigma}\models p$ and $A\le \mathrm{\ell}({p}_{1})+\mathrm{\cdots}+\mathrm{\ell}({p}_{k})\le \mathrm{\ell}({p}_{1}+\mathrm{\cdots}+{p}_{k})\le \mathrm{\ell}(p)$. Consequently, we obtain that $p$ is $\mathrm{\ell}$local on $D$.
Now, it remains to show that $q$ is $\mathrm{\ell}$local on $D$. For the case where $p\le q$, from $p\models q$ and ${D}_{A}\cup \mathrm{\Sigma}\models p$, we obtain that ${D}_{A}\cup \mathrm{\Sigma}\models q$, which implies that $q$ is $\mathrm{\ell}$local on $D$. For the other case, it must be true that $p>q$. From the fact that $\widehat{pr}({p}_{k})\ge p$, we know that $\widehat{pr}({p}_{k})>q$. Since $(D,{p}_{k})\in {S}_{k}$ is true, by Condition (1) we know that there is a set $B\subseteq adom(D)$ such that ${D}_{B}\cup \mathrm{\Sigma}\models q$, which means that $q$ is $\mathrm{\ell}$local on $D$. This then completes the proof. ∎
Lemma 7.
${O}_{\mathrm{\Sigma}}$ is recursively enumerable.
Proof.
The lemma is a corollary of the following facts: (1) The validity problem for inference in firstorder logic is recursively enumerable; (2) The query containment problem for UCQs is decidable; (3) There are only a finite number of boolean $\mathcal{Q}$UCQs $p$ with $p\le \widehat{pr}(q)$; (4) There are only a finite number of subsets of $adom(D)$. (5) Both $\mathrm{\ell}$ and $\cdot $ are computable. (6) $\mathcal{Q}$ is decidable. ∎
Now, to define the transformation, it remains to show how to encode the ontology ${O}_{\mathrm{\Sigma}}$ by another set of DEDs. Suppose $D$ is the underlying database, and $q$ the underlying query. The encoding will be implemented in the following way:

1.
Simulate the query answering of $q$ under ${O}_{\mathrm{\Sigma}}$ and $D$.

2.
If the answer of Stage 1 is positive, then nondeterministically copy disjuncts of $q$ to generate the universal models.
The main challenges of implementing the above encoding are as follows. Firstly, instead of a single universal model, we need to generate a set of universal models in Stage 2. It is not clear whether the technique of generating universal model in (?) can be applied to this situation. Secondly, to encode the computation in Stage 1, a successor relation is needed. But it seems impossible to define such a relation in the language of DEDs explicitly.
Below we explain how to implement the encoding.
Defining Successor and Arithmetic Relations. To implement the desired encoding, a successor relation needs to be defined so that the constants in the underlying database $D$ can be ranged over. As there is no negation in the body of DEDs, it seems impossible to construct DEDs to traverse ALL constants in $adom(D)$. Fortunately, thanks to the closure of OMQAontologies under injective database homomorphisms, we do not need a successor relation on the full domain. The reason is as follows. Suppose we want to show that a query $q$ is derivable from the database $D$ under some ontology $O$. As $O$ is closed under injective database homomorphisms, it is equivalent to show whether there is a subset $A$ of $a\mathit{}d\mathit{}o\mathit{}m\mathit{}\mathrm{(}D\mathrm{)}$ such that $q$ is derivable from ${D\mathrm{}}_{A}$ under $O$.
To range over subsets of $adom(D)$, we employ the partial successor relations on $adom(D)$, each of which is a successor relation on some subset of $adom(D)$. Clearly, there is a partial successor relation for each subset $A$ of $adom(D)$. With the mentioned property, we will define some DEDs to generate partial successor relations on $adom(D)$. To check whether $q$ is derivable from $D$ under $O$, it would be sufficient to test whether the computation of Stage 1 halts with “accept” under a certain partial successor relation.
Our method to generate partial successor relations was inspired by ?’s technique to define successor relations in the language of TGDs (?). In that paper they showed that every homomorphismclosed database query can be defined by a set of TGDs. It is worth noting that the ontology mediated queries focused on this paper are not necessary to be closed under homomorphisms. So their technique cannot be applied directly. Fortunately, a linear order on $adom(D)$ can be easily defined by a set of DEDs, and with this order, we are able to use their idea to generate all partial successor relations that are compatible with the defined order. Now we show how to implement this idea.
Let AD be a unary relation symbol that will be interpreted as $adom(D)$. Clearly, such a relation can be easily defined by some DEDs. With the relation AD, a linear order relation Less over AD can then be defined in a routine way:
$\text{\mathit{A}\mathit{D}}(x)\wedge \text{\mathit{A}\mathit{D}}(y)\to \text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(x,y)\vee x=y\vee \text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(y,x)$  (2)  
$\text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(x,y)\wedge \text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(y,z)\to \text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(x,z)$  (3)  
$\text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(x,x)\to \perp $  (4) 
To generate all partial successor relations compatible with Less, we link each constant $c$ in $adom(D)$ with a alias $a$ by the relation $\text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(c,a)$. Suppose ${a}_{1}$ and ${a}_{2}$ are aliases of constants ${c}_{1}$ and ${c}_{2}$ respectively, by $\text{\mathit{N}\mathit{e}\mathit{x}\mathit{t}}({a}_{1},{a}_{2})$ we mean that ${c}_{2}$ is the immediate successor of ${c}_{1}$ in the underlying successor relation. The head (resp., the tail) of a partial successor relation is denoted by $\text{\mathit{F}\mathit{i}\mathit{r}\mathit{s}\mathit{t}}(a)$ (resp., $\text{\mathit{L}\mathit{a}\mathit{s}\mathit{t}}(b)$). In particular, we use $a$ as the name of the underlying relation. Every partial successor relation is required to have a head and a tail. To generate these relations, we use the following DEDs:
$\text{\mathit{A}\mathit{D}}(x)\to \exists v\text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(x,v)\wedge \text{\mathit{L}\mathit{a}\mathit{s}\mathit{t}}(v)\wedge \text{\mathit{F}\mathit{i}\mathit{r}\mathit{s}\mathit{t}}(v)$  (5)  
$\text{\mathit{A}\mathit{D}}(x)\to \exists v\text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(x,v)\wedge \text{\mathit{L}\mathit{a}\mathit{s}\mathit{t}}(v)\wedge \text{\mathit{P}\mathit{a}\mathit{r}\mathit{t}\mathit{i}\mathit{a}\mathit{l}}(v)$  (6)  
$\begin{array}{cc}\hfill \text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(x,y& )\wedge \text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(y,v)\wedge \text{\mathit{P}\mathit{a}\mathit{r}\mathit{t}\mathit{i}\mathit{a}\mathit{l}}(v)\hfill \\ & \to \exists u\text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(x,u)\wedge \text{\mathit{N}\mathit{e}\mathit{x}\mathit{t}}(u,v)\wedge \text{\mathit{F}\mathit{i}\mathit{r}\mathit{s}\mathit{t}}(u)\hfill \end{array}$  (7)  
$\begin{array}{cc}\hfill \text{\mathit{L}\mathit{e}\mathit{s}\mathit{s}}(x,y& )\wedge \text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(y,v)\wedge \text{\mathit{P}\mathit{a}\mathit{r}\mathit{t}\mathit{i}\mathit{a}\mathit{l}}(v)\hfill \\ & \to \exists u\text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(x,u)\wedge \text{\mathit{N}\mathit{e}\mathit{x}\mathit{t}}(u,v)\wedge \text{\mathit{P}\mathit{a}\mathit{r}\mathit{t}\mathit{i}\mathit{a}\mathit{l}}(u)\hfill \end{array}$  (8) 
To understand how these DEDs work in more detail, please refer to the following example.
Example 3.
Let $D$ be a database which involves only constants ${c}_{1},{c}_{2}$ and ${c}_{3}$, and suppose the linear order defined by Less is ${c}_{1}>{c}_{2}>{c}_{3}$. By an exhaustive application of DEDs (68),^{2}^{2} 2 To make the figure simple, we use the semioblivious chase. we obtain an instance as illustrated by Figure 1.
As seen in Figure 1, there are 7 partial successor relations ${s}_{1},\mathrm{\dots},{s}_{7}$ generated in the instance. For instance, ${s}_{1}$ defines the partial successor relation involving only ${c}_{1}$; ${s}_{5}$ defines the relation ${c}_{2}>{c}_{3}$; ${s}_{7}$ defines the relation ${c}_{1}>{c}_{2}>{c}_{3}$.
To encode Stage 1 mentioned before, we need to generate a linear order and the corresponding successor relation on a countably infinite domain, making sure they are compatible with the underlying partial successor relation on $adom(D)$. More relations are needed to do this. $\text{\mathit{Z}\mathit{e}\mathit{r}\mathit{o}}(o,a)$ means that $a$ is the least element under the order $o$; $\text{\mathit{D}\mathit{M}\mathit{a}\mathit{x}}(o,a)$ states that $a$ is the largest element in $adom(D)$ under the order $o$; $\text{\mathit{S}\mathit{u}\mathit{c}\mathit{c}}(o,a,b)$ denotes that $b$ is the immediate successor of $a$ under the order $o$; and $\text{\mathit{L}\mathit{T}}(o,a,b)$ asserts that $a$ is less than $b$ under the order $o$. For a technical reason, we also need some auxiliary relations. $\text{\mathit{T}\mathit{C}}(o,a)$ denotes that $a$ is not less than the largest element in $adom(D)$ under the order $o$, and $\text{\mathit{R}\mathit{T}}(o,a,c)$ means that $a$ is an alias of $c$ and it is used to build the order $o$. All of these are defined by the following DEDs:
$\text{\mathit{F}\mathit{i}\mathit{r}\mathit{s}\mathit{t}}(w)\wedge \text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(x,w)\to \text{\mathit{Z}\mathit{e}\mathit{r}\mathit{o}}(w,x)\wedge \text{\mathit{R}\mathit{T}}(w,w,x)$  (9)  
$\begin{array}{cc}\hfill \text{\mathit{N}\mathit{e}\mathit{x}\mathit{t}}(u,v)\wedge \text{\mathit{R}\mathit{T}}(w,u,& x)\wedge \text{\mathit{L}\mathit{i}\mathit{n}\mathit{k}}(y,v)\hfill \\ & \to \text{\mathit{S}\mathit{u}\mathit{c}\mathit{c}}(w,x,y)\wedge \text{\mathit{R}\mathit{T}}(w,v,y)\hfill \end{array}$  (10)  
$\text{\mathit{L}\mathit{a}\mathit{s}\mathit{t}}(v)\wedge \text{\mathit{R}\mathit{T}}(w,v,x))\to \text{\mathit{D}\mathit{M}\mathit{a}\mathit{x}}(w,x)\wedge \text{\mathit{T}\mathit{C}}(w,x)$  (11)  
$\text{\mathit{T}\mathit{C}}(v,x)\to \exists z.\text{\mathit{S}\mathit{u}\mathit{c}\mathit{c}}(v,x,y)\wedge \text{\mathit{T}\mathit{C}}(v,y)$  (12)  
$\text{\mathit{S}\mathit{u}\mathit{c}\mathit{c}}(v,x,y)\to \text{\mathit{L}\mathit{T}}(v,x,y)$  (13)  
$\text{\mathit{L}\mathit{T}}(v,x,y)\wedge \text{\mathit{L}\mathit{T}}(v,y,z)\to \text{\mathit{L}\mathit{T}}(v,x,z)$  (14) 
With these relations, it is routine to define arithmetic relations such as $\text{\mathit{A}\mathit{d}\mathit{d}}(o,a,b,c)$ (asserting that $c=a+b$ under the order $o$) and ${\text{\mathit{B}\mathit{i}\mathit{t}}}_{i}(o,a,b)$ (asserting that the $b$th bit of the binary representation of $a$ is $i$). We omit the details here.
Simulating Query Answering under ${O}_{\mathrm{\Sigma}}$. With a partial successor relation and the related arithmetic relations, we are now in the position to define some DEDs to simulate the query answering of $q$ under ${O}_{\mathrm{\Sigma}}$ and $D$.
Our encoding that implements the simulation of query answering is almost the same as that in Section 5.3 of (?). As proved by ? (see Proposition 6 of (?)), all recursively enumerable OMQAontologies can be recognized by a certain class of Turing machines, called convergent $2$bounded nondeterministic Turing machines. Although the queries involved in that work are only boolean CQs, by a similar argument one can show that the result can be generalized to the case where boolean UCQs are involved. The only difference is that, to deal with UCQs, we have to change the format of input slightly. Due to the space limit, we omit the details here.
With the result mentioned above, we can then find a convergent $2$bounded nondeterministic Turing machine ${\mathbb{M}}_{\mathrm{\Sigma}}$ to recognize ${O}_{\mathrm{\Sigma}}$. By employing the DEDs defined in Section 5.3 of (?) (with a slight modification to specify the partial successor relation), we are then able to simulate the computation of ${\mathbb{M}}_{\mathrm{\Sigma}}$ on the input $(D,q)$.
To restore the result of the query answering, we use a binary relation symbol Accept. By $\text{\mathit{A}\mathit{c}\mathit{c}\mathit{e}\mathit{p}\mathit{t}}(o,a)$ we mean that the machine ${\mathbb{M}}_{\mathrm{\Sigma}}$ halts on input $(D,q)$ with “accept”, and $o$ is the partial successor relation to implement the computation.
Generating Universal Models. By applying all the DEDs that we have constructed, we will obtain the class of boolean UCQs that are derivable from $D$ under ${O}_{\mathrm{\Sigma}}$. With such a class of UCQs, now our task is to construct a universal model set.
Given a class $\mathcal{D}$ of databases and a set $C$ of constants, let
$$\underset{C}{\oplus}\mathcal{D}=\bigcup \{{D}^{\ast}:D\in \mathcal{D}\}$$ 
where, for each database $D\in \mathcal{D}$, ${D}^{\ast}$ is an isomorphic copy of $D$ such that, for any pair of distinct databases ${D}_{1},{D}_{2}\in \mathcal{D}$, only constants from $C$ will be shared by ${D}_{1}^{\ast}$ and ${D}_{2}^{\ast}$.
Let $D$ be a $\mathcal{D}$database, and $O$ an OMQA[UCQ]ontology over $(\mathcal{D},\mathcal{Q})$. Given a boolean UCQ $q$, let ${\mathcal{D}}_{q}$ denote the set consisting of $[p]$ for each disjunct (a boolean CQ) of $q$. Let
$$\mathrm{\Gamma}(O,D)=\{{\mathcal{D}}_{q}:(D,q)\in O\}.$$ 
Let $\mathcal{U}(O,D)$ denote the set that consists of ${\oplus}_{C}H$ for each minimum hitting set $H$ of $\mathrm{\Gamma}(O,D)$, where $C=adom(D)$.
Proposition 8.
Let $O$ be an OMQA[UCQ]ontology over $\mathrm{(}\mathrm{D}\mathrm{,}\mathrm{Q}\mathrm{)}$, let $D$ be a $\mathrm{D}$database, and let $q$ be a boolean $\mathrm{Q}$UCQ such that $\text{\mathit{c}\mathit{o}\mathit{n}\mathit{s}\mathit{t}}\mathit{}\mathrm{(}q\mathrm{)}\mathrm{\subseteq}\text{\mathit{a}\mathit{d}\mathit{o}\mathit{m}}\mathit{}\mathrm{(}D\mathrm{)}$. Then $\mathrm{(}D\mathrm{,}q\mathrm{)}\mathrm{\in}O$ iff $I\mathrm{\vDash}q$ for all instances $I\mathrm{\in}\mathrm{U}\mathit{}\mathrm{(}O\mathrm{,}D\mathrm{)}$.
Proof.
Let $\mathrm{\Lambda}$ denote the set of all boolean UCQs $p$ such that $(D,p)\in O$. We first show a property as follows.
Claim. $\mathrm{\Lambda}\models q$ iff $I\vDash q$ for all instances $I\in \mathcal{U}(O,D)$.
Proof.
First consider the direction of “only if”. Suppose we have $\mathrm{\Lambda}\models q$, and let $I$ be any instance in $\mathcal{U}(O,D)$. We need to prove that $I\vDash q$. According to the definition of $\mathcal{U}(O,D)$, we know that there is a minimum hitting set $H$ of $\mathrm{\Gamma}(O,D)$ such that $I={\oplus}_{\text{\mathit{a}\mathit{d}\mathit{o}\mathit{m}}(D)}H$. This implies that for each UCQ ${q}_{0}\in \mathrm{\Lambda}$ there is a disjunct $p$ (which is a boolean CQ) of ${q}_{0}$ such that $[p]$ has an isomorphic copy in $I$. Consequently, we have that $I\vDash {q}_{0}$ for all boolean UCQs ${q}_{0}\in \mathrm{\Lambda}$. From the assumption that $\mathrm{\Lambda}\models q$, we conclude $I\vDash q$ as desired.
Next let us turn to the direction of “if”. Suppose $I\vDash q$ for all instances $I\in \mathcal{U}(O,D)$. Now our task is to prove that $\mathrm{\Lambda}\models q$. Let $J$ be an arbitrary instance such that $J\vDash p$ for all boolean UCQs $p\in \mathrm{\Lambda}$. Take $p$ as any boolean UCQ in $\mathrm{\Lambda}$. W.l.o.g., we write $p$ as the form ${p}_{1}\vee \mathrm{\cdots}\vee {p}_{n}$ where each ${p}_{i}$ is a boolean CQ. Let ${\phi}_{p}\in \{{p}_{1},\mathrm{\dots},{p}_{n}\}$ be any disjunct of $p$ such that $J\vDash {\phi}_{p}$. Such a disjunct always exists because $J\vDash p$. Suppose ${\phi}_{p}$ is of the form $\exists {\overrightarrow{x}}_{p}{\psi}_{p}$, where ${\psi}_{p}$ is a conjunction of atoms and ${\overrightarrow{x}}_{p}$ a tuple of variables. Let ${s}_{p}$ be an assignment such that $J\vDash {\psi}_{p}[{s}_{p}]$. Let $H$ denote the set that consists of $[{\phi}_{p}]$ for each UCQ $p\in \mathrm{\Lambda}$, and let $I$ denote the instance ${\oplus}_{\text{\mathit{a}\mathit{d}\mathit{o}\mathit{m}}(D)}H$. Let $h$ be a mapping that maps the isomorphic copy of $x$ in $I$ to ${s}_{p}(x)$ if $p\in \mathrm{\Lambda}$ and $x\in {\overrightarrow{x}}_{p}$, and maps each constant in $\text{\mathit{a}\mathit{d}\mathit{o}\mathit{m}}(D)$ to itself. Clearly, $h$ is an $\text{\mathit{a}\mathit{d}\mathit{o}\mathit{m}}(D)$homomorphism from $I$ to $J$. By the assumption made in the begin of this paragraph, we know $I\vDash q$. As $q$ is preserved under $\text{\mathit{a}\mathit{d}\mathit{o}\mathit{m}}(D)$homomorphisms, we conclude $J\vDash q$, which completes the proof of the claim. ∎
According to the above claim, to prove the desired proposition, it suffices to show that $(D,q)\in O$ iff $\mathrm{\Lambda}\models q$. The direction of “only if” is trivial since from $(D,q)\in O$ we already have $q\in \mathrm{\Lambda}$. It thus remains to show the converse. Suppose $\mathrm{\Lambda}\models q$. According to the compactness, there is a finite subset ${\mathrm{\Lambda}}_{0}$ of $\mathrm{\Lambda}$ such that ${\mathrm{\Lambda}}_{0}\models q$. Let ${q}_{0}$ denote the conjunction of all UCQs in ${\mathrm{\Lambda}}_{0}$. Obviously, ${q}_{0}$ is also a boolean UCQ. By the definition of $\mathrm{\Lambda}$, we know that for each UCQ $q\in {\mathrm{\Lambda}}_{0}$ we have $(D,q)\in O$. Since $O$ is closed under query conjunctions, we obtain $(D,{q}_{0})\in O$. By ${\mathrm{\Lambda}}_{0}\models q$, it also holds that ${q}_{0}\models q$. Furthermore, by applying the closure property of $O$ under query implications, we conclude $(D,q)\in O$, which completes the proof of the proposition immediately. ∎
With Proposition 8, we are now able to construct a set of DEDs to generate $\mathcal{U}(O,D)$. Several relations are needed to access the encoding of a query. We use $\text{\mathit{U}\mathit{C}\mathit{Q}}(o,a)$ to denote that, under the order $o$, $a$ is the representation (e.g., the Gödel number) of a boolean UCQ, and use $\text{\mathit{U}\mathit{n}\mathit{i}\mathit{o}\mathit{n}}(o,a,b,c)$ to assert that, under the order $o$, the boolean UCQ $a$ is the disjunction of a boolean CQ $b$ and a boolean UCQ $c$. By $\text{\mathit{C}\mathit{Q}}(o,a)$ we mean that $a$ is the encoding of some boolean CQ under the order $o$, and by $\text{\mathit{Q}\mathit{V}\mathit{a}\mathit{r}}(o,a,b)$ we means that $b$ is a variable that occurs in the boolean CQ encoded by $a$ under the order $o$. Moreover, we assume that ${\text{\mathit{Q}}}_{1},\mathrm{\dots},{\text{\mathit{Q}}}_{n}$ enumerates all the relation symbols in $\mathcal{Q}$. For $i=1,\mathrm{\dots},k$, let ${\text{\mathit{H}\mathit{a}\mathit{s}\mathit{Q}}}_{i}(o,a,\overrightarrow{t})$ denote that ${\text{\mathit{Q}}}_{i}(\overrightarrow{t})$ is an atom in the CQ encoded by $a$. It is easy to see that all these relations can be defined by standard arithmetic relations.
Now, we use the following DEDs to nondeterministically choose which disjunct of a boolean UCQ to be true:
$\text{\mathit{A}\mathit{c}\mathit{c}\mathit{e}\mathit{p}\mathit{t}}(v,x)\to \text{\mathit{T}\mathit{r}\mathit{u}\mathit{e}}(v,x)$  (15)  
$\text{\mathit{T}\mathit{r}\mathit{u}\mathit{e}}(v,x)\wedge \text{\mathit{U}\mathit{n}\mathit{i}\mathit{o}\mathit{n}}(v,x,y,z)\to \text{\mathit{T}\mathit{r}\mathit{u}\mathit{e}}(v,y)\vee \text{\mathit{T}\mathit{r}\mathit{u}\mathit{e}}(v,z)$  (16) 
where $\text{\mathit{T}\mathit{r}\mathit{u}\mathit{e}}(o,a)$ states that the boolean CQ encoded by $a$ under the order $o$ is chosen to be true in the intended model.
To generate a copy of a boolean CQ in the intended universal model, we employ the following DEDs:
$\text{\mathit{C}\mathit{Q}}(v,x)\wedge \text{\mathit{Q}\mathit{V}\mathit{a}\mathit{r}}(v,x,y)\to \exists z\text{\mathit{C}\mathit{o}\mathit{p}\mathit{y}}(v,x,y,z)$  (17)  
$\text{\mathit{C}\mathit{Q}}(v,x)\wedge \text{\mathit{A}\mathit{D}}(y)\to \text{\mathit{C}\mathit{o}\mathit{p}\mathit{y}}(v,x,y,y)$  (18)  
$\begin{array}{cc}\hfill \text{\mathit{T}\mathit{r}\mathit{u}\mathit{e}}(v,x)\wedge \text{\mathit{C}\mathit{Q}}(v,x& )\wedge \text{\mathit{H}\mathit{a}\mathit{s}\mathit{Q}}{}_{i}(v,x,\overrightarrow{y})\hfill \\ & \wedge \text{\mathit{C}\mathit{o}\mathit{p}\mathit{y}}(v,x,\overrightarrow{y},\overrightarrow{z})\to {\text{\mathit{Q}}}_{i}(\overrightarrow{z})\hfill \end{array}$  (19) 
where $\text{\mathit{C}\mathit{o}\mathit{p}\mathit{y}}(v,x,\overrightarrow{y},\overrightarrow{z})$ denotes ${\bigwedge}_{1\le j\le k}\text{\mathit{C}\mathit{o}\mathit{p}\mathit{y}}(v,x,{y}_{j},{z}_{j})$ if $\overrightarrow{y}={y}_{1}\mathrm{\cdots}{y}_{k}$, $\overrightarrow{z}={z}_{1}\mathrm{\cdots}{z}_{k}$, and $k$ is the arity of ${\text{\mathit{Q}}}_{i}$. Intuitively, the first rule generates a copy for each variable in the CQ $q$, the second one asserts that the constant in $q$ will not change, and the third one then copy atoms in $q$ into the universal model and implement some necessary substitutions.
Let $lo{c}^{\mathrm{\ell}}(\mathrm{\Sigma})$ denote the set of DEDs that we have defined in this section. From the encoding and Proposition 8 we have
Lemma 9.
${[[lo{c}^{\mathrm{\ell}}(\mathrm{\Sigma})]]}_{\mathcal{D},\mathcal{Q}}^{\mathcal{Q}}={O}_{\mathrm{\Sigma}}$.
Clearly, given the representation of any bound function $\mathrm{\ell}$ and any finite set $\mathrm{\Sigma}$ of DEDs, constructing $lo{c}^{\mathrm{\ell}}(\mathrm{\Sigma})$ is computable. Let ${T}_{\U0001d5a5}$ consist of $lo{c}^{\mathrm{\ell}}(\mathrm{\Sigma})$ for each finite set $\mathrm{\Sigma}$ of DEDs and each bound function $\mathrm{\ell}\in \U0001d5a5$. Since $\U0001d5a5$ is decidable, we know that ${T}_{\U0001d5a5}$ is also decidable. Let ${\mathcal{L}}_{\U0001d5a5}$ be the DEDlanguage induced by ${T}_{\U0001d5a5}$. By Lemmas 9, 5 and 6, ${\mathcal{L}}_{\U0001d5a5}$ must be universal for the family of $\U0001d5a5$local OMQAlanguages.
Concluding Remarks
We have established the nonexistence of universal language for both FOrewritable and PTIMEtractable OMQA. As a rescue, we also proposed a novel property, called the locality, as an approximation to the FOrewritability, and proved that there is some language of DEDs which is universal for OMQA with bounded locality. In spite of the unnaturalness of the constructed language, we believe that the proposed property would shed light on finding natural universal languages, as well as on identifying new tractable languages.