Abstract
This paper treats the problem of implementing efficiently queries expressed in a Horn clause based language when recursive predicates, possibly with function symbols, are present. The proposed approach takes the naive fixpoint computation that realizes the minimum model semantics of the given program and transforms it into a computation that terminates and executes efficiently. Rule rewriting scripts, called methods, are used for these transformations; different methods are selected according to the patterns of free and bound variables appearing in the given recursive goal. One method, known as Seminaive Fixpoint, applies to the situation where no argument is bound in the recursive goal. The remaining methods are meant for queries where the initial bindings of the arguments in the recursive goal can be used to improve the efficiency and, often, to guarantee the termination of the computation. The general solution used for these queries consists of implementing the recursive predicate as a cascade of two fixpoint computations. Various methods proposed along these lines are studied and compared, including the magic set method, the counting method and the magic counting method. These methods are implemented as rule rewriting transformations which compile a given program into a safe and efficient implementation.
Part of this work was done while this author was visiting at MCC.
Preview
Unable to display preview. Download preview PDF.
References
Aho A. V. and J. Ullman, “Universality of Data Retrieval Languages,” Proc. POPL Conference, San Antonio Tx, 1979.
Bancilhon, F., “Naive Evaluation of Recursively defined Relations”, On Knowledge Base Management Systems, (M. Brodie and J. Mylopoulos, eds.), Springer-Verlag, 1985.
Balbin, I., K. Ramamohanarao, “A Differential Approach to Query Optimization in Recursive Deductive Databases”, Journal of Logic Programming, to appear.
Beeri, C., P. Kanellakis, F. Bancilhon, R. Ramakrishnan, “Round on the Propagation of Selection into Logic Programs”, Proc. 6th ACM SIGMOD-SIGACT Symp. on Principles of Database Systems, 1987.
Beeri, C. and R. Ramakrishnan, “On the Power of Magic,” Proc. 6th ACM SIGMOD-SIGACT Symp. on Principles of Database Systems, 1987.
Bancilhon, F., D. Maier, Y. Sagiv, J. Ullman, “Magic sets and other strange ways to implement logic programs”, Proc 5th ACM SIGMOD-SIGACT Symp. on Principles of Database Systems, 1986.
Bancilhon, F., and R. Ramakrishnan, “An Amateur's Introduction to Recursive Query Processing Strategies,” Proc. ACM SIGMOD Int. Conference on Management of Data, Washington, D.C., May 1986.
Clark K.L. and Gregrory S., “A relational language for parallel programming,” Proc. ACM Conference on Functional Languages and Computer Architecture, ACM, October, 1981.
Chimenti D. et al., “An Overview of the LDL System,” Database Engineering Bulletin, December 1988.
Chandra, A.K., Harel, D., “Horn clauses and the fixpoint hierarchy”, Proc. ACM SIGMOD-SIGACT Symp. on Principles of Database Systems, 1982, pp. 158–163.
Chang, C.L., “DEDUCE — A deductive query language for relational databases,” in Pattern Recognition and Artificial Intelligence, C.H. Chen (ed.), Academic Press, New York 1976, pp. 108–134.
Demo B., M. Porta and M.L. Sapino, “A Stack Machine Semantics for Rewriting Rule Methods in Logical Databases,” submitted for publication, 1986.
Dwork, P., P. Kanellakis and J., Mitchell, “On the Sequential Nature of Unification”, Journal of Logic Programming, Vol 1, pp. 35–50, 1984.
Gardarin, G. and C. DeMaindreville, ”Evaluation of Database Recursive Programs as Recursive Function Series,” Proc. ACM SIGMOD Int. Conference on Management of Data, Washington, D.C., May 1986.
Gallaire, H.,J. Minker and J.M. Nicolas,”Logic and Databases: a Deductive Approach,” Computer Surveys, Vol. 16, No. 2, 1984.
Henschen, L.J., Naqvi, S. A., ”On compiling queries in recursive first-order databases”, JACM 31, 1, 1984, pp. 47–85.
Kifer, M. and Lozinskii, E.L., ”Filtering Data Flow in Deductive Databases,” ICDT'86, Rome, Sept. 8–10, 1986.
Kellog, C., and Travis, L., ”Reasoning with data in a deductively augmented database system”, in Advances in Logic and Databases, Vol. 1 (Gallaire, H., Minker, J., eds), Plenum, New York, 1981.
Kunifji S., H. Yokota, ”Prolog and Relational Databases for 5th Generation Computer Systems,” in Advances in Logic and Databases, Vol. 2 (Gallaire, Minker and Nicolas eds.), Plenum, New York, 1984.
Li, D. ”A Prolog Database System,” Research Institute Press, Letchworth, Hertfordshire, U.K., 1984
Lloyd, J. W., Foundations of Logic Programming, Springer Verlag, 1984.
Maluszynski, J. and H.J. Komorowski, ”Unification-free Execution of Logic Programs”, Proc. 1985 Symposium on Logic Programming, IEEE, 1985.
Marchetti-Spaccamela, A., Pelaggi, A., Saccà , D., ”Worst-case complexity analysis of methods for logic query implementation”, Proc. 6th ACM SIGMOD-SIGACT Symp. on Principles of Database Systems, 1987.
McKay, D., Shapiro, S., ”Using active connection graphs for reasoning with recursive rules”, Proc. 7th IJCAI, 1981, pp. 368–374.
Naish, L., ”Automating Control for Logic Programs”, the Journal of Logic Programming, 1985.
Nilson, N.J. ”Principles of of Artificial Intelligence”, Tioga Publ. Co., Palo Alto, Calif., 1980.
Parker, S. et al, ”Logic Programming and Databases,”, In Expert Database Systems, L. Kerschberg (ed.), Benjamin/Cummings, 1986.
Reiter, R., ”On closed world databases”, in Logic and Databases (Gallaire, H., Minker, J., eds), Plenum, New York, 1978, pp. 55–76.
Rohmer, J., R. Lescouer and J.M. Kerisit, ”The Alexander Method — A technique for the Processing of Recursive Axioms in Deductive Databases” New Generation Computing, Vol. 4, No. 3, pp. 273–287, 1986.
Smith, D. and Genesereth, M.R. ”ordering Conjunctive Queries”, Artificial Intelligence, 26, 171–215, 1985.
Shapiro, E. and A. Takeuchi, ”Object-Oriented Programming in Concurrent Prolog,”
Saccà , D., Zaniolo, C., ”On the implementation of a simple class of logic queries for databases”, Proc. 5th ACM SIGMOD-SIGACT Symp. on Principles of Database Systems, 1986.
Saccà , D., Zaniolo, C., ”The Generalized Counting Method for Recursive Logic Queries,” JTC, to appear (also Proc. ICDT '86).
Saccà , D., Zaniolo, C., ”Implementation of Recursive Queries for a Data Language based on Pure Horn Logic,” Proc. Fourth Int. Conference on Logic Programming, melbourne, Australia, 1987.
Saccà , D., Zaniolo, C., ”Magic Counting Methods,” ACM SIGMOD Proceedings, 1987.
Tarski, A. ”A Lattice Theoretical Fixpoint Theorem and its Application,” Pacific Journal of Mathematics No. 5, pp. 285–309, 1955.
Tsur, S. and C. Zaniolo, ”LDL: A Logic-Based Data Language,” Proc. of 12th VLDB, Tokyo, Japan, 1986.
Ullman, J.D., Principles of Database Systems, Computer Science Press, Rockville, Md., 1982.
Ullman, J.D., ”Implementation of logical query languages for databases”, TODS 10, 3, 1985, pp. 289–321.
van Emden, M.H., Kowalski, R., ”The semantics of Predicate Logic as a Programming Language”, JACM 23, 4, 1976, pp. 733–742.
Van Gelder, A., ”A Message Passing Framework for Logical Query Evaluation,” Proc. ACM SIGMOD Int. Conference on Management of Data, Washington, D.C., May 1986.
Vieille, L. ”Recursive Axioms in Deductive Databases: the Query-Subquery Approach,” Proc. First Int. Conference on Expert Database Systems, Charleston, S.C., 1986.
Zaniolo, C. ”Prolog: a database query language for all seasons,” in Expert Database Systems, L. Kerschberg (ed.), Benjamin/Cummings, 1986.
Zaniolo, C. ”The Representation and Deductive Retrieval of Complex Objects,” Proc. 11-th VLDB, pp. 459–479, 1985.
Zaniolo, C. ”Safety and Compilation of Non-Recursive Horn Clauses,” Proc. First Int. Conference on Expert Database Systems
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1988 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Zaniolo, C., SaccĂ , D. (1988). Rule rewriting methods for efficient implementations of horn logic. In: Boscarol, M., Carlucci Aiello, L., Levi, G. (eds) Foundations of Logic and Functional Programming. Lecture Notes in Computer Science, vol 306. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-19129-1_5
Download citation
DOI: https://doi.org/10.1007/3-540-19129-1_5
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-19129-2
Online ISBN: 978-3-540-39126-5
eBook Packages: Springer Book Archive