Although current languages used in ontology-based data access (OBDA) systems allow for mapping source data to instances of concepts and relations in the ontology, several application domains need more flexible tools for inferring knowledge from data, which are able to dynamically acquire axioms about new concepts and relations directly from the data. In this paper we introduce the notion of mapping-based knowledge base (MKB) to formalize the situation where both the extensional and the intensional level of the ontology are determined by suitable mappings to a set of data sources. This allows for making the intensional level of the ontology as dynamic as the extensional level traditionally is. To do so, we resort to the meta-modeling capabilities of higher-order description logics, in particular the description logic , which allows seeing concepts and relations as individuals, and vice versa. The challenge in this setting is to design efficient algorithms for answering queries posed to MKBs. Besides the definition of MKBs, our main contribution is to prove that answering instance queries posed to MKBs expressed in can be done efficiently.
ontology-based data access; higher-order description logics; DL-Lite; query answering
Ontology-based data access (OBDA) [1,2] is a paradigm for accessing data using a conceptual representation of the domain of interest expressed as an ontology. An OBDA system relies on a three-level architecture, consisting of the data layer, the ontology, and the mapping between the two. More in detail,
the data layer is constituted by the existing data sources that are relevant for the organization,
the ontology is a declarative and explicit representation of the domain of interest for the organization, formulated in a description logic (DL)  so as to take advantage of various reasoning capabilities in accessing data,
the mapping is a set of declarative assertions specifying how the sources in the data layer relate to the ontology.
Several OBDA projects have been carried out in recent years [4,5,6,7], and various OBDA management systems have been designed to support OBDA applications, e.g., [8,9,10]. In current OBDA systems the ontology is expressed as a DL TBox, i.e., a set of assertions on the relevant concepts and roles (i.e., binary relationships between concepts) of the domain of interest, constituting the intensional level of the representation, and the mapping assertions are used to specify how the data at the sources correspond to the instances of the concepts and the relations, which form the extensional level of the representation. Thus, the mapping assertions, together with the source data, determine the so-called virtual ABox, in the sense that the instance assertions are not explicitly given but are specified through the relationships between the data and the elements of the TBox.
From the above observations it should be clear that current works on OBDA share the idea, originally stemmed in data integration and in data exchange [11,12,13,14], that mappings are used to (virtually) retrieve extensional information of the ontology from the sources, as shown in Figure 1, while the intensional level information, represented by the TBox, remains fixed a priori, once and for all. In this paper, we challenge this preconception and propose to adopt a virtual approach to the specification of the TBox, thus virtualizing both the extensional and the intensional level of the ontology. In other words, we propose a setting where not only the ABox but also the TBox is specified through mappings linking the data to the ontology, as illustrated in Figure 2. Our approach is based on addressing two issues.
The first issue is related to looking at the content of the data sources to identify concepts and roles that are relevant to the domain of interest but that have not been modeled in the TBox, because they were not known at design time. As an example, the database in Figure 3 stores data about different models and different types of cars manufactured by motor companies (table T-CarTypes), as well as various cars of such types (table T-Cars). If we look carefully at the semantics of the data in , we realize that such database not only stores information about the instances of the concepts in the domain of interest (e.g., the first row of table T-Cars collects data about an instance of the concept Car) but contains also pieces of data denoting new concepts of the domain. In particular, table T-CarTypes contains data denoting concepts such as 1973 FALCON XB GT, 1967 MUSTANG SHELBY, 1973 MUSTANG MACH 1, and so on. Considering the context where these concepts appear, it is not difficult to conclude that they are all mutually disjoint subconcepts of Car. Table T-Cars, on the other hand, provides information about the instances of the various concepts, as well as other properties about them (i.e., Color, ProdCountry). We observe that, in order to acquire the knowledge about the concepts mentioned in the data sources, we need a flexible mechanism that is able to map data at the sources to concepts in the ontology. Without such flexibility, the designer would be forced to manually inspect the data sources and enrich the ontology off-line.
The second issue is related to the need of meta-modeling constructs in the language used to specify the ontology [16,17,18,19]. Meta-modeling allows concepts and relations to be conceived as first-order citizens and to see them as individuals that are instances of other concepts, called meta-concepts. By exploiting meta-modeling we might introduce in the ontology the meta-concept Car-Type, with Coupe, Sedan, etc. as its specializations. Note that the instances of such specialized concepts include the subconcepts of cars listed in the rows stored in table T-CarTypes. With this mechanism, the designer is allowed to specify the means for dynamically acquiring TBox axioms, through simple queries asking for the instances of the meta-concept Car-Type. Indeed, without the possibility of using meta-concepts in the ontology, it would be impossible to deal with the first issue mentioned above, that is exactly based on the idea of using mappings in order to transfer the knowledge fragments residing in the data sources to the TBox of the ontology. Note that for the technical development related to meta-modeling, we base our work on the approach and the results reported in .
In this paper, we deal with both the issue of acquiring TBox axioms from data sources and the issue of meta-modeling. In particular, we focus on designing tractable algorithms for query answering in such a setting. Indeed, looking for query answering algorithms that are tractable in data complexity is a distinguishing characteristic of OBDA systems. We follow , and we work with the family of DLs, which enjoys the first-order logic (FOL) rewritability properties. In a DL, enjoying such property answering (unions) of conjunctive queries can be done in two steps. The first one, called rewriting, uses the TBox axioms in order to transform the query q into a new FOL query . The second step evaluates over the ABox seen as a database.
The challenge we face in this paper is to design tractable query answering algorithms even in cases where the mapping assertions map the data at the sources to both the extensional and the intensional level of the ontology and both meta-concepts and meta-relations are used in the queries. In particular, we present the following contributions.
We formalize the notion of mapping-based knowledge base (MKB), that captures the idea of acquiring the axioms of both the extensional and the intensional level of the ontology through mapping assertions linking the source data to the ontology. This mechanism allows the designer to achieve a level of flexibility that is not possible in current OBDA systems. Our formalization relies on the notion of higher-order DL, as introduced in . Indeed, De Giacomo et al.  describe a methodology that, starting from a traditional DL , allows one to define its higher-order version . Here, we apply this idea and make use of the higher-order DL .
We propose to query mapping-based knowledge bases by means of an extension of unions of conjunctive queries (UCQs), taking advantage of the higher-order features of . In particular we define a suitable class of such queries, the so-called instance higher-order UCQs (IHUCQs), enjoying nice computational properties. The basic characteristic of IHUCQs is to allow higher-order features (i.e., meta-concepts and meta-properties) in the query expression but to disregard subclass and subproperty assertions in the body of the query.
We study the problem of answering IHUCQs posed to MKBs expressed in . We show that this problem is efficiently solvable by exhibiting an algorithm based on FOL rewriting. The algorithm works in with respect to the extensional level of the data sources, i.e., the portion of the data sources that is not involved in the intensional level of the ontology. More precisely, our algorithm, given an IHUCQ q over an MKB, reformulates q into a FOL query that is evaluated taking into account only the portion of the MKB involving the extensional level of the ontology. As a consequence, query answering can be delegated to a database management system, exactly as in the traditional OBDA approach.
To sum up, the main achievement of this paper is to prove that we can extend the mapping language used in current OBDA systems so as to talk about concepts and roles as objects (requiring higher-order features), thus realizing the idea of virtualizing both the extensional and the intensional information in a way that is natural and even very effective. Indeed, our result can be interpreted as follows: the complexity of answering higher-order queries posed on knowledge bases built using such extended mappings remains the same as in traditional OBDA settings, when measured only with respect to the extensional level of the data sources.
We observe that initial ideas on generating the intensional level of a representation through mappings was explored in the data exchange setting. In particular, Papotti and Torlone  propose a setting where both data and meta-data stored in relational tables typical of DBMSs, are exchanged. In the context of RDF, the standard language R2RML (https://www.w3.org/TR/r2rml/) for mapping relational databases to RDF datasets, also allows to map patterns in the relational data to assertions (e.g., subsetting) on RDF predicates. In this sense, this is in the same spirit as our proposal, that however is tailored to ontologies and not only to RDF data. In the context of ontologies, this issue is actually new. Indeed, to the best of our knowledge, the only reference dealing with generating TBoxes through mappings is , of which this paper is an extended version. More specifically, with respect to , the reader can find in the present paper additional examples and discussions, a detailed description of our technique for query answering, and complete proofs for all our results. Furthermore, we revised the analysis of combined complexity of query answering over MKBs (Theorem 3).
The rest of this paper is structured as follows. In Section 2 we recall the definition of , the DL adopted in our work. In Section 3 we introduce and discuss the notion of mapping-based knowledge base. In Section 4 we illustrate the kinds of queries that we consider in this paper, and in Section 5 we present our algorithm for query answering. Section 6 concludes the paper.
We start by recalling some notions on DLs in general and in particular. Then, we provide the syntax and the semantics of , i.e., the higher-order version of .
DLs  are logics that represent the domain of interest in terms of concepts, denoting sets of objects, and roles, denoting binary relations between (instances of) concepts. Complex concept and role expressions are constructed starting from a set of atomic concepts and roles and by recursively applying suitable constructs.
A DL knowledge base (KB) is constituted by two components, and , i.e., , where:
, called TBox, is the terminological component of , which contains statements representing intensional knowledge, and
, called ABox, is the assertional component of , which contains assertions representing extensional knowledge.
is a member of the family of tractable DLs [22,23] and is the logical basis of OWL 2 QL, one of the profiles of OWL, the W3C standard for representing ontologies .
expressions are given by the following syntax:
where A is an atomic concept (i.e., a unary predicate from the signature of the knowledge base), B is a basic concept (i.e, an atomic concept A or an existential restriction on a role , which denotes individuals occurring in the first component of the role Q, which is called the domain of Q), C is a general concept (i.e., a basic concept B or its negation ), P is an atomic role (i.e., a binary predicate from the signature of the knowledge base), Q is a basic role (i.e., an atomic role P or its inverse ), and R is a general role (i.e., a basic role Q or its negation ). The domain of (i.e., ) is also called the range of P.
A TBox in is a finite set of assertions in form:
When C and R above assume the form and , respectively, the above inclusions are called negative inclusions and allow us to specify disjointness between concepts or between roles, respectively. Otherwise, the above inclusions are called positive inclusions and allow us to specify is_a relations between concepts or roles, respectively.
An Abox in is a finite set of membership assertions (i.e., facts) of the form:
where a and b are constants, that is, names for individuals (i.e., predicates of arity 0 from the signature of the knowledge base).
We are now ready to describe the higher-order DL . We start by observing that, as discussed in , every traditional DL can be characterized by a set of operators, used to form concept and role expressions and a set of of meta-predicates, used to form assertions. Each operator and each meta-predicate have an associated arity. Given a symbol T, we write to denote that T has arity n. For , we simply have:
provided that and take only a role as argument, takes an individual as first argument and a concept as second argument, takes an individual as first and second argument and a role as third argument, and take two concepts as arguments, and and take two roles as arguments.
Consider the followingknowledge base:
In words, the knowledge base says thatis a concept that specializes the concept,is a role typed onand, which is a concept denoting production countries. More precisely, the domain ofcan be instantiated only with instances of, as stated by the second inclusion, whereas the range ofcan be instantiated only with instances of, as stated by the third inclusion. The above knowledge base can be reformulated in the high-order style syntax foras follows:
We finally note that in both syntaxes given above, the first three assertions constitute the TBox of the KB, whereas the last two assertions constitute the ABox of the KB.
Let us turn our attention to the definition of the syntax of . Hereinafter we assume the existence of two disjoint, countably infinite alphabets: , the set of predicates, also called names and , the set of variables. Intuitively, the names in are the symbols denoting the atomic elements of a knowledge base. The building blocks of such a knowledge base are assertions, which in turn are based on terms and atoms.
We inductively define the set of terms, denoted by , over the alphabets and for as follows:
if then ;
if , and e is not of the form (where is any term), then (Differently from , we avoid the construction of terms of the form which, as roles, are equivalent to e. Under this assumption, we do not have safe-range issues when dealing with queries, thus, differently form , we consider here non-Boolean queries.);
if then .
Intuitively, a term denotes either an atomic element, the inverse of an atomic element, or the projection of an atomic element on either the first or the second component.
If the namesbelong to the alphabet, then the following areterms:,,, which, intuitively, denote the concept representing the set of cars, the role, and the concept representing those individuals (e.g., countries) where something is.
Ground terms, i.e., terms without variables, are called expressions, and the set of expressions is denoted by . The terms in the example above are all expressions.
A -atom, or simply atom, over the alphabets and for is a statement of the form or where , belong to , and . Note that -atoms (and even terms) are not required to respect the proviso we have introduced before to limit the usage of predicates from and so that through them it is possible to express (only) knowledge bases. For instance, a and are both legal -atoms, that is, differently from we can instantiate a concept with another concept. If X is a subset of , a is an atom, and all variables appearing in a belong to X, then a is called an X-atom.
Ground -atoms, i.e., -atoms without variables, are called -assertions, or simply assertions. Thus, an assertion is simply an application of a meta-predicate to a set of expressions, which intuitively means that an assertion is an axiom that predicates over a set of individuals, concepts, or roles.
A KB over is a finite set of -assertions over . To agree with the usual terminology of DLs, we use the term TBox to denote a set of , , and assertions, also called intensional assertions, and the term ABox to denote a set of and assertions, also called extensional assertions. Obviously, a KB is also (a special case of) an KB.
In Figure 4 we provide a graphical representation of aKB modeling (a portion of) the domain of cars that we use throughout the paper in our examples. The ontology is drawn in Graphol, a diagrammatic language that allows OWL ontologies to be graphically specified [25,26]. In Graphol, as in ER diagrams, concepts and roles are denoted by rectangles and diamonds, respectively, and solid directed arrows represent inclusions. The full hexagon denotes at the same time the union of the concepts connected to it through a dashed line and the disjunction of such concepts. Finally, each octagon represents an individual, and each arrow labeled instance Of from and element A to an element B specifies that A is an instance of B. In words, the ontology is saying thatandare specific types of Cars (i.e., they are sub-concepts of), and that they are disjoint. In addition,is an instance of Coupe (in this respect it can also be seen as an individual) and at the same time it is a concept that specializes(i.e., it is a subconcept of) and hasas an instance. Finally,is a subconcept of, andis an instance of.
Below we provide the above ontology through formulas, using the higher order notation given in this section:
Notice how the second assertion exploits the meta-modeling capabilities of, i.e., it treats the concept1973_FALCON_XB_GT_COUPEas an individual instance of the concept Coupe, rather than as a concept (which is instead the way the penultimate assertion refers to it).
The semantics of is based on the notion of interpretation structure. An interpretation structure is a triple where (see Figure 5):
is a non-empty, possibly countably infinite, set;
is a function that maps each into a subset of ; and
is a function that maps each into a subset of .
In other words, treats every element of simultaneously as:
a unary relation, i.e., a concept, through ; and
a binary relation, i.e., a role, through .
An interpretation for (simply called an interpretation, when is clear from the context) over the interpretation structure is a pair , where
is an interpretation structure, and
is a function that maps:
each element of to a single object in ; and
each element to a function that satisfies the conditions characterizing the operator . In particular, the conditions for the operators in are as follows:
for each such that =, we have that =, where is the inverse of the relation , and
for each such that we have that .
We now turn our attention to the interpretation of terms in . To interpret non-ground terms, we need assignments over interpretations, where an assignment over is a function . Given an interpretation and an assignment over , the interpretation of terms is specified by the function defined as follows:
if then ;
if then ;
Finally, we define the semantics of atoms, by defining the notion of satisfaction of an atom with respect to an interpretation and an assignment over as follows:
⊧ if ∈;
A KB is satisfied by if all the assertions in are satisfied by (We do not need to mention assignments here, since all assertions in are ground.). As usual, the interpretations satisfying are called the models of . A KB is satisfiable if it has at least one model.
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 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 . 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 .
A mapping-based knowledge base (MKB) is a pairsuch that:
is a relational database;
is a mapping, i.e., a set of mapping assertions, each one of the form, where Φ is an arbitrary FOL query overof aritywith free variables, and ψ is an X-atom in, with.
Note that when the arity n of is 0, then is a boolean query and is a ground atom. In particular, when the is the query , then the mapping assertion corresponds to the assertion constituted by the ground atom . In this way, we can easily specify through also 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 MKB . We start by defining when an interpretation satisfies an assertion in with respect to the source data . To this end, we make use of the notion of ground instance of an atom and the notion of answer to a query over . Let be an X-atom with , and let be a tuple of arity n with values from . Then the ground instance of is the formula obtained by substituting every occurrence of with (for ) in . If is a relational database, and is a query over , we write to denote the set of answers to over . With this notion at hand, we are ready to present the following definition.
An interpretation satisfies a mapping assertionwith respect to a database, if for every tuple of values, the ground atomis satisfied by. The interpretationis called a model ofif it satisfies every assertion inwith respect to.
We now present an example of MKB, with the goal of illustrating how such a notion can capture real world situations by introducing a notable flexibility in modeling the domain of interest.
Consider the MKB , whereis the database shown in the introduction (cf. Figure 3) andis the following set of mapping assertions:
M1 asserts that for every tuple t of theT-CarTypestable, the value appearing in the second column of t denotes a subconcept of the concept denoted by the value in the third column of the same tuple. Thus, for example, considering the fifth tupleofT-CarTypes, M1 states that 1973 MUSTANG MACH 1 is a subconcept of the concept Ford. M2 asserts that every value appearing in the third column ofT-CarTypesis a subconcept ofCar. For example, by referring toagain, such tuple states that Ford is a subconcept ofCar. Analogously, M3 asserts that every value appearing in the fourth column ofT-CarTypesis a subconcept ofCarType. For example,states that Coupe is a subconcept ofCarType. M4 (resp., M5) asserts that the values appearing in the fifth column (resp., second column) ofT-CarTypesdenote concepts that are pairwise disjoint. M6–M9 assert properties about the relation produced_in, between the concepts Car and ProdCountry . M10 populates the relation produced_in, and M11 does the same for the concept ProdCountry . Mapping M12 exploits the meta-modeling capabilities ofand relates the different car models to their specific type. For example, looking at tupleagain, we can infer by M12 that 1973 FALCON XB GT COUPE is an instance of the concept Coupe. Note that M1 asserted that 1973 FALCON XB GT COUPE is a concept, and therefore, we are taking advantage of the possibility provided byof defining a concept to be an instance of another concept (a metaconcept). Finally, M13 allows us to correctly assign the instances stored in theT-Carstable to the concepts corresponding to the different car models. For example, through this mapping we can infer that the “Mad Max“ police car INTERCEPTOR is an instance of 1973 FALCON XB GT COUPE (see the second tuple ofT-Cars), the famous car ELEANOR of movie “Gone in 60 s“ is an instance of the concept 1973 MUSTANG MACH 1 (third tuple), and the “Supercar“ KITT is an instance of 1982 PONTIAC FIREBIRD (fourth tuple).
We hope that the above example clarifies the potential of MKBs in acquiring ontology axioms in a flexible way. In particular, let us observe how the domain ontology is dynamically built through the mapping, even though no information about the different types of cars and the different models produced by the motor companies was available at design time. Indeed, the mappings in retrieve at run-time both intensional and extensional knowledge from the current database instance. Suppose, for example, that a motor company, say GM, decides to produce cars of new model, say 1967 CADILLAC ELDORADO. Given the structure of the database and its intended usage, the natural thing to do for the organization is to add suitable tuples (e.g., ) in the T-CarTypes table. In our approach, the new information is automatically detected at run-time by the mappings in and correctly introduced in the ontology. So, instead of manually changing the ontology and “re-compiling it” at design time, the new concept is dynamically captured at run-time.
In Figure 6, using the Graphol language, we provide the graphical representation of the ontology dynamically constructed from the database used in the example (In addition to the Graphol constructs already used in Figure 4, in Figure 6 we also use a diamond to denote a role (namely ), and a blank and a full box connected to such role through a dashed line in order to denote its domain and range, respectively. Moreover, the solid double arrowed line denotes a mutual inclusion between concepts (i.e, an equivalence). By using it, we say, for instance, that is equivalent to the domain of , that is, every car is produced somewhere and only cars are produced (somewhere). It is analogous for the range of (cf. mapping assertion M6–M9).).
We also want to add that, although the Example 4 does not show it, our framework allows variables to be used inside operators, in the right-hand side of mapping assertions. This is useful, in particular, to extract knowledge from the database catalog. For example, if FK is the database table storing information about foreign keys between binary tables, and such binary tables correspond to roles in the ontology, the mapping assertion
allows us to transfer the foreign key property at the level of the ontology, by correctly representing every foreign key as an inclusion between the corresponding roles.
In this section we describe the class of queries that we consider in this paper. We start by introducing “query atoms”. Intuitively, a query atom is an atom constituted by a meta-predicate applied to a set of arguments, where each argument is either an expression or a variable. The precise definition relies on the notion of q-terms: a q-term is any element of the set . Thus a q-term is either an expression in or a variable. In other words, we do not allow for non-ground terms in queries, except for variables themselves. We are now ready to define the notion of query atom. A query atom is an atom constituted by the application of a meta-predicate in to a set of q-terms. A query atom is called ground if no variable occurs in it and is called an instance-query atom if its meta-predicate is or . The definition of the syntax of the class of queries that we are interested in is as follows.
A higher-order conjunctive query (HCQ) is an expression of the form
, where q, called the query predicate, is a symbol not in, n is the arity of the query, everyis a (possibly non-ground) query atom, and all variablesbelong toand occur in some. The variablesare called the free variables (or distinguished variables) of the query, while the other variables occurring inare called existential variables. A higher-order union of conjunctive queries (HUCQ) is a set of HCQs of the same arity with the same query predicate.
Notice that an HCQ corresponds to an HUCQ formed by a single query. A HCQ is called Boolean if it has no free variables. It is analogous for an HUCQ.
An HCQ (HUCQ) constituted by instance-query atoms only is called an instance HCQ or IHCQ (IHUCQ).
We now turn our attention to the semantics of queries. Let be an interpretation and an assignment over . A Boolean HCQ q of the form is satisfied in if every query atom is satisfied in .
Given a Boolean HCQ q and a KB (or MKB) , we say that q is logically implied by (denoted by ) if for each model of there exists an assignment such that q is satisfied by .
Given a non-Boolean HCQ q of the form , a grounding substitution of q is a substitution such that are ground terms. We call a grounding tuple.
Given aKBand a non-Boolean HCQ q of the form, The set of certain answers to q in, denoted by, is the set of grounding tuplesthat make the Boolean querylogically implied by.
These notions extend immediately to HUCQs.
We illustrate some examples of HCQs that can be posed to the MKBof Example 4.
Compute the instances ofFordthat were produced in Australia and are of typeCoupe; note that an instance x ofFordof certain type T is an instance of a car model y such that y is an instance of T (this in fact holds for all instances ofCar, not only for instances ofFord). It follows that the correct query expression is as follows:
Compute the pairs of cars, one of type Coupe, and one of type Sedan that were produced in the same country:
Compute all the concepts in the ontology to which a given object (e.g., Eleanor) belongs to:
Compute all the concepts in the ontology whose instances are the concepts to which Eleanor or Kitt belong to:
We observe that all queries in the above example are actually IHCUQs. This is the class of queries that we deal with in the next section.
5. Query Answering
In this section we study how to answer IHUCQs over 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 KBs .
Before delving into the details of our technique, we introduce some useful definitions. In what follows, we refer to a MKB .
We denote by the set of assertions contained in having either or as predicate in their right-hand side.
We denote by the set , that is, the set of assertions contained in having any of , , , as predicate in their right-hand side.
is called an instance-mapping if and are the only predicates that appear in the right-hand side of the mapping assertions in .
We say that e occurs as a concept argument in the atoms (), (), (), (), and ().
We say that e occurs as a role argument in the atoms (), (), (), (), and ().
A atom is an atom of the form or , where N is a name and are either variables or names.
An extended CQ (ECQ) is an expression of the form such that belong to , is a conjunction of atoms, each atom (with ) is either a atom or an instance-query atom (i.e., an atom whose meta-predicate is or ), and each (with ) occurs in at least one . An extended UCQ (EUCQ) is a union of ECQs.
Given a TBox (specified in high-order style syntax, cf. Section 2), we define occurs as a concept argument in occurs as a role argument in , and occurs as a role argument in .
Given a mapping and a database , denotes the KB defined as follows:
where is a tuple of constants and is a tuple of variables having the same arity.
Given an instance-mapping and an ABox , we say that is retrievable through if there exists a database such that .
The query answering technique we are about to present is based on the following four main steps.
In the first step, all intensional assertions are gathered by accessing the sources and using the mapping, in particular the portion. This way, a TBox is available for the subsequent steps.
In the second step, the input query is rewritten on the basis of , using the algorithm presented in . In fact this is not just a trivial call to , since we need to transform the input IHUCQ, which cannot be given directly in input to , into a EUCQ. Similarly, we also need to translate the rewriting produced by in a form that is compatible with the syntax used in the mapping (which is required by the following steps of our algorithm).
In the third step, the query obtained by the second step is unfolded using the mapping, in particular the portion, so as to obtain a query expressed over the alphabet of the source schema.
In the fourth step, the query obtained by the third step is evaluated over the source data, so as to obtain the final result.
In Section 5.1 we deal with the second step of our technique. In particular, we study the problem of computing a perfect rewriting of an IHUCQ over a TBox. We recall that given a query q, a perfect rewriting of q with respect to a TBox is a query such that, for every ABox , . That is, to obtain the certain answers to q in , it is sufficient to evaluate over seen as a database (such an evaluation indeed returns the certain answers to q in ). As said, in our rewriting algorithm we first retrieve a TBox through the mapping (step 1). We thus adapt the above notion to the context of MKBs as follows. Given an MKB , let , a perfect rewriting to q with respect to and the instance-mapping is a query such that, for every ABox retrievable through , .
After the detailed description of the second step above, in the subsequent Section 5.2, we present the complete query answering algorithm for MKBs based on our perfect rewriting technique.
5.1. Query Rewriting
The basic idea of our technique is to reduce the computation of the perfect rewriting of an IHUCQ over a TBox to the computation of the perfect rewriting of an UCQ over a TBox, which can be then done by using the algorithm described in .
To this aim, we first transform the IHUCQ into a standard UCQ, actually an EUCQ. This is realized through a first partial grounding of the query, using the function and then through the functions and . In particular, the function eliminates the meta-variables, i.e., the variables occurring as a concept or as a role argument, from the query, substitutes atoms whose second argument is of the form into atoms (i.e., the instance of the domain or the range of a role expression e is reformulated as an instance of e), and transforms and atoms in DL atoms.
Afterwards, the query resulting from the perfect rewriting of the EUCQ is transformed back into an IHUCQ, by the functions and . This is because the third step of the query answering algorithm assumes the query to be an IHUCQ.
We now describe in more detail the functions , , , and .
If are two IHCQs, and is a TBox, then is a partial metagrounding of q with respect to if , where is a partial substitution of the meta-variables of q with the expressions occurring in such that, for each meta-variable x of q, either or:
if x occurs in a concept position in q, then ;
if x occurs in a role position in q, then .
Given an IHCQ q and a TBox , the function applied to q and computes the set of all partial metagroundings of q with respect to , i.e., it computes the IHUCQ . When applied to an IHUCQ Q and a TBox , the function computes the IHUCQ .
Consider the MKBgiven in Example 4, the TBoxdynamically constructed fromthrough, and represented inFigure 6, and the query (i) given in Example 5. Then,,, and, contains, among other queries, the query:
where we abbreviated1973 FALCON XB GT COUPEintoFALCON(to obtain all other queries insubstituteFALCONwith all elements of).
Notice that the notion of partial metagrounding is crucial for our rewriting method. Indeed, even if in the set of expressions that can be constructed from a finite set of names occurring in the TBox is infinite, we can in fact limit to ground the meta-variables in the query on a finite set of expressions only, as stated by the following lemma.
If Q is an IHUCQ, andis a TBox, then for every ABox,.
Assume . It is easy to prove that . Thus, there exists a tuple t such that . This implies that there exists a model for such that and . Let be the domain of . We define below an interpretation over the same domain . For every :
if there exists such that , otherwise ;
if there exists such that , otherwise .
It is easy to see that is a model for the KB . However, it is also straightforward to verify that if and only if , and since by hypothesis , then as well. As a consequence, , which contradicts the hypothesis that , thus proving the thesis. □
We now turn our attention to the functions and .
Let be an instance atom, returns a new atom defined as follows:
if and has the form where is an expression which is not of the form , then , where _ denotes an existentially quantified variables;
if and has the form where is any expression, then .
The above definition naturally extends to queries. More precisely, let be an IHCQ, computes the IHCQ . Finally, if Q is an IHUCQ, then returns the query . As an example, consider the query
returns the query
Then, let q be an IHCQ and be an instance-mapping, is the IHUCQ Q defined inductively as follows:
if and contains an atom of the form , and either occurs in or (where x is a variable) occurs in , then the query obtained from by replacing with the atom belongs to Q;
if and contains an atom of the form , and either occurs in or (where x is a variable) occurs in , then the query obtained from by replacing with the atom belongs to Q;
if and contains an atom of the form and either occurs in or (where x is a variable) occurs in , then the query obtained from by replacing with the atom belongs to Q.
Finally, let Q be an IHUCQ and let be a mapping, we define as .
We formally introduce below the functions and , which transform IHUCQs into EUCQs and vice versa. Let q be an IHCQ and let be a TBox, is the ECQ obtained from q as follows:
each atom of q of the form , such that , is replaced with the atom ;
each atom of q of the form , such that , is replaced with the atom .
Let us now apply the function τ to the query (1) (which is already normalized), and obtain the query
Then, given an IHUCQ Q, we define .
Let q be an ECQ and be a TBox, then is the IHCQ obtained from q as follows:
each atom of q of the form is replaced with the atom ;
each atom of q of the form is replaced with the atom .
Then, given an IHUCQ Q, we define . An example of application of can be obtained by simply reversing the transformation shown in Example 7.
We can now formally define our algorithm for query rewriting. The algorithm takes as input an IHUCQ, a TBox and an instance-mapping, and returns a new IHUCQ. Given an IHUCQ Q and a TBox , we denote by the EUCQ returned by the query rewriting algorithm for presented in  (Actually, we consider a slight generalization of that algorithm, allowing for the presence of a ternary relation () in the query.).
INPUT: IHUCQ Q, TBox , instance-mapping
To provide an example of a complete execution of the algorithm, let us now continue the rewriting described in Example 6 and in Example 7. Let us focus on thefunction, and apply it to the query (2) (which is contained in the setof CQs).transforms the atoms of the query using TBox inclusions as rewriting rules, from right to left. For example, according to the inclusionFALCON ⊑ Ford, it rewrites the atomin query (2) into the atomFALCON(x)(intuitively, theencodes in the rewriting the knowledge expressed by the ontology saying that to obtain instances ofone has to look also for instances ofFALCON).In this wayproduces the following query and adds it to the set(notice that the atomFALCON(x)was already present in the query, thus the effect of the rewriting in this case is simply dropping the first atom of the query):
A similar reformulation is performed for all atoms whose predicate occurs in the right-hand side of a positive inclusion (provided that its arguments are not bound, as described in ). Among the queries returned bywe consider in the following only query (3), which, as we will see later, will allow us to obtain the answer to the original query (the other queries returned bydo not really contribute to the final answer in our example). Finally,appliesand(which in this case is immaterial) to query (3), thus returning the query
The IHUCQ returned by constitutes a perfect rewriting of the query Q with respect to the TBox and the mapping , as formally stated by the following theorem.
Letbe a TBox, letbe an instance-mapping and let Q be an IHUCQ. Then, for every ABoxthat is a retrievable through,.
The proof follows from Definition 4, from Lemma 1, from the correctness of the algorithm , and from the fact that the functions , , and just perform equivalent transformations of the query. □
5.2. Query Answering
We now provide an algorithm for query answering over MKBs, which makes use of the query rewriting technique presented in the previous subsection. As already said, our idea is to first compute a TBox by evaluating the mapping assertions involving the predicates , , , over the database of the MKB; then, such a TBox is used to compute the perfect rewriting of the input IHUCQ.
To complete query answering, we have to also consider the mapping of the predicates and and reformulate the query thus obtained by replacing the above predicates with the FOL queries occurring in the corresponding mapping assertions (step 3 of our technique). In this way we obtain an FOL query expressed over the database. This second rewriting step, usually called unfolding, can be performed by the algorithm presented in  (Here, we assume that the algorithm takes as input an EUCQ and an instance-mapping. This corresponds to actually considering a straightforward extension of the algorithm presented in  in order to deal with the presence of the ternary predicate .). In the following, given a mapping and a database , we denote by the database constituted by every relation R of such that R occurs in . Furthermore, we define as the database (i.e., is the portion of which is not involved by the mapping ). We are now ready to present our query answering algorithm.
INPUT: IHUCQ Q, MKB
The algorithm starts by retrieving (function ) the TBox from through the mapping . Then, it computes (function ) the perfect rewriting of the query with respect to the retrieved TBox and next computes (function ) the unfolding of such a query with respect to the mapping . Finally, it evaluates (function the query over the database and returns the result of the evaluation.
Let us consider again the MKD system and the query of Example 6. We notice thatandconsists of the mapping assertions M1-M9 and M10-M-13 given in Example 4, respectively, andcoincides with the databasedescribed in Figure 3. Thus, the TBoxreturned bycoincides with the TBox described in Figure 6 (not considering InstanceOf arrows).is as discussed in Example 8. As said, amog all queries inwe consider only query (4). By unfolding it through, we obtain (among other queries) the FOL query
More in detail, we have unfolded the atomusing mapping M13, atomusing mapping M12, and the atomusing mapping M10. Notice also that other queries are produced by the functionapplied to the query (4) and the(e.g., by unfoldingthrough M12). However, the one we showed is sufficient to obtain the answers to the original query. It is indeed easy to see that by evaluating the above query over(see Figure 3), we obtain the answerINTERCEPTOR, and this is the only answer to the query (i) given in Example 5 evaluated over the MKD system.
To prove correctness of the above algorithm, we first state the following property, whose proof immediately follows from the definition of and the definition of model of a MKB.
Letbe aMKB and let. The set of models ofandcoincide.
We also need the following additional property.
Letbe an instance-mapping, and let Q be an IHUCQ. Then, for every database,
The proof follows from Definition 4 and by a natural, slight extension (which we leave to the reader) of the proof of correctness of the algorithm shown in . □
We are now ready to show the correctness of the algorithm .
Let=be aMKB, let Q be an IHUCQ, and let U be the set of tuples returned by. Then,.
The proof immediately follows from Theorem 1 and Lemmas 2 and 3. □
Finally, from the algorithm we are able to derive the following complexity results for query answering over MKBs.
Let=be aMKB, let Q be an IHUCQ and letbe a tuple of expressions. Deciding whetheris inwith respect to the size of, is in PSPACE with respect to the size of, and is NP-complete with respect to the size of.
To decide whether we can execute . Then, membership in with respect to the size of follows from the fact that the only step of the algorithm that depends on is , where is a FOL query and the fact that evaluating an FOL query over a database is in in data complexity. Membership in PSPACE with respect to the size of follows from the fact that evaluating a FOL query is in PSPACE in combined complexity (whereas the other steps of the algorithm are in PTIME with respect to the size of the ). Finally, NP-completeness with respect to the size of follows from Lemma 2, from the fact that computing can obviously be done in constant time with respect to the size of and from the fact that evaluating an IHUCQ over a KB is NP-complete in query complexity. □
In this paper we have investigated the issue of generating both the TBox and the ABox of a DL ontology on the fly from data stored in data sources through asserted mappings. The two main ingredients for obtaining such a degree of flexibility are enriching the mapping language so as to extract from the data sources the knowledge about possible concepts and roles that are relevant to the domain of interest and relying on higher-order description logics which blur the distinction between concepts/roles at the intensional level and individuals at the extensional level.
The approach presented here can be useful in a number of scenarios. Although in this paper we have discussed a single example, we point out that such example can actually be seen as a prototypical instance of so-called product databases, where one needs to model information about types and models of products (akin to the table T-CarTypes in Figure 3), as well as specific data about single products (like table T-Car in Figure 3). In the applications with product databases, for example in the context of e-commerce, when new products become available, they are typically acquired by accessing catalogues, where the above mentioned information about types and models of products is reported. In our framework, such catalogues are simply modelled as data sources with suitable mappings to the ontology (similarly to the mappings from the table T-CarTypes in Example 4), and such mappings are used to dynamically extend the ontology with new classes and relationships between them present in the catalogue.
We believe that the approach described in this paper can be a starting point for several investigations going beyond what we have presented here. For example, we may allow for the coexistence of multiple TBoxes within the same data sources and allow the user to select which TBox to load when querying the system, possibly depending on the query, much in the spirit of . In addition, the user can in principle even compose on the fly the TBox to use when answering a query. Obviously notions such as authorization views and consistency acquire an intriguing flavor in this setting. As for the former notion, the mechanisms described in this paper can be used to hide intensional knowledge for privacy purposes, thus extending the approaches aiming at filtering only extensional knowledge. As for consistency, an interesting idea is to allow for contradicting TBox axioms coming to the data sources to coexist as long as they are not used together when performing query answering. Other promising directions to pursue include handling possible inconsistencies in MKBs, in the spirit of , considering more sophisticated form of mappings, such as the ones in the context of peer-to-peer data integration , conceiving the assertions coming from the mapping as updates on the current knowledge base (in the spirit of ), and exploiting the ideas presented here as a basis for the problem of acquiring knowledge graphs (see ) from existing data sources.
Writing—original draft, F.D.P., G.D.G., D.L., M.L. and R.R.
This work was partly supported by EPSRC (grants M025268 and N023056), by MIUR (PRIN 2017 project “HOPE”), by the European Research Council under the European Unions Horizon 2020 Programme through the ERC Advanced Grant WhiteMec (No. 834228), and by Sapienza Università di Roma (2019 project CQEinOBDM).
Conflicts of Interest
The authors declare no conflict of interest.
Lenzerini, M. Managing Data through the Lens of an Ontology. AI Mag.2018, 39, 65–74. [Google Scholar] [CrossRef]
Xiao, G.; Calvanese, D.; Kontchakov, R.; Lembo, D.; Poggi, A.; Rosati, R.; Zakharyaschev, M. Ontology-Based Data Access: A Survey. In Proceedings of the 27th International Joint Conference on Artificial Intelligence (IJCAI), Stockholm, Sweden, 13–19 July 2018; pp. 5511–5519. [Google Scholar]
Baader, F.; Calvanese, D.; McGuinness, D.; Nardi, D.; Patel-Schneider, P.F. (Eds.) The Description Logic Handbook: Theory, Implementation and Applications, 2nd ed.; Cambridge University Press: Cambridge, UK, 2007. [Google Scholar]
Savo, D.F.; Lembo, D.; Lenzerini, M.; Poggi, A.; Rodríguez-Muro, M.; Romagnoli, V.; Ruzzi, M.; Stella, G. Mastro at Work: Experiences on Ontology-Based Data Access. In Proceedings of the 23rd International Workshop on Description Logic (DL), Waterloo, ON, Canada, 4–7 May 2010; Volume 573, pp. 20–31. [Google Scholar]
Antonioli, N.; Castanò, F.; Coletta, S.; Grossi, S.; Lembo, D.; Lenzerini, M.; Poggi, A.; Virardi, E.; Castracane, P. Ontology-based Data Management for the Italian Public Debt. In Proceedings of the 8th International Conference on Formal Ontology in Information Systems (FOIS), Rio de Janeiro, Brazil, 22–26 September 2014; pp. 372–385. [Google Scholar]
Giese, M.; Soylu, A.; Vega-Gorgojo, G.; Waaler, A.; Haase, P.; Jiménez-Ruiz, E.; Lanti, D.; Rezk, M.; Xiao, G.; Özçep, Ö.L.; et al. Optique: Zooming in on Big Data. IEEE Comput.2015, 48, 60–67. [Google Scholar] [CrossRef]
López, V.; Stephenson, M.; Kotoulas, S.; Tommasi, P. Data Access Linking and Integration with DALI: Building a Safety Net for an Ocean of City Data. In Proceedings of the 14th International Semantic Web Conference (ISWC), Bethlehem, PA, USA, 11–15 October 2015; Lecture Notes in Computer Science. Springer: Basel, Switzerland, 2015; Volume 9367, pp. 186–202. [Google Scholar]
Calvanese, D.; De Giacomo, G.; Lembo, D.; Lenzerini, M.; Poggi, A.; Rodriguez-Muro, M.; Rosati, R.; Ruzzi, M.; Savo, D.F. The Mastro System for Ontology-based Data Access. Semant. Web J.2011, 2, 43–53. [Google Scholar] [CrossRef]
De Giacomo, G.; Lembo, D.; Lenzerini, M.; Poggi, A.; Rosati, R.; Ruzzi, M.; Savo, D.F. MASTRO: A Reasoner for Effective Ontology-Based Data Access. In Proceedings of the 1st International Workshop on OWL Reasoner Evaluation (ORE), Manchester, UK, 1 July 2012; Volume 858. [Google Scholar]
Rodriguez-Muro, M.; Kontchakov, R.; Zakharyaschev, M. Ontology-Based Data Access: Ontop of Databases. In Proceedings of the 12th International Semantic Web Conference (ISWC), Sydney, Australia, 21–25 October 2013; Lecture Notes in Computer Science. Springer: Basel, Switzerland, 2013; Volume 8218, pp. 558–573. [Google Scholar]
Ullman, J.D. Information Integration using Logical Views. Theor. Comput. Sci.2000, 239, 189–210. [Google Scholar] [CrossRef]
Halevy, A.Y. Answering Queries Using Views: A Survey. Very Large Database J.2001, 10, 270–294. [Google Scholar] [CrossRef]
Lenzerini, M. Data Integration: A Theoretical Perspective. In Proceedings of the 21st ACM SIGACT SIGMOD SIGART Symp. on Principles of Database Systems (PODS), Madison, WI, USA, 3–5 June 2002; pp. 233–246. [Google Scholar]
Kolaitis, P.G. Schema Mappings, Data Exchange, and Metadata Management. In Proceedings of the 24th ACM SIGACT SIGMOD SIGART Symp. on Principles of Database Systems (PODS), Baltimore, MD, USA, 13–15 June 2005; pp. 61–75. [Google Scholar]
Di Pinto, F.; De Giacomo, G.; Lenzerini, M.; Rosati, R. Ontology-Based Data Access with Dynamic TBoxes in DL-Lite. In Proceedings of the 26th AAAI Conference on Artificial Intelligence (AAAI), Toronto, ON, Canada, 22–26 July 2012; pp. 719–725. Available online: https://www.aaai.org/ocs/index.php/AAAI/AAAI12/paper/view/5021 (accessed on 10 December 2019).
Chen, W.; Kifer, M.; Warren, D.S. HILOG: A Foundation for Higher-Order Logic Programming. J. Log. Program.1993, 15, 187–230. [Google Scholar] [CrossRef]
Pan, J.Z.; Horrocks, I. OWL FA: A Metamodeling Extension of OWL DL. In Proceedings of the 15th International World Wide Web Conference (WWW), Edinburgh, UK, 23–26 May 2006; pp. 1065–1066. [Google Scholar]
De Giacomo, G.; Lenzerini, M.; Rosati, R. Higher-Order Description Logics for Domain Metamodeling. In Proceedings of the 25th AAAI Conference on Artificial Intelligence (AAAI), San Francisco, CA, USA, 7–11 August 2011. [Google Scholar]
de Carvalho, V.A.; Almeida, J.P.A.; Fonseca, C.M.; Guizzardi, G. Multi-level ontology-based conceptual modeling. Data Knowl. Eng.2017, 109, 3–24. [Google Scholar] [CrossRef]
Poggi, A.; Lembo, D.; Calvanese, D.; De Giacomo, G.; Lenzerini, M.; Rosati, R. Linking Data to Ontologies. J. Data Semant.2008, X, 133–173. [Google Scholar] [CrossRef]
Papotti, P.; Torlone, R. Schema Exchange: Generic Mappings for Transforming Data and Metadata. Data Knowl. Eng.2009, 68, 665–682. [Google Scholar] [CrossRef]
Calvanese, D.; De Giacomo, G.; Lenzerini, M.; Rosati, R.; Vetere, G. DL-Lite: Practical Reasoning for Rich DLs. In Proceedings of the 17th International Workshop on Description Logic (DL), Vienna, Austria, 17–20 July 2004; Volume 104. [Google Scholar]
Calvanese, D.; De Giacomo, G.; Lembo, D.; Lenzerini, M.; Rosati, R. Tractable Reasoning and Efficient Query Answering in Description Logics: The DL-Lite Family. J. Autom. Reason.2007, 39, 385–429. [Google Scholar] [CrossRef]
Motik, B.; Fokoue, A.; Horrocks, I.; Wu, Z.; Lutz, C.; Cuenca Grau, B. OWL Web Ontology Language Profiles. W3C Recommendation, World Wide Web Consortium. 2009. Available online: http://www.w3.org/TR/owl-profiles/ (accessed on 10 December 2019).
Lembo, D.; Pantaleone, D.; Santarelli, V.; Savo, D.F. Easy OWL Drawing with the Graphol Visual Ontology Language. In Proceedings of the 15th International Conference on the Principles of Knowledge Representation and Reasoning (KR), Cape Town, South Africa, 25–29 April 2016; pp. 573–576. [Google Scholar]
Lembo, D.; Pantaleone, D.; Santarelli, V.; Savo, D.F. Drawing OWL 2 ontologies with Eddy the editor. AI Commun.—Eur. J. Artif. Intell.2018, 31, 97–113. [Google Scholar] [CrossRef]
Parsons, J.; Wand, Y. Emancipating Instances from the Tyranny of Classes in Information Modeling. ACM Trans. Database Syst.2000, 25, 228–268. [Google Scholar] [CrossRef]
Lembo, D.; Lenzerini, M.; Rosati, R.; Ruzzi, M.; Savo, D.F. Inconsistency-tolerant query answering in ontology-based data access. J. Web Semant.2015, 33, 3–29. [Google Scholar] [CrossRef]
Calvanese, D.; Damaggio, E.; De Giacomo, G.; Lenzerini, M.; Rosati, R. Semantic Data Integration in P2P Systems. In Proceedings of the International Workshop on Databases, Information Systems and Peer-to-Peer Computing (DBISP2P 2003), Berlin, Germany, 7–8 September 2003. [Google Scholar]
De Giacomo, G.; Lenzerini, M.; Poggi, A.; Rosati, R. On the Update of Description Logic Ontologies at the Instance Level. In Proceedings of the 21st National Conference on Artificial Intelligence (AAAI), Boston, MA, USA, 16–20 July 2006; pp. 1271–1276. [Google Scholar]
Ehrlinger, L.; Wöß, W. Towards a Definition of Knowledge Graphs. In Proceedings of the Posters and Demos Track of the 12th International Conference on Semantic Systems (SEMANTiCS), Leipzig, Germany, 12–15 September 2016. [Google Scholar]
Ontology-Based Data Access (OBDA): virtualizing extensional information.
Ontology-Based Data Access (OBDA): virtualizing extensional information.
OBDA with dynamic TBoxes virtualizing intensional and extensional information.
OBDA with dynamic TBoxes virtualizing intensional and extensional information.