Table of Contents
Fetching ...

Direct Access for Conjunctive Queries with Negations

Florent Capelli, Nofar Carmeli, Oliver Irwin, Sylvain Salvati

TL;DR

We address direct access to answers of signed conjunctive queries by extending tractability results from positive queries to the signed setting. Our approach combines two complementary threads: a reduction-based path that leverages results for positive queries, and a circuit-based, factorised representation that enables direct access with polynomial preprocessing and polylogarithmic query-time using a fixed variable-order. Central to our theory are hypergraph width measures, notably the signed hyperorder width and its fractional variant, which capture structural tractability and unify existing positive-case results with new negative-atom cases such as $\beta$-acyclicity and bounded nest-width negatives. We also introduce ordered $\{\times,\mathsf{dec}\}$-circuits and an efficient precomputation scheme for $\mathsf{nrel}_C$ values, enabling direct access in time $\mathcal{O}(\lvert X\rvert^3\log\lvert X\rvert + \lvert X\rvert^2\log\lvert D\rvert)$ after $\mathcal{O}(\lvert X\rvert\log\lvert X\rvert\cdot\lvert C\rvert)$ preprocessing. Together, these results extend the tractability frontier for direct access to CNF-like queries and connect to SAT/counting problems via hypergraph decompositions, with practical impact for query processing and database-inspired reasoning on signed queries.

Abstract

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 $β$-acyclic negative conjunctive queries and the class of bounded nest set width negative conjunctive queries admit tractable direct access.

Direct Access for Conjunctive Queries with Negations

TL;DR

We address direct access to answers of signed conjunctive queries by extending tractability results from positive queries to the signed setting. Our approach combines two complementary threads: a reduction-based path that leverages results for positive queries, and a circuit-based, factorised representation that enables direct access with polynomial preprocessing and polylogarithmic query-time using a fixed variable-order. Central to our theory are hypergraph width measures, notably the signed hyperorder width and its fractional variant, which capture structural tractability and unify existing positive-case results with new negative-atom cases such as -acyclicity and bounded nest-width negatives. We also introduce ordered -circuits and an efficient precomputation scheme for values, enabling direct access in time after preprocessing. Together, these results extend the tractability frontier for direct access to CNF-like queries and connect to SAT/counting problems via hypergraph decompositions, with practical impact for query processing and database-inspired reasoning on signed queries.

Abstract

Given a conjunctive query and a database , a direct access to the answers of over is the operation of returning, given an index , the -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 -acyclic negative conjunctive queries and the class of bounded nest set width negative conjunctive queries admit tractable direct access.
Paper Structure (26 sections, 41 theorems, 17 equations, 10 figures, 4 algorithms)

This paper contains 26 sections, 41 theorems, 17 equations, 10 figures, 4 algorithms.

Key Result

Lemma 2.0

Let $\tau = R[k]$ and $x = \mathsf{min}(\mathsf{var}(R))$. Then $\tau(x) = \mathsf{min}\{d \mid \#\sigma_{x \leqslant d}(R) \geqslant k\}$. Moreover, $\tau = R'[k']$, where $R'=\sigma_{x=d}(R)$ is the subset of $R$ where $x$ is equal to $d$ and $k' = k - \#\sigma_{x < d}(R)$.

Figures (10)

  • Figure 1: Visual representation of \ref{['lem:assignment-of-tau-x']}. The rows represent tuples in increasing order and the columns represent variables. The value on $x$ of the $k^{\mathsf{th}}$ tuple in $R$, depicted by a dashed line, is the smallest value $d \in D$ such that $R$ contains more than $k$ tuples with a value smaller or equal to $d$. For a smaller $d$, we are below the dashed line because there are not enough tuple.
  • Figure 2: Relations between direct access for signed queries and direct access for positive queries
  • Figure 3: Example of a $\{\times, \mathsf{dec}\}$-circuit. The domain used is $\{0, 1, 2\}$ and the variable set is $\{x_1,x_2,x_3,x_4\}$.
  • Figure 4: Example of a $\{\times, \mathsf{dec}\}$-circuit annotated with $\mathsf{nrel}_{C}{}$ values. The domain used is $\{0, 1, 2\}$ for variables $x_1, x_2$ and $x_3$. The lists shown to the left of the decision gates represent the values of $\mathsf{nrel}_{C}$ for those gates. The relation computed by the circuit is given on the right. The full annotation of the circuit needed for direct access is a bit more complicated and is described later in this section.
  • Figure 5: Examples of the paths followed during different direct access tasks on the same annotated ordered $\{\times, \mathsf{dec}\}$-circuit for order $(x_1,x_2,x_3)$.
  • ...and 5 more figures

Theorems & Definitions (82)

  • Lemma 2.0
  • proof
  • Theorem 2.1: grohe2014constraint
  • Example 3.1
  • Lemma 3.2: Subtraction Lemma
  • proof
  • Lemma 3.3
  • proof
  • Lemma 3.4
  • proof
  • ...and 72 more