Rule Ordering in Bottom-Up Fixpoint Evaluation of Logic Programs

Logic programs can be evaluated bottom-up by repeatedly applying all rules, in "iterations", until the fixpoint is reached. However, it is often desirable-and, in some cases, e.g. programs with stratified negation, it is even necessary to guarantee the semantics-to apply the rules in some order. We present two algorithms that apply rules in a specified order without repeating inferences. One of them (GSN) is capable of dealing with a wide range of rule orderings, but with a little more overhead than the well-known seminaive algorithm (which we call BSN). The other (PSN) handles a smaller class of rule orderings, but with no overheads beyond those in BSN. We also demonstrate that by choosing a good ordering, we can reduce the number of rule applications (and thus the number of joins). We present a theoretical analysis of rule orderings and identify orderings that minimize the number of rule applications (for all possible instances of the base relations) with respect to a class of orderings called fair orderings. We also show that though nonfair orderings may do a little better on some data sets, they can do much worse on others. The analysis is supplemented by performance results. >

[1]  Eljas Soisalon-Soininen,et al.  Efficient Implementation of Loops in Bottom-Up Evaluation of Logic Queries , 1990, VLDB.

[2]  J. T. Schwartz,et al.  Expression continuity and the formal differentiation of algorithms , 1977, POPL 1977.

[3]  Catriel Beeri,et al.  On the power of magic , 1987, J. Log. Program..

[4]  Hongjun Lu,et al.  New Strategies for Computing the Transitive Closure of a Database Relation , 1987, VLDB.

[5]  Werner Kießling,et al.  Compiling Exploratory and Goal-Directed Deduction into Sloppy Delta-Iteration , 1987, SLP.

[6]  François Bancilhon,et al.  Naive Evaluation of Recursively Defined Relations , 1986, On Knowledge Base Management Systems.

[7]  Kotagiri Ramamohanarao,et al.  Efficient Bottom-UP Computation of Queries on Stratified Databases , 1991, J. Log. Program..

[8]  Rubén González-Rubio,et al.  An Overview of DDC: Delta Driven Computer , 1987, PARLE.

[9]  David Maier,et al.  Magic sets and other strange ways to implement logic programs (extended abstract) , 1985, PODS '86.

[10]  Kotagiri Ramamohanarao,et al.  A Generalization of the Differential Approach to Recursive Query Evaluation , 1987, J. Log. Program..

[11]  Helmut Schmidt Meta-Level Control for Deductive Database Systems , 1991, Lecture Notes in Computer Science.

[12]  Jacob T. Schwartz,et al.  Reduction in Strength of High Level Operations , 1977, POPL.

[13]  Jeffrey D. Uuman Principles of database and knowledge- base systems , 1989 .

[14]  Jeffrey D. Ullman,et al.  Induction variables in very high level languages , 1976, POPL.

[15]  Jeffrey D. Ullman,et al.  Principles Of Database And Knowledge-Base Systems , 1979 .

[16]  Tomasz Imielinski,et al.  Explicit control of logic programs through rule algebra , 1988, PODS '88.

[17]  Raghu Ramakrishnan,et al.  Magic Templates: A Spellbinding Approach To Logic Programs , 1991, J. Log. Program..

[18]  Michael J. Maher,et al.  Déjà Vu in Fixpoints of Logic Programs ∗ , 1989 .

[19]  Jeffrey D. Ullman,et al.  Principles of database and knowledge-base systems, Vol. I , 1988 .

[20]  Richard Helm Inductive and Deductive Control of Logic Programs , 1987, ICLP.

[21]  Robert A. Kowalski,et al.  The Semantics of Predicate Logic as a Programming Language , 1976, JACM.

[22]  Catriel Beeri,et al.  Sets and negation in a logic data base language (LDL1) , 1987, PODS.

[23]  Michael J. Carey,et al.  Performance evaluation of algorithms for transitive closure , 1992, Inf. Syst..

[24]  Christos H. Papadimitriou,et al.  Why not negation by fixpoint? , 1988, PODS '88.