We study the problem of counting answers to unions of conjunctive queries (UCQs) under structural restrictions on the input query. Concretely, given a class C of UCQs, the problem #UCQ(C) provides as input a UCQ Q in C and a database D and the problem is to compute the number of answers of Q in D. Chen and Mengel [PODS'16] have shown that for any recursively enumerable class C, the problem #UCQ(C) is either fixed-parameter tractable or hard for one of the parameterised complexity classes W[1] or #W[1]. However, their tractability criterion is unwieldy in the sense that, given any concrete class C of UCQs, it is not easy to determine how hard it is to count answers to queries in C. Moreover, given a single specific UCQ Q, it is not easy to determine how hard it is to count answers to Q. In this work, we address the question of finding a natural tractability criterion: The combined conjunctive query of a UCQ $\varphi_1 \vee \dots \vee \varphi_\ell$ is the conjunctive query $\varphi_1 \wedge \dots \wedge \varphi_\ell$. We show that under natural closure properties of C, the problem #UCQ(C) is fixed-parameter tractable if and only if the combined conjunctive queries of UCQs in C, and their contracts, have bounded treewidth. A contract of a conjunctive query is an augmented structure, taking into account how the quantified variables are connected to the free variables. If all variables are free, then a conjunctive query is equal to its contract; in this special case the criterion for fixed-parameter tractability of #UCQ(C) thus simplifies to the combined queries having bounded treewidth. Finally, we give evidence that a closure property on C is necessary for obtaining a natural tractability criterion: We show that even for a single UCQ Q, the meta problem of deciding whether #UCQ({Q}) can be solved in time $O(|D|^d)$ is NP-hard for any fixed $d\geq 1$.
翻译:我们研究在输入查询的结构限制下,对合取查询并集(UCQ)进行答案计数的问题。具体而言,给定一类UCQ C,问题#UCQ(C)的输入是C中的一个UCQ Q和一个数据库D,目标在于计算Q在D中的答案数量。Chen和Mengel [PODS'16] 已证明,对于任何递归可枚举类C,问题#UCQ(C)要么是固定参数可处理的,要么对参数化复杂度类W[1]或#W[1]中的一个是困难的。然而,其可处理性准则并不简洁——给定任意具体类C时,难以判断对该类中查询进行答案计数的难度;同样,给定单个具体UCQ Q时,也难以判断对Q进行答案计数的难度。本研究旨在解决寻找自然可处理性准则的问题:一个UCQ $\varphi_1 \vee \dots \vee \varphi_\ell$ 的组合合取查询定义为合取查询 $\varphi_1 \wedge \dots \wedge \varphi_\ell$。我们证明,在C满足自然闭包性质的条件下,问题#UCQ(C)是固定参数可处理的当且仅当C中UCQ的组合合取查询及其收缩(contract)具有有界树宽。合取查询的收缩是一种增强结构,它考虑了量化变量与自由变量的连接方式。若所有变量均为自由变量,则合取查询等于其收缩;在此特例下,#UCQ(C)固定参数可处理性的准则简化为组合查询具有有界树宽。最后,我们给出证据表明,C的闭包性质对于获得自然可处理性准则是必要的:我们证明,即使对于单个UCQ Q,判定问题#UCQ({Q})是否能在时间$O(|D|^d)$内求解的元问题,对任意固定$d\geq 1$而言是NP困难的。