Definitionadvanced
Certain answers
Also called certain answer semantics.
The tuples that are answers to a query in every possible database consistent with the data and the mapping.
The certain answers of a query over incomplete data are the tuples that are answers in every complete database that the data allows. This page defines them for data exchange, data integration and tables with nulls, where the possible databases come from a mapping or from unknown values. Consistent query answering uses the same "true in all" idea over the repairs of an inconsistent database, and ontology-mediated query answering uses it over the models of an ontology. Here the data is consistent and there is no ontology: the unknowns are the values and the facts that the mapping leaves open.
Definition
Let be a set of complete databases, the possible worlds. For a query of arity , the certain answers are
For a Boolean query, the certain answer is true if is true in every world. Set semantics holds. The set comes from the setting.
- Data exchange. For a schema mapping and a source instance , is the set of solutions for , and is written for the certain answers.
- Data integration. is the set of global databases that agree with the sources under the GAV or LAV mapping.
- Tables with nulls. A table holds constants and labeled nulls . A valuation replaces each null by a constant. Under the closed world assumption, over all valuations. Under the open world assumption, holds each database that contains some .
The answers in contain only constants, since a tuple with a null is not an answer in a world where that null has two different values.
Naive evaluation. Evaluate on an instance with nulls as if each null were a constant different from all others, then drop each tuple that holds a null.
Theorem. Let be a union of conjunctive queries, written as rules . Then the certain answers of are the result of naive evaluation:
- on a table , under the open and under the closed world assumption (Imieliński and Lipski);
- on any universal solution of a data exchange problem (Fagin, Kolaitis, Miller and Popa).
Why. A union of conjunctive queries is preserved by homomorphisms: if is the identity on constants and , then . A universal solution maps into each solution, so each null-free answer on it is an answer in each world. In the other direction, the universal solution with its nulls read as new constants is itself a possible world, so a certain answer is an answer there.
Complexity, in data complexity. For unions of conjunctive queries the certain answers take polynomial time in the settings above, with weakly acyclic target dependencies for data exchange. For some fixed conjunctive queries with inequalities they are coNP-complete under the open world assumption, and for some fixed conjunctive queries over views they are coNP-complete under the closed world assumption (Abiteboul and Duschka). With negation, naive evaluation is no longer correct.
Examples and non-examples
The mapping has and , and . The chase gives the universal solution
| query | naive answers on | certain answers |
|---|---|---|
| , and tuples with nulls | ||
| , , , | ||
| only tuples with nulls |
The last row is the point of certain answers: each flight surely has two legs, but no single leg is known.
Non-example: negation. Let be the Boolean query "no has ". Naive evaluation on says true, since no fact of has two equal values. But is a solution, and there is false. So the certain answer is false, and naive evaluation on a universal solution is wrong for this query.
Non-example: possible answers. The tuple is an answer of the first query on the solution . It is a possible answer, true in some world, but not a certain one.
Non-example: SQL nulls. A table and the query "the with and ( or )". In every world the condition is true, so is a certain answer. SQL gives each comparison with NULL the value unknown, and unknown or unknown is unknown, so SQL returns nothing. See SQL null semantics.
Related definitions
- Possible answers. The union of over all worlds instead of the intersection.
- Consistent answers. The intersection over the repairs of an inconsistent database; see consistent query answering and database repair.
- Ontology-mediated answers. The intersection over the models of a set of data facts and an ontology; see ontology-mediated query answering.
- Answering queries using views. For LAV sources, a maximally contained rewriting of a conjunctive query computes its certain answers; see answering queries using views.
- Closed world semantics for data exchange. Restricting the worlds to those justified by the mapping changes the certain answers of queries with negation.
References
- Tomasz Imieliński and Witold Lipski, Incomplete information in relational databases, Journal of the ACM 31(4), 1984, pages 761-791, tables with nulls and the answers that hold in every represented database
- Ronald Fagin, Phokion G. Kolaitis, Renée J. Miller and Lucian Popa, Data exchange: semantics and query answering, Theoretical Computer Science 336(1), 2005, certain answers in data exchange and naive evaluation on universal solutions
- Serge Abiteboul and Oliver M. Duschka, Complexity of answering queries using materialized views, PODS 1998, pages 254-263, certain answers under the open and the closed world assumption
- Maurizio Lenzerini, Data integration: a theoretical perspective, PODS 2002, pages 233-246, certain answers in data integration
- Marcelo Arenas, Pablo Barceló, Leonid Libkin and Filip Murlak, Foundations of Data Exchange, Cambridge University Press, 2014, Chapter 7, Query answering and rewriting, and Chapter 8, Alternative semantics
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 | W4 complete |
|
Tag ZTKR4H Edit this page History Report an error Markdown