Skip to main content
QUICK REVIEW

[Paper Review] Query Containment for Highly Expressive Datalog Fragments

Pierre Bourhis, Markus Krötzsch|arXiv (Cornell University)|Jun 30, 2014
Advanced Database Systems and QueriesComputer Science14 references6 citations
TL;DR

This paper establishes exact complexity bounds for query containment in highly expressive Datalog fragments, introducing Frontier-Guarded Queries (GQs) as a generalization of Monadically Defined Queries (MQs). It proves that containment is 3ExpTime-complete for general Datalog and 2ExpSpace-complete for linear Datalog, with nesting leading to an exponential hierarchy in complexity, resolving open problems in the field.

ABSTRACT

The containment problem of Datalog queries is well known to be undecidable. There are, however, several Datalog fragments for which containment is known to be decidable, most notably monadic Datalog and several "regular" query languages on graphs. Monadically Defined Queries (MQs) have been introduced recently as a joint generalization of these query languages. In this paper, we study a wide range of Datalog fragments with decidable query containment and determine exact complexity results for this problem. We generalize MQs to (Frontier-)Guarded Queries (GQs), and show that the containment problem is 3ExpTime-complete in either case, even if we allow arbitrary Datalog in the sub-query. If we focus on graph query languages, i.e., fragments of linear Datalog, then this complexity is reduced to 2ExpSpace. We also consider nested queries, which gain further expressivity by using predicates that are defined by inner queries. We show that nesting leads to an exponentially increasing hierarchy for the complexity of query containment, both in the linear and in the general case. Our results settle open problems for (nested) MQs, and they paint a comprehensive picture of the state of the art in Datalog query containment.

Motivation & Objective

  • To determine the exact computational complexity of query containment for highly expressive Datalog fragments where decidability is known.
  • To generalize Monadically Defined Queries (MQs) to Frontier-Guarded Queries (GQs), extending their expressivity while preserving decidability.
  • To resolve open problems regarding the complexity of containment for nested MQs, LinMDlog, and Datalog in GDlog.
  • To analyze the impact of nesting depth and linearity on containment complexity, establishing a hierarchy of exponential complexity levels.
  • To investigate the role of constants in hardness proofs and conjecture that removing constants reduces complexity by one exponential level.

Proposed method

  • The authors introduce Frontier-Guarded Queries (GQs) as a generalization of MQs, ensuring that head variables appear in a single EDB atom in the rule body.
  • They use a 'flag & check' encoding technique inspired by MQs to simulate Turing machine configurations and transitions, enabling reductions to containment problems.
  • Hardness results are established via reductions from alternating Turing machine acceptance problems, encoding configurations and transitions using guarded rules.
  • Upper bounds are derived using automata-theoretic techniques, particularly tree automata for general Datalog and word automata for linear Datalog.
  • The paper analyzes nested query containment by recursively encoding query nesting levels, showing an exponential increase in complexity per nesting level.
  • Complexity bounds are refined by distinguishing between general Datalog, linear Datalog, monadic Datalog, and their guarded or nested variants.

Experimental results

Research questions

  • RQ1What is the exact complexity of query containment for general Datalog fragments that are known to be decidable?
  • RQ2How does extending MQs to GQs affect the complexity of query containment, and does it preserve decidability?
  • RQ3What is the impact of nesting on the complexity hierarchy of query containment in Datalog?
  • RQ4Is the containment problem for Datalog in Guarded Datalog (GDlog) decidable, and what is its exact complexity?
  • RQ5How do constants influence the complexity of containment proofs, and what happens when they are removed?

Key findings

  • Query containment for general Datalog fragments, including GQs and MQs, is 3ExpTime-complete, even when sub-queries are arbitrary Datalog programs.
  • For linear Datalog fragments, containment complexity is reduced to 2ExpSpace, with linear monadic Datalog (LinMDlog) being PSpace-complete.
  • Nesting of queries leads to an exponential hierarchy: containment of LinMQk in LinMQk+1 is hard for (k+1)ExpSpace, and similarly for MQk.
  • The containment problem for Datalog in GDlog is 2ExpTime-complete, resolving an open question.
  • The paper identifies a gap in tight bounds for the case of linear monadic Datalog (LinMDlog), where complexity remains unresolved despite tight bounds for related fragments.
  • Constants play a crucial role in hardness proofs; removing them may reduce complexity by one exponential level, suggesting a conjecture for future work.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.