Skip to main content
Log in

Memoing Evaluation for Constraint Extensions of Datalog

  • Published:
Constraints Aims and scope Submit manuscript

Abstract

This paper proposes an efficient method for evaluation of deductive queries over constraint databases. The method is based on a combination of the top-down resolution with memoing and the closed form bottom-up evaluation. In this way the top-down evaluation is guaranteed to terminate for all queries for which the bottom-up evaluation terminates. The main advantage of the proposed method is the direct use of the information present in partially instantiated queries without the need for rewriting of the original program. The evaluation algorithm automatically propagates the necessary constraints during the computation. In addition, the top-down evaluation potentially allows the use of compilation techniques, developed for compilers of logic programming languages, which can make the query evaluation very efficient.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. S. Abiteboul, R. Hull & V. Vianu. (1995). Foundations of Databases. Addison-Wesley.

  2. F. Bancilhon, D. Maier, Y. Sagiv & J. Ullman. (1986). Magic Sets and Other Strange Ways to Implement Logic Programs In ACM Symposium on Principles of Database Systems, pages 1–16.

  3. W. Chen & D.S. Warren. (1993). Query evaluation under the well-founded semantics In ACM Symposium on Principles of Database Systems, pages 168–179.

  4. W.F. Clocksin & C.S. Mellish. (1987). Programming in Prolog, 3rd edition. Springer, Berlin.

  5. J. Freire, T. Swift & D.S. Warren. (1996). Beyond depth-first: Improving tabled logic programs through alternative scheduling strategies In Programming Languages: Implementations, Logics, and Programs, LNCS 1140, pages 234-258.

    Google Scholar 

  6. J. Freire, T. Swift & D.S. Warren. (1997). Taking i/o seriously: Resolution reconsidered for disk. In International Conference on Logic Programming.

  7. H. Gao & D.S. Warren. (1993). A powerful evaluation strategy for CLP programs In PPCP'93: First Workshop on Principles and Practice of Constraint Programming, Providence RI, pages 90-97.

  8. J. Jaffar & M. Maher. (1994). Constraint logic programming: A survey Journal of Logic Programming 19:503–581.

    Google Scholar 

  9. M. Johnson. (1993). Memoization in constraint logic programming In PPCP'93: First Workshop on Principles and Practice of Constraint Programming, Providence, RI, pages 130-138.

  10. P. Kanellakis, G. Kuper, and P. Revesz. (1995). Constraint Query Languages Journal of Computer and System Sciences 51:26–52.

    Google Scholar 

  11. P. Kanellakis, S. Ramaswamy, D. Vengroff & J. Vitter. (1993). Indexing for Data Models with Constraints and Classes In ACM Symposium on Principles of Database Systems, pages 233–243.

  12. D. Kemp, K. Ramamohanarao & Z. Somogyi. (1990). Right-, left-, and multi-linear transformations that maintain context information In International Conference on Very Large Data Bases, pages 380–391.

  13. D.B. Kemp & P.J. Stuckey. (1993). Analysis based constraint query optimization. In D.S. Warren, editor, International Conference on Logic Programming, pages 666–682.

  14. P. Lim & P. Stuckey. (1990). Meta programming as constraint programming In North American Conference on Logic Programming, pages 416–430.

  15. J. Lloyd. (1987). Foundations of Logic Programming, 2nd edition Springer-Verlag.

  16. M. Maher. (1993). A logic programming view of clp In International Conference on Logic Programming, pages 737–753.

  17. R. Ramakrishnan. (1991). Magic Templates: A Spellbinding Approach to Logic Programs Journal of Logic Programming 11:189–216.

    Google Scholar 

  18. R. Ramakrishnan & D. Srivastava. (1993). Pushing Constraint Selections Journal of Logic Programming 16:361–414.

    Google Scholar 

  19. P. Revesz. (1993). A Closed-Form Evaluation for Datalog Queries with Integer (Gap)-Order Constraints. Theoretical Computer Science 116:117–149.

    Google Scholar 

  20. P.Z. Revesz. (1995). Safe Stratified Datalog with Integer Order Programs In International Conference on Constraint Programming, LCNS 1000, pages 154-169.

    Google Scholar 

  21. K.F. Sagonas, T. Swift and D.S. Warren. (1994). XSBas an efficient deductive database engine. In Snodgrass, R. T. and Winslett, M., editors, ACM SIGMOD International Conference on Management of Data, pages 442–453.

  22. D. Srivastava. (1993). Subsumption and Indexing in Constraint Query Languages with Linear Arithmetic Constraints Annals of Mathematics and Artificial Intelligence 8:315–343.

    Google Scholar 

  23. D. Srivastava, R. Ramakrishnan & P. Revesz. (1994). Constraint Objects. In A. Borning, editor, PPCP'94, Second International Workshop on Principles and Practice of Constraint Programming, LNCS 874, pages 181–192.

  24. P.J. Stuckey & S. Sudarshan. (1994). Compiling query constraints In ACM Symposium on Principles of Database Systems, pages 56–67.

  25. T. Swift & D.S. Warren. (1994a). An abstract machine for SLG resolution: definite programs In Logic Programming-Proceedings of the 1994 International Symposium, pages 633–652.

  26. T. Swift & D.S. Warren. (1994b). Analysis of SLG-WAM evaluation of definite programs In Logic Programming-Proceedings of the 1994 International Symposium, pages 219–235.

  27. S. Tamaki & T. Sato. (1986). OLD Resolution with Tabulation In International Conference on Logic Programming, pages 84–98.

  28. D. Toman. (1995). Top-Down Beats Bottom-Up for Constraint Based Extensions of Datalog In International Logic Programming Symposium, pages 189–203.

  29. D. Toman. (1997). Computing the Well-founded Semantics for Constraint Extensions of Datalog: In Constraint Databases and Applications, LNCS 1191, pages 64–79.

    Google Scholar 

  30. D. Toman, J. Chomicki & D. Rogers. (1994). Datalog with Integer Periodicity Constraints In International Logic Programming Symposium, pages 189–203.

  31. J. Ullman. (1989). Principles of Database and Knowledge-Base Systems, volume 2. Computer Science Press.

  32. D.H.D. Warren. (1983). An Abstract PROLOG Instruction Set. Technical Report 309, Artificial Intelligence Center, Computer Science and Technology Division, SRI International, Menlo Park, CA.

    Google Scholar 

  33. H. Williams. (1976). Fourier-Motzkin Elimination Extension to Integer Programming Problems Journal of Combinatorial Theory A 21:118–123.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Toman, D. Memoing Evaluation for Constraint Extensions of Datalog. Constraints 2, 337–359 (1997). https://doi.org/10.1023/A:1009799613661

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1023/A:1009799613661

Navigation