This Article 
 Bibliographic References 
 Add to: 
Rule Ordering in Bottom-Up Fixpoint Evaluation of Logic Programs
August 1994 (vol. 6 no. 4)
pp. 501-517

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] I. Balbin and K. Ramamohanarao, "A differential approach to query optimization in recursive deductive databases,"J. Logic Programming, vol. 4, no. 2, pp. 259-262, Sept. 1987.
[2] F. Bancilhon, "Naive evaluation of recursively defined relations," inOn Knowledge Based Management Systems--Integrating Data-base and AI Systems, Brodie and Mylopoulos, Eds. New York: Springer-Verlag, 1985.
[3] F. Bancilhon, D. Maier, Y. Sagiv, and J. D. Ullman, "Magic sets and other strange ways to implement logic programs," inProc. 5th ACM Symp. Principles of Database Syst.(Cambridge, MA), Mar. 1986, pp. 1-15.
[4] F. Bancilhon and R. Ramakrishnan, "An amateur's introduction to recursive query processing strategies," inProc. 1986 ACM-SIGMOD Conf. Management of Data(Washington, DC), May 1986, pp. 16-52.
[5] R. Bayer, "Query evaluation and recursion in deductive database systems," unpublished memorandum, 1985.
[6] C. Beeri, S. Naqvi, R. Ramakrishnan, O. Shmueli, and S. Tsur, "Sets and negation in logic database language (LDL1)," inProc. 6th ACM SIGMOD-SIGACT Symp. on Principles of Database Syst. (San Diego, CA), 1987, pp. 21-37.
[7] C. Beeri and R. Ramakrishnan, "On the power of magic," inProc. 6th ACM Symp. Principles of Database Syst.(San Diego, CA), Mar. 1987, pp. 269-283.
[8] C. Beeri, R. Ramakrishnan, D. Srivastava, and S. Sudarshan, "Magic implementation of stratified programs," unpublished manuscript, Sept. 1989.
[9] A. C. Fong and J. Ullman, "Induction variables in very high-level languages," inProc., 3rd ACM Symp. Principles of Programming Languages, 1976, pp. 104-112.
[10] R. Gonzalez-Rubio, J. Rohmer, and A. Bradier, "An overview of DDC: Delta Driven Computer," inParallel Architectures and Languages Europe: Parallel Architectures, vol. 1.Lecture Notes in Computer Science 258, pp. 414-433, 1987.
[11] A. R. Helm, "Detecting and eliminating redundant derivations in deductive database systems." Tech. Rep. RC-14244 (# 63767). IBM Thomas J. Watson Research Center, Yorktown Heights, NY, USA, Dec. 1988.
[12] R. Helm, "Inductive and deductive control of logic programs." inProc. Int. Conf. Logic Programming, 1987, pp. 488-511.
[13] T. Imielinski and S. Naqvi, "Explicit control of logic programs through rule algebra." inProc., ACM Symp. Principles of Database Syst., 1988, pp. 103-116.
[14] G. Kolaitis and C. H. Papadimitriou, "Why not negation by fixpoint?" inProc. 7th ACM Conf. on Principle of Database Syst.(Austin, TX), 1988.
[15] J. Kuittinen, O. Nurmi, S. Sippu, and E. Soisalon-Soininen, "Efficient implementation of loops in bottom-up evaluation of logic queries," inProc. 16th Int. Conf. Very Large Databases, Aug. 1990.
[16] T. S. Leask, K. Ramamohanarao, and P.J. Stuckey, "Exploiting parallelism in bottom-up computation in Aditi" inProc. Post ILPS' 91 Workshop on Deductive Databases, 1991.
[17] H. Lu, "New strategies for computing the transitive closure of a database relation," inProc. VLDB, Brighton, 1987, pp. 267-274.
[18] M. J. Maher and R. Ramakrishnan, "Dèjávu in fixpoints of logic programs," inProc. Symp. Logic Programming, 1990.
[19] R. Paige and J. T. Schwatz, "Reduction in strength of high level operations," inProc. 4th ACM Symp. Principles of Programming Languages, 1977, pp. 58-71.
[20] R. Ramakrishnan, "Magic templates: A spellbinding approach to logic programs, " inProc. Int. Conf. Logic Programming, 1988, pp. 140-159.
[21] R. Ramakrishnan, D. Srivastava, and S. Sudarshan, "Rule ordering in bottom-up fixpoint evaluation of logic programs," Tech. Rep. TR-1059, Comput. Sci. Dept., Univ. of Wisconsin, Madison, 1991.
[22] J. Rohmer, R. Lescoeur, and J.M. Kerisit, "The Alexander Method: A Technique for the Processing of Recursive Axioms in Deductive Databases,"New Generation Computing, Vol. 4, 1986.
[23] H. Schmidt, "Meta-level control for deductive database systems," inLecture Notes in Computer Science 479. New York: Springer-Verlag, 1991.
[24] H. Schmidt, W. Kiessling, U. Güntzer, and R. Bayer, "Compiling exploratory and goal-directed deduction into sloppy delta iteration," inIEEE Int. Symp. Logic Programming, 1987, pp. 234-243.
[25] J. D. Ullman,Database and Knowledge-base Systems. Rockville, MD: Computer Science Press, 1988.
[26] M. H. van Emden and R. A. Kowalski, "The semantics of predicate logic as a programming language,"J. ACM, vol. 23, no. 4, pp. 733- 743, 1976.

Index Terms:
deductive databases; query processing; logic programming; program compilers; bottom-up fixpoint evaluation; logic programs; semantics; GSN; rule ordering; BSN; PSN; base relations; fair orderings; performance results; control expression; cyclic ordering; deductive database; query evaluation
R. Ramakrishnan, D. Srivastava, S. Sudarshan, "Rule Ordering in Bottom-Up Fixpoint Evaluation of Logic Programs," IEEE Transactions on Knowledge and Data Engineering, vol. 6, no. 4, pp. 501-517, Aug. 1994, doi:10.1109/69.298169
Usage of this product signifies your acceptance of the Terms of Use.