Skip to main content

Rule rewriting methods for efficient implementations of horn logic

  • Part 1: Invited Contributions
  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 306))

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.

This is a preview of subscription content, log in via an institution.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aho A. V. and J. Ullman, “Universality of Data Retrieval Languages,” Proc. POPL Conference, San Antonio Tx, 1979.

    Google Scholar 

  2. Bancilhon, F., “Naive Evaluation of Recursively defined Relations”, On Knowledge Base Management Systems, (M. Brodie and J. Mylopoulos, eds.), Springer-Verlag, 1985.

    Google Scholar 

  3. Balbin, I., K. Ramamohanarao, “A Differential Approach to Query Optimization in Recursive Deductive Databases”, Journal of Logic Programming, to appear.

    Google Scholar 

  4. 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.

    Google Scholar 

  5. Beeri, C. and R. Ramakrishnan, “On the Power of Magic,” Proc. 6th ACM SIGMOD-SIGACT Symp. on Principles of Database Systems, 1987.

    Google Scholar 

  6. 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.

    Google Scholar 

  7. 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.

    Google Scholar 

  8. Clark K.L. and Gregrory S., “A relational language for parallel programming,” Proc. ACM Conference on Functional Languages and Computer Architecture, ACM, October, 1981.

    Google Scholar 

  9. Chimenti D. et al., “An Overview of the LDL System,” Database Engineering Bulletin, December 1988.

    Google Scholar 

  10. 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.

    Google Scholar 

  11. 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.

    Google Scholar 

  12. Demo B., M. Porta and M.L. Sapino, “A Stack Machine Semantics for Rewriting Rule Methods in Logical Databases,” submitted for publication, 1986.

    Google Scholar 

  13. Dwork, P., P. Kanellakis and J., Mitchell, “On the Sequential Nature of Unification”, Journal of Logic Programming, Vol 1, pp. 35–50, 1984.

    Article  Google Scholar 

  14. 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.

    Google Scholar 

  15. Gallaire, H.,J. Minker and J.M. Nicolas,”Logic and Databases: a Deductive Approach,” Computer Surveys, Vol. 16, No. 2, 1984.

    Google Scholar 

  16. Henschen, L.J., Naqvi, S. A., ”On compiling queries in recursive first-order databases”, JACM 31, 1, 1984, pp. 47–85.

    Article  MathSciNet  Google Scholar 

  17. Kifer, M. and Lozinskii, E.L., ”Filtering Data Flow in Deductive Databases,” ICDT'86, Rome, Sept. 8–10, 1986.

    Google Scholar 

  18. 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.

    Google Scholar 

  19. 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.

    Google Scholar 

  20. Li, D. ”A Prolog Database System,” Research Institute Press, Letchworth, Hertfordshire, U.K., 1984

    Google Scholar 

  21. Lloyd, J. W., Foundations of Logic Programming, Springer Verlag, 1984.

    Google Scholar 

  22. Maluszynski, J. and H.J. Komorowski, ”Unification-free Execution of Logic Programs”, Proc. 1985 Symposium on Logic Programming, IEEE, 1985.

    Google Scholar 

  23. 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.

    Google Scholar 

  24. McKay, D., Shapiro, S., ”Using active connection graphs for reasoning with recursive rules”, Proc. 7th IJCAI, 1981, pp. 368–374.

    Google Scholar 

  25. Naish, L., ”Automating Control for Logic Programs”, the Journal of Logic Programming, 1985.

    Google Scholar 

  26. Nilson, N.J. ”Principles of of Artificial Intelligence”, Tioga Publ. Co., Palo Alto, Calif., 1980.

    Google Scholar 

  27. Parker, S. et al, ”Logic Programming and Databases,”, In Expert Database Systems, L. Kerschberg (ed.), Benjamin/Cummings, 1986.

    Google Scholar 

  28. Reiter, R., ”On closed world databases”, in Logic and Databases (Gallaire, H., Minker, J., eds), Plenum, New York, 1978, pp. 55–76.

    Google Scholar 

  29. 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.

    Google Scholar 

  30. Smith, D. and Genesereth, M.R. ”ordering Conjunctive Queries”, Artificial Intelligence, 26, 171–215, 1985.

    Article  Google Scholar 

  31. Shapiro, E. and A. Takeuchi, ”Object-Oriented Programming in Concurrent Prolog,”

    Google Scholar 

  32. 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.

    Google Scholar 

  33. Saccà, D., Zaniolo, C., ”The Generalized Counting Method for Recursive Logic Queries,” JTC, to appear (also Proc. ICDT '86).

    Google Scholar 

  34. 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.

    Google Scholar 

  35. Saccà, D., Zaniolo, C., ”Magic Counting Methods,” ACM SIGMOD Proceedings, 1987.

    Google Scholar 

  36. Tarski, A. ”A Lattice Theoretical Fixpoint Theorem and its Application,” Pacific Journal of Mathematics No. 5, pp. 285–309, 1955.

    Google Scholar 

  37. Tsur, S. and C. Zaniolo, ”LDL: A Logic-Based Data Language,” Proc. of 12th VLDB, Tokyo, Japan, 1986.

    Google Scholar 

  38. Ullman, J.D., Principles of Database Systems, Computer Science Press, Rockville, Md., 1982.

    Google Scholar 

  39. Ullman, J.D., ”Implementation of logical query languages for databases”, TODS 10, 3, 1985, pp. 289–321.

    Article  Google Scholar 

  40. van Emden, M.H., Kowalski, R., ”The semantics of Predicate Logic as a Programming Language”, JACM 23, 4, 1976, pp. 733–742.

    Article  Google Scholar 

  41. 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.

    Google Scholar 

  42. Vieille, L. ”Recursive Axioms in Deductive Databases: the Query-Subquery Approach,” Proc. First Int. Conference on Expert Database Systems, Charleston, S.C., 1986.

    Google Scholar 

  43. Zaniolo, C. ”Prolog: a database query language for all seasons,” in Expert Database Systems, L. Kerschberg (ed.), Benjamin/Cummings, 1986.

    Google Scholar 

  44. Zaniolo, C. ”The Representation and Deductive Retrieval of Complex Objects,” Proc. 11-th VLDB, pp. 459–479, 1985.

    Google Scholar 

  45. Zaniolo, C. ”Safety and Compilation of Non-Recursive Horn Clauses,” Proc. First Int. Conference on Expert Database Systems

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Mauro Boscarol Luigia Carlucci Aiello Giorgio Levi

Rights and permissions

Reprints 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

Publish with us

Policies and ethics