Given a conjunctive query $Q$ and a database $D$, a direct access to the answers of $Q$ over $D$ is the operation of returning, given an index $k$, the $k$-th answer for some order on its answers. While this problem is #P-hard in general with respect to combined complexity, many conjunctive queries have an underlying structure that allows for a direct access to their answers for some lexicographical ordering that takes polylogarithmic time in the size of the database after a polynomial time precomputation. Previous work has precisely characterised the tractable classes and given fine-grained lower bounds on the precomputation time needed depending on the structure of the query. In this paper, we generalise these tractability results to the case of signed conjunctive queries, that is, conjunctive queries that may contain negative atoms. Our technique is based on a class of circuits that can represent relational data. We first show that this class supports tractable direct access after a polynomial time preprocessing. We then give bounds on the size of the circuit needed to represent the answer set of signed conjunctive queries depending on their structure. Both results combined together allow us to prove the tractability of direct access for a large class of conjunctive queries. On the one hand, we recover the known tractable classes from the literature in the case of positive conjunctive queries. On the other hand, we generalise and unify known tractability results about negative conjunctive queries -- that is, queries having only negated atoms. In particular, we show that the class of $\beta$-acyclic negative conjunctive queries and the class of bounded nest set width negative conjunctive queries admit tractable direct access.
翻译:给定合取查询 $Q$ 和数据库 $D$,对 $Q$ 在 $D$ 上答案的直接访问操作是指:给定索引 $k$,按照答案的某种顺序返回第 $k$ 个答案。尽管该问题在组合复杂度上通常是 #P-难的,但许多合取查询具有底层结构,使得在多项式时间预处理后,对于其答案的某种字典序,能够以数据库大小的多对数时间进行直接访问。先前的研究已精确刻画了易处理的查询类,并根据查询结构给出了预处理时间所需的细粒度下界。在本文中,我们将这些易处理性结果推广到带符号合取查询的情况,即可能包含否定原子的合取查询。我们的技术基于一类能够表示关系数据的电路。我们首先证明该类电路在多项式时间预处理后支持易处理的直接访问。然后,我们根据带符号合取查询的结构,给出了表示其答案集所需电路规模的界限。将这两个结果相结合,我们能够证明一大类合取查询的直接访问是易处理的。一方面,在正合取查询的情况下,我们恢复了文献中已知的易处理类。另一方面,我们推广并统一了关于负合取查询(即仅包含否定原子的查询)的已知易处理性结果。特别地,我们证明了 $\beta$-无环负合取查询类和有界嵌套集宽度负合取查询类允许易处理的直接访问。