# Acquiring Ontology Axioms through Mappings to Data Sources +
## 5 Query Answering  
In this section we study how to answer IHUCQs over \(\mathit{Hi}(\mathit{DL\_Lite}_{\mathcal{R}})\) MKBs. In the following we consider only consistent MKBs, i.e., MKBs that have at least one model. This is indeed not a limitation, considering that consistency of a MKB can be checked through query answering, by means of methods similar to those used for checking consistency of _DL-Lite_ KBs [23]. Before delving into the details of our technique, we introduce some useful definitions. In what follows, we refer to a MKB \(\mathcal{K}=\langle DB,\mathcal{M}\rangle\). * We denote by \(\mathcal{M}_{A}\) the set of assertions contained in \(\mathcal{M}\) having either \(\mathit{Inst}_{C}\) or \(\mathit{Inst}_{R}\) as predicate in their right-hand side. * We denote by \(\mathcal{M}_{T}\) the set \(\mathcal{M}\setminus\mathcal{M}_{A}\), that is, the set of assertions contained in \(\mathcal{M}\) having any of \(\mathit{Isa}_{C}\), \(\mathit{Isa}_{R}\), \(\mathit{Disj}_{C}\), \(\mathit{Disj}_{R}\) as predicate in their right-hand side. * \(\mathcal{M}\) is called an _instance-mapping_ if \(\mathit{Inst}_{C}\) and \(\mathit{Inst}_{R}\) are the only predicates that appear in the right-hand side of the mapping assertions in \(\mathcal{M}\). * We say that \(e\) occurs as a concept argument in the atoms \(\mathit{Inst}_{C}(e,e^{\prime})\), \(\mathit{Isa}_{C}(e,e^{\prime})\), \(\mathit{Isa}_{C}(e^{\prime},e)\), \(\mathit{Disj}_{C}(e,e^{\prime})\), and \(\mathit{Disj}_{C}(e^{\prime},e)\). * We say that \(e\) occurs as a role argument in the atoms \(\mathit{Inst}_{R}(e^{\prime},e^{\prime\prime},e)\), \(\mathit{Isa}_{R}(e,e^{\prime})\), \(\mathit{Isa}_{R}(e^{\prime},e)\), \(\mathit{Disj}_{R}(e,e^{\prime})\), and \(\mathit{Disj}_{R}(e^{\prime},e)\). * A \(DL\) atom is an atom of the form \(N(e)\) or \(N(e_{1},e_{2})\), where \(N\) is a name and \(e,e_{1},e_{2}\) are either variables or names. * An _extended CQ_ (_ECQ_) is an expression of the form \(q(x_{1},\ldots,x_{n})\gets a_{1},\ldots,a_{m}\) such that \(x_{1},\ldots,x_{n}\) belong to \(\mathcal{V}\), \(a_{1},\ldots,a_{m}\) is a conjunction of atoms, each atom \(a_{j}\) (with \(1\leq j\leq m\)) is either a \(DL\) atom or an instance-query atom (i.e., an atom whose meta-predicate is \(\mathit{Inst}_{C}\) or \(\mathit{Inst}_{R}\)), and each \(x_{i}\) (with \(1\leq j\leq n\)) occurs in at least one \(a_{j}\). An extended UCQ (EUCQ) is a union of ECQs. * Given a TBox \(\mathcal{T}\) (specified in high-order style syntax, cf. Section 2), we define \(\mathit{Concepts}(\mathcal{T})=\{e,\mathit{Exists}(e^{\prime}),\mathit{Exists}( \mathit{hvc}(e^{\prime}))\mid e\text{ occurs as a concept argument in }\mathcal{T}\text{ and }e^{\prime}\text{ occurs as a role argument in }\mathcal{T}\}\), and \(\mathit{Roles}(\mathcal{T})=\{e,\mathit{hvc}(e)\mid e\text{ occurs as a role argument in }\mathcal{T}\}\). * Given a mapping \(\mathcal{M}\) and a database \(DB,\mathit{Retrieve}(\mathcal{M},DB)\) denotes the \(\mathit{Hi}(\mathit{DL}\text{-}\mathit{Lite}_{\mathcal{R}})\) KB \(\mathcal{H}\) defined as follows: \[\mathcal{H}=\{\psi(\overline{t})\mid\Phi(\overline{x})\leadsto\psi\in\mathcal{ M}\text{ and }DB\models\Phi(\overline{t})\}\] where \(\overline{t}\) is a tuple of constants and \(\overline{x}\) is a tuple of variables having the same arity. * Given an instance-mapping \(\mathcal{M}\) and an ABox \(\mathcal{A}\), we say that \(\mathcal{A}\) is _retrievable through_\(\mathcal{M}\) if there exists a database \(DB\) such that \(\mathcal{A}=\mathit{Retrieve}(\mathcal{M},DB)\). The query answering technique we are about to present is based on the following four main steps. 1. In the first step, all intensional assertions are gathered by accessing the sources and using the mapping, in particular the \(\mathcal{M}_{T}\) portion. This way, a \(\mathit{DL}\text{-}\mathit{Lite}_{\mathcal{R}}\) TBox \(\mathcal{T}\) is available for the subsequent steps. 2. In the second step, the input query is rewritten on the basis of \(\mathcal{T}\), using the algorithm _PerfectRef_ presented in [23].