Problemresearch
Ontology-mediated query answering
Also called ontology-based data access, OBDA.
Answer a conjunctive query over data under an ontology, returning the tuples that are answers in every model.
Ontology-mediated query answering asks for the answers of a database query over data that is read through an ontology. The data is an ABox, a set of facts about individuals. The ontology is a TBox that adds background knowledge, for example that every professor teaches something. The query is usually a conjunctive query. Because of the open world assumption, facts that are missing from the data are unknown, not false, so the answers are the certain answers: the tuples that are answers in every model of the TBox and the ABox. The cost depends on the ontology language. In DL-Lite the query can be rewritten into a first-order query over the data alone, so it runs in a database; in EL answering stays polynomial in the data; in ALC it is already coNP-hard in the data.
In plain words
You have a table of facts and a list of rules about what the words mean. Someone asks a question, such as "which people teach a course?". Some people are not listed as teaching anything, but the rules say that every professor teaches some course, so each professor must be in the answer. The answer should contain exactly the people for whom the facts and the rules together force a yes, no matter how the gaps in the facts are filled in. Finding these people is the task. With simple rules the question can be changed into a larger question that the plain table answers. With rich rules you may have to consider many ways to fill the gaps.
Definition
An ontology-mediated query is a pair of a TBox in a description logic and a conjunctive query (CQ)
where each atom is or for a concept name , a role name and terms among the answer variables and the bound variables . A union of conjunctive queries (UCQ) is a finite disjunction of CQs with the same answer variables. An interpretation satisfies if some map from the variables to , with , sends each atom to a true fact of . The bound variables may go to any element, also to elements that are not named in the data.
Input. A TBox , a CQ , an ABox (see TBoxes and ABoxes), and a tuple of individuals of of the length of .
Question. Is a certain answer, that is, does every model of satisfy ?
The set of certain answers is written . If has no model, every tuple is a certain answer, so algorithms first test consistency. A CQ with no answer variables is Boolean.
Complexity is measured in two ways. In data complexity the TBox and the query are fixed, and only and are the input. This is the measure that matters when the data is large and the ontology and query are small. In combined complexity all parts are the input.
Variants
- Instance queries. The query is one atom . This is instance checking, a classical reasoning task of description logics.
- Unions of conjunctive queries. The query is a UCQ. Rewriting algorithms produce UCQs even from a single CQ.
- The ontology language. The problem is studied for DL-Lite, EL and its Horn extensions, ALC and expressive logics such as SHIQ, and for rule languages such as existential rules.
- Ontology-based data access. The data stays in relational sources, and mappings, which are queries over the sources, define the ABox. A query is answered by rewriting it with the TBox and then unfolding it with the mappings into a query over the sources.
- Rewritability questions. Given , decide whether an equivalent first-order query or an equivalent Datalog program exists, and compute it.
Examples
- Anonymous elements. Let and . For , is a certain answer: every model has some -successor of . For there is no certain answer, because the successor need not be a named individual.
- Rewriting. Add to , and let . For , the certain answers are and , though the data has no fact. PerfectRef finds them with a UCQ that includes and .
- Reasoning by cases. Let and . Then is a certain answer of , but not of nor of . No single model of gives exactly the certain answers to all queries, which is why disjunction makes the problem hard.
Known algorithms
- Query rewriting. For DL-Lite, compute from a UCQ with for every consistent , and run it as SQL. PerfectRef does this for DL-Lite. The UCQ can be exponential in . For and , every UCQ rewriting needs all choices of or .
- Datalog rewriting. For Horn logics such as EL, rewrite into a Datalog program and evaluate it with semi-naive evaluation. For instance queries in EL, the completion rules of EL classification, applied to the individuals of the ABox, are such a program.
- Materialization and the chase. For Horn logics the certain answers are the answers over one canonical model, built by the chase of the ABox with the TBox. The canonical model can be infinite, for example with . The combined approach builds a finite part of it that may give some wrong answers, and removes them by a filter or by a rewriting of the query.
- Expressive logics. For ALC and beyond, algorithms reduce the problem to inconsistency tests of the knowledge base extended with the negation of the query, by tableaux, resolution or automata.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| PerfectRef query rewriting | (t n)^O(n) worst | (t n)^O(n) extra | data independentdeterministicexactsaturation | 1 language |
Bounds
| ontology language | query | data complexity | combined complexity |
|---|---|---|---|
| none (plain database) | CQ | in AC0 | NP-complete |
| DL-Lite | UCQ | in AC0 | NP-complete |
| EL | instance query | P-complete | P-complete |
| ALC | instance query | coNP-complete | EXPTIME-complete |
| ALC | CQ | coNP-hard | EXPTIME-complete (Lutz 2008) |
| ALCI | CQ | coNP-hard | 2EXPTIME-complete (Lutz 2008) |
The DL-Lite row is from Calvanese et al. (2007). The coNP upper bound for instance queries in ALC is a case of the result of Hustadt, Motik and Sattler (2005) for SHIQ. The EXPTIME lower bounds for ALC come from the general TBox theorem, and the textbook of Baader, Horrocks, Lutz and Sattler (2017) gives the matching upper bound for instance queries; Lutz (2008) gives the one for CQs. For the lower bound, is satisfiable with respect to if and only if is consistent for a new name , which holds if and only if is not a certain answer of for a new name . Two lower bounds have short proofs.
EL is P-hard in data complexity. Fix . For a set of propositional Horn clauses with at most two body atoms, let the ABox have for each fact , and for each clause the facts , and , with for clauses with one body atom. If is derivable, then follows, by induction on the derivation. In the other direction, the interpretation with the individuals as domain, the ABox edges, the derivable variables and the clauses whose body atoms are derivable is a model of and the ABox. So is a certain answer of if and only if is derivable. Derivability in Horn logic is P-complete (Horn satisfiability), and the ABox is built in logarithmic space. The upper bound holds because an ABox can be written with nominals, and , and subsumption in EL with nominals is polynomial (Baader, Brandt and Lutz 2005).
ALC is coNP-hard in data complexity. Fix and the instance query . For a graph, let the ABox have for each edge and for each vertex , with a new individual . If the graph has a proper 3-coloring, the interpretation with the individuals as domain, each vertex in its color, in , and and empty is a model, so is not a certain answer. If it has none, in any model choose one color among , and for each vertex. Some edge gets the same color at both ends, so , and then . So is a certain answer of if and only if the graph is not 3-colorable, which is coNP-complete.
Reductions
- To consistency. For an instance query, if and only if is inconsistent. In ALC the assertion is allowed; in logics without negation use a new name with .
- From database query evaluation. With the empty TBox the certain answers are the answers over as a database, so CQ evaluation, which is NP-complete in combined complexity by the Chandra-Merlin theorem, is a special case.
- To query containment. A rewriting can be made smaller by deleting each CQ that is contained in another one, which is a query containment test.
- To constraint satisfaction. Bienvenu, ten Cate, Lutz and Wolter (2014) related ontology-mediated queries with ALC TBoxes and UCQs to disjunctive Datalog and to constraint satisfaction problems, which transfers dichotomy results to data complexity.
Applications
- Data access. Users ask queries in the words of a domain ontology, and the system rewrites them into SQL over existing databases through mappings. DL-Lite was designed for this setting.
- Data integration. An ontology gives one view of several sources. Incomplete sources are read under the open world assumption, which is what certain answers express.
- Large ontologies with data. In medicine and life sciences, EL ontologies classify records, and Datalog engines answer instance queries over them.
References
- Diego Calvanese, Giuseppe De Giacomo, Domenico Lembo, Maurizio Lenzerini and Riccardo Rosati, Tractable reasoning and efficient query answering in description logics, the DL-Lite family, Journal of Automated Reasoning 39(3), 2007, pages 385 to 429 (certain answers of conjunctive queries, FO-rewritability, the AC0 data complexity and the NP combined complexity for DL-Lite; general locator)
- Franz Baader, Sebastian Brandt and Carsten Lutz, Pushing the EL envelope, Proceedings of the 19th International Joint Conference on Artificial Intelligence (IJCAI), 2005, pages 364 to 369 (polynomial reasoning in EL with nominals, which covers instance checking over ABoxes)
- Ullrich Hustadt, Boris Motik and Ulrike Sattler, Data complexity of reasoning in very expressive description logics, Proceedings of the 19th International Joint Conference on Artificial Intelligence (IJCAI), 2005, the coNP data complexity of reasoning in SHIQ (general locator)
- Carsten Lutz, The complexity of conjunctive query answering in expressive description logics, Proceedings of the 4th International Joint Conference on Automated Reasoning (IJCAR), LNAI 5195, Springer, 2008, the 2EXPTIME combined complexity of conjunctive query answering in ALCI, and the EXPTIME upper bound for conjunctive queries over ALC (general locator)
- Meghyn Bienvenu, Balder ten Cate, Carsten Lutz and Frank Wolter, Ontology-based data access: a study through disjunctive Datalog, CSP, and MMSNP, ACM Transactions on Database Systems 39(4), 2014, ontology-mediated queries as pairs of an ontology and a query, and their relation to disjunctive Datalog and constraint satisfaction (general locator)
- Franz Baader, Ian Horrocks, Carsten Lutz and Ulrike Sattler, An Introduction to Description Logic, Cambridge University Press, 2017, the chapter on query answering (general locator)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 0999RP Edit this page History Report an error Markdown