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 $\#\mathcal{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 $β$-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$ 个答案。尽管该问题在组合复杂度意义下通常是 $\#\mathcal{P}$-难的,但许多合取查询具有底层结构,允许在多项式时间预处理后,以数据库大小的多对数时间,按某种字典序对其答案进行直接访问。先前的研究已精确刻画了易处理的查询类,并根据查询结构给出了预处理时间所需的细粒度下界。在本文中,我们将这些易处理性结果推广到带符号合取查询的情形,即可能包含否定原子的合取查询。我们的技术基于一类能够表示关系数据的电路。我们首先证明该类电路在多项式时间预处理后支持可处理的直接访问。然后,我们根据带符号合取查询的结构,给出了表示其答案集所需电路规模的界限。将这两个结果相结合,我们能够证明一大类合取查询的直接访问是可处理的。一方面,在正合取查询的情形下,我们恢复了文献中已知的易处理类。另一方面,我们推广并统一了关于负合取查询(即仅包含否定原子的查询)的已知易处理性结果。具体而言,我们证明了 $β$-无环负合取查询类和有界巢集宽度负合取查询类允许可处理的直接访问。