We embark on a study of the consistent answers of queries over databases annotated with values from a naturally ordered positive semiring. In this setting, the consistent answers of a query are defined as the minimum of the semiring values that the query takes over all repairs of an inconsistent database. The main focus is on self-join free conjunctive queries and key constraints, which is the most extensively studied case of consistent query answering over standard databases. We introduce a variant of first-order logic with a limited form of negation, define suitable semiring semantics, and then establish the main result of the paper: the consistent query answers of a self-join free conjunctive query under key constraints are rewritable in this logic if and only if the attack graph of the query contains no cycles. This result generalizes an analogous result of Koutris and Wijsen for ordinary databases, but also yields new results for a multitude of semirings, including the bag semiring, the tropical semiring, and the fuzzy semiring. We also show that there are self-join free conjunctive queries with a cyclic attack graph whose certain answers under bag semantics have no polynomial-time constant-approximation algorithm, unless P = NP.
翻译:我们开始研究在标注有自然序正半环值的数据库上查询的一致答案。在此设定下,查询的一致答案被定义为该查询在所有不一致数据库的修复上所取半环值的最小值。主要关注点在于无自连接合取查询与键约束,这是标准数据库上一致查询回答研究最为广泛的案例。我们引入了一种具有受限否定形式的一阶逻辑变体,定义了合适的半环语义,随后确立了本文的主要结果:在键约束下,无自连接合取查询的一致查询答案在该逻辑中可重写,当且仅当该查询的攻击图不包含环。这一结果推广了Koutris和Wijsen针对普通数据库的类似结论,同时也为多种半环(包括包半环、热带半环和模糊半环)带来了新的发现。我们还证明,存在攻击图含环的无自连接合取查询,其在包语义下的确定答案不存在多项式时间常数近似算法,除非P = NP。