Skip to main content
QUICK REVIEW

[Paper Review] Magic Sets for Disjunctive Datalog Programs

Mario Alviano, Wolfgang Faber|arXiv (Cornell University)|Apr 27, 2012
Logic, Reasoning, and KnowledgeComputer Science88 references10 citations
TL;DR

This paper introduces Dynamic Magic Sets (DMS), a novel optimization technique for disjunctive Datalog programs with stratified negation that enhances query evaluation by dynamically pruning irrelevant program parts during the nondeterministic model search phase. Unlike prior static Magic Set methods limited to grounding, DMS exploits dynamic binding propagation and a formal link to unfounded sets to achieve exponential performance gains, especially in consistent query answering over inconsistent databases.

ABSTRACT

In this paper, a new technique for the optimization of (partially) bound queries over disjunctive Datalog programs with stratified negation is presented. The technique exploits the propagation of query bindings and extends the Magic Set (MS) optimization technique. An important feature of disjunctive Datalog is nonmonotonicity, which calls for nondeterministic implementations, such as backtracking search. A distinguishing characteristic of the new method is that the optimization can be exploited also during the nondeterministic phase. In particular, after some assumptions have been made during the computation, parts of the program may become irrelevant to a query under these assumptions. This allows for dynamic pruning of the search space. In contrast, the effect of the previously defined MS methods for disjunctive Datalog is limited to the deterministic portion of the process. In this way, the potential performance gain by using the proposed method can be exponential, as could be observed empirically. The correctness of MS is established thanks to a strong relationship between MS and unfounded sets that has not been studied in the literature before. This knowledge allows for extending the method also to programs with stratified negation in a natural way. The proposed method has been implemented in DLV and various experiments have been conducted. Experimental results on synthetic data confirm the utility of MS for disjunctive Datalog, and they highlight the computational gain that may be obtained by the new method w.r.t. the previously proposed MS methods for disjunctive Datalog programs. Further experiments on real-world data show the benefits of MS within an application scenario that has received considerable attention in recent years, the problem of answering user queries over possibly inconsistent databases originating from integration of autonomous sources of information.

Motivation & Objective

  • To address the inefficiency of existing Magic Set methods in disjunctive Datalog programs, which only optimize the deterministic grounding phase and ignore the nondeterministic model search phase.
  • To develop a dynamic optimization technique that can prune irrelevant program components during the model generation phase, leveraging query bindings and assumptions made during backtracking.
  • To formally establish correctness of the method using a novel relationship between Magic Sets and unfounded sets, enabling extension to programs with stratified negation.
  • To implement and evaluate the technique in the DLV system, demonstrating its superiority over static Magic Sets in both synthetic and real-world workloads.
  • To validate the method's utility in practical applications, particularly consistent query answering over inconsistent, integrated databases from autonomous sources.

Proposed method

  • The method dynamically generates Magic Set predicates whose definitions are non-deterministic, allowing their extensions to vary across stable models and thus enabling pruning during model search.
  • It simulates a top-down query evaluation by propagating bindings from the query, encoding this simulation into new rules that define the Magic Set predicates.
  • The approach exploits a formal relationship between Magic Sets and unfounded sets, which ensures correctness and allows natural extension to programs with stratified negation.
  • The technique is integrated into the DLV system, leveraging its internal data structures and grounding module for efficient execution.
  • A subsumption check is applied post-transformation to further optimize the resulting program by removing redundant rules.
  • The method supports both bound and partially bound queries, focusing computation on relevant parts of the program instantiation.

Experimental results

Research questions

  • RQ1Can Magic Set optimization be effectively extended to disjunctive Datalog programs with stratified negation to improve performance beyond the grounding phase?
  • RQ2How can dynamic pruning of irrelevant program components be achieved during the nondeterministic model search phase in disjunctive Datalog?
  • RQ3What is the formal relationship between Magic Sets and unfounded sets in disjunctive Datalog, and how can it be leveraged to ensure correctness?
  • RQ4To what extent can the proposed Dynamic Magic Set method outperform existing static Magic Set approaches in terms of runtime and search space reduction?
  • RQ5Can the method be effectively applied and beneficial in real-world scenarios such as consistent query answering over inconsistent, integrated databases?

Key findings

  • The proposed Dynamic Magic Set (DMS) method achieves exponential performance improvements over the previously defined static Magic Set (SMS) method, particularly in the model generation phase.
  • Experiments on synthetic data confirm that DMS significantly reduces the search space during nondeterministic computation, leading to faster query evaluation.
  • In real-world data from a data integration application, DMS enables efficient consistent query answering over inconsistent databases, demonstrating practical utility.
  • The integration of DMS into the DLV system leverages existing internal data structures, enabling efficient and scalable execution without major architectural changes.
  • The method’s correctness is formally proven using a novel connection to unfounded sets, which also allows for natural extension to programs with stratified negation.
  • Subsequent subsumption checks after transformation further improve performance by eliminating redundant rules in the optimized program.

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.