# Acquiring Ontology Axioms through Mappings to Data Sources +
## 3 Mapping-Based Knowledge Bases  
In a traditional OBDA system, the axioms concerning the intensional level of the representation are stated once and for all at design time. This is a reasonable assumption in many cases, for example when the ontology is built from scratch for a specific application. However, there are application domains where, with the goal of achieving a higher level of flexibility, it is convenient to build on-the-fly the KB directly from a set of data sources, through suitable mappings that insist both on extensional information (as usual in OBDA) and _intensional_ information. The result is that _all_ the axioms (not only the ones relative to the extensional level, like in current OBDA systems) of the knowledge base are defined by mappings to such data sources. This is exactly the idea behind the notion of _mapping-based knowledge base_ (MKB), that we define in detail in this section. In what follows, we assume that the data sources are structured as a relational database. We observe that this does not hamper the generality of our work, since existing data federation tools support the designer in wrapping a set of heterogeneous data sources so as to present them as a single relational database. In addition, we assume that the relational data sources store directly the symbols in \(\mathcal{S}\) and in particular the names of elements used in the MKB. In other words, here we ignore the problem of the impedance mismatch between sources that store \"data values\" and the MKB that contains ontology elements [20]. Note, however, that all the results presented in this paper can be extended to the case where the impedance mismatch is dealt with as in [20]. Definition 1: A \(Hi(DL\text{-}Lite_{\mathcal{R}})\) mapping-based knowledge base (MKB) is a pair \(\mathcal{K}=\langle DB,\mathcal{M}\rangle\) such that:  
* DB is a relational database;
* \(\mathcal{M}\) is a mapping, i.e., a set of mapping assertions, each one of the form \(\Phi(\vec{x})\leadsto\psi\), where \(\Phi\) is an arbitrary FOL query over DB of arity \(n\geq 0\) with free variables \(\vec{x}=\langle x_{1},\ldots,x_{n}\rangle\), and \(\psi\) is an \(X\)-atom in \(DL\text{-}Lite_{\mathcal{R}}\), with \(X=\{x_{1},\ldots,x_{n}\}\). Note that when the arity \(n\) of \(\Phi\) is \(0\), then \(\Phi\) is a boolean query and \(\psi\) is a ground atom. In particular, when the \(\Phi\) is the query _true_, then the mapping assertion \(\Phi(\vec{x})\leadsto\psi\) corresponds to the \(\mathit{Hi}(\mathit{DL}\text{-}\mathit{Lite}_{\mathcal{R}})\) assertion constituted by the ground atom \(\psi\). In this way, we can easily specify through \(\mathcal{M}\) also \(\mathit{Hi}(\mathit{DL}\text{-}\mathit{Lite}_{\mathcal{R}})\) assertions that are \"static\", i.e., that do not depend on the current source database instance, and thus we do not need to include a different component in the formalization of an MKB for such static assertions. We now turn to the semantics of a \(\mathit{Hi}(\mathit{DL}\text{-}\mathit{Lite}_{\mathcal{R}})\) MKB \(\mathcal{K}=\langle DB,\mathcal{M}\rangle\). We start by defining when an interpretation satisfies an assertion in \(\mathcal{M}\) with respect to the source data \(DB\). To this end, we make use of the notion of ground instance of an atom and the notion of answer to a query over \(DB\). Let \(\psi\) be an \(X\)-atom with \(X=\{x_{1},\ldots,x_{n}\}\), and let \(\vec{v}\) be a tuple of arity \(n\) with values from \(DB\). Then the ground instance \(\psi[\vec{x}/\vec{v}]\) of \(\psi\) is the formula obtained by substituting every occurrence of \(x_{i}\) with \(v_{i}\) (for \(i\in\{1,..,n\}\)) in \(\psi\). If \(DB\) is a relational database, and \(\Phi\) is a query over \(DB\), we write \(\mathit{ans}(\Phi,DB)\) to denote the set of answers to \(\Phi\) over \(DB\). With this notion at hand, we are ready to present the following definition.