Given a conjunctive query $Q$ and a database $\mathbf{D}$, a direct access to the answers of $Q$ over $\mathbf{D}$ is the operation of returning, given an index $j$, the $j^{\mathsf{th}}$ answer for some order on its answers. While this problem is $\#\mathsf{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$ 和一个数据库 $\mathbf{D}$,对 $Q$ 在 $\mathbf{D}$ 上的答案进行直接访问是指:给定索引 $j$,按某种顺序返回第 $j$ 个答案的操作。尽管该问题在结合复杂度下一般属于 $\#\mathsf{P}$-困难,但许多合取查询具有潜在结构,允许在多项式时间预计算后,以数据库大小的多对数时间实现对其答案按某种字典序的直接访问。先前的研究精确刻画了可处理类,并根据查询结构给出了预计算时间所需的细粒度下界。本文将这些可处理性结果推广到带符号的合取查询,即可能包含否定原子的合取查询。我们的技术基于一类可表示关系数据的电路。我们首先证明该类电路支持多项式时间预处理后的可处理直接访问。随后,我们根据带符号合取查询的结构,给出了表示其答案集所需电路大小的界限。两者的结合使我们能够证明一大类合取查询的直接访问可处理性。一方面,我们恢复了文献中已知的正合取查询的可处理类;另一方面,我们推广并统一了关于否定合取查询(即仅含否定原子的查询)的已知可处理性结果。特别地,我们证明了 $\beta$-无环否定合取查询类和有界嵌套集宽度否定合取查询类均支持可处理直接访问。