摘要:To expand query types under a set of integrity constraints for obtaining consistent answers over inconsistent databases, a computational theory is proposed based on first-order logic. According to directed join graphs of queries and their join completeness, computational complexities of CQA are PTIME if query types are key-key, nonkey-key, incomplete key-key with acyclic join. This paper presents several algorithms to tackle a large and practical class of queries, which can obtain the rewritten queries for computing consistent answers. For a rewritable initial query, a consistent identification statement is constructed based on the join graph by recursive computation; and the statement combines with the initial query to construct a new first-order rewritten query for computing consistent answers. To acyclic self-join queries, the recursive rewriting algorithm cannot eliminate inconsistent tuples, so the initial query combines with the statement that eliminates them.