Advertisement

Rule rewriting methods for efficient implementations of horn logic

  • Carlo Zaniolo
  • Domenico Saccà
Part 1: Invited Contributions
Part of the Lecture Notes in Computer Science book series (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.

Keywords

Logic Program Counting Method Horn Clause Query Graph Deductive Database 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [AU]
    Aho A. V. and J. Ullman, “Universality of Data Retrieval Languages,” Proc. POPL Conference, San Antonio Tx, 1979.Google Scholar
  2. [Ban]
    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. [BaR]
    Balbin, I., K. Ramamohanarao, “A Differential Approach to Query Optimization in Recursive Deductive Databases”, Journal of Logic Programming, to appear.Google Scholar
  4. [BKBR]
    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. [BeR]
    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. [BMSU]
    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. [BR]
    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. [CG]
    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. [Ceta]
    Chimenti D. et al., “An Overview of the LDL System,” Database Engineering Bulletin, December 1988.Google Scholar
  10. [CH]
    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. [Cha]
    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. [DPS]
    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. [DKM]
    Dwork, P., P. Kanellakis and J., Mitchell, “On the Sequential Nature of Unification”, Journal of Logic Programming, Vol 1, pp. 35–50, 1984.CrossRefGoogle Scholar
  14. [GD]
    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. [GMN]
    Gallaire, H.,J. Minker and J.M. Nicolas,”Logic and Databases: a Deductive Approach,” Computer Surveys, Vol. 16, No. 2, 1984.Google Scholar
  16. [HN]
    Henschen, L.J., Naqvi, S. A., ”On compiling queries in recursive first-order databases”, JACM 31, 1, 1984, pp. 47–85.CrossRefMathSciNetGoogle Scholar
  17. [KL]
    Kifer, M. and Lozinskii, E.L., ”Filtering Data Flow in Deductive Databases,” ICDT'86, Rome, Sept. 8–10, 1986.Google Scholar
  18. [KT]
    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. [KY]
    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]
    Li, D. ”A Prolog Database System,” Research Institute Press, Letchworth, Hertfordshire, U.K., 1984Google Scholar
  21. [Llo]
    Lloyd, J. W., Foundations of Logic Programming, Springer Verlag, 1984.Google Scholar
  22. [MK]
    Maluszynski, J. and H.J. Komorowski, ”Unification-free Execution of Logic Programs”, Proc. 1985 Symposium on Logic Programming, IEEE, 1985.Google Scholar
  23. [MPS]
    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. [MS]
    McKay, D., Shapiro, S., ”Using active connection graphs for reasoning with recursive rules”, Proc. 7th IJCAI, 1981, pp. 368–374.Google Scholar
  25. [Nai]
    Naish, L., ”Automating Control for Logic Programs”, the Journal of Logic Programming, 1985.Google Scholar
  26. [Nil]
    Nilson, N.J. ”Principles of of Artificial Intelligence”, Tioga Publ. Co., Palo Alto, Calif., 1980.Google Scholar
  27. [Par]
    Parker, S. et al, ”Logic Programming and Databases,”, In Expert Database Systems, L. Kerschberg (ed.), Benjamin/Cummings, 1986.Google Scholar
  28. [Rei]
    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. [RLK]
    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. [SG]
    Smith, D. and Genesereth, M.R. ”ordering Conjunctive Queries”, Artificial Intelligence, 26, 171–215, 1985.CrossRefGoogle Scholar
  31. [ST]
    Shapiro, E. and A. Takeuchi, ”Object-Oriented Programming in Concurrent Prolog,”Google Scholar
  32. [SZ1]
    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. [SZ3]
    Saccà, D., Zaniolo, C., ”The Generalized Counting Method for Recursive Logic Queries,” JTC, to appear (also Proc. ICDT '86).Google Scholar
  34. [SZ2]
    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. [SZ4]
    Saccà, D., Zaniolo, C., ”Magic Counting Methods,” ACM SIGMOD Proceedings, 1987.Google Scholar
  36. [Tar]
    Tarski, A. ”A Lattice Theoretical Fixpoint Theorem and its Application,” Pacific Journal of Mathematics No. 5, pp. 285–309, 1955.Google Scholar
  37. [TZ]
    Tsur, S. and C. Zaniolo, ”LDL: A Logic-Based Data Language,” Proc. of 12th VLDB, Tokyo, Japan, 1986.Google Scholar
  38. [U1]
    Ullman, J.D., Principles of Database Systems, Computer Science Press, Rockville, Md., 1982.Google Scholar
  39. [U2]
    Ullman, J.D., ”Implementation of logical query languages for databases”, TODS 10, 3, 1985, pp. 289–321.CrossRefGoogle Scholar
  40. [VK]
    van Emden, M.H., Kowalski, R., ”The semantics of Predicate Logic as a Programming Language”, JACM 23, 4, 1976, pp. 733–742.CrossRefGoogle Scholar
  41. [Vg]
    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. [Vi]
    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. [Z1]
    Zaniolo, C. ”Prolog: a database query language for all seasons,” in Expert Database Systems, L. Kerschberg (ed.), Benjamin/Cummings, 1986.Google Scholar
  44. [Z2]
    Zaniolo, C. ”The Representation and Deductive Retrieval of Complex Objects,” Proc. 11-th VLDB, pp. 459–479, 1985.Google Scholar
  45. [Z3]
    Zaniolo, C. ”Safety and Compilation of Non-Recursive Horn Clauses,” Proc. First Int. Conference on Expert Database Systems Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1988

Authors and Affiliations

  • Carlo Zaniolo
    • 1
  • Domenico Saccà
    • 2
  1. 1.MCCAustinUSA
  2. 2.University of CalabriaRendeItaly

Personalised recommendations