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$-无环负合取查询类和有界嵌套集宽度负合取查询类允许可处理的直接访问。