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.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.References
S. Abiteboul, R. Hull & V. Vianu. (1995). Foundations of Databases. Addison-Wesley.
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.
W. Chen & D.S. Warren. (1993). Query evaluation under the well-founded semantics In ACM Symposium on Principles of Database Systems, pages 168–179.
W.F. Clocksin & C.S. Mellish. (1987). Programming in Prolog, 3rd edition. Springer, Berlin.
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.
J. Freire, T. Swift & D.S. Warren. (1997). Taking i/o seriously: Resolution reconsidered for disk. In International Conference on Logic Programming.
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.
J. Jaffar & M. Maher. (1994). Constraint logic programming: A survey Journal of Logic Programming 19:503–581.
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.
P. Kanellakis, G. Kuper, and P. Revesz. (1995). Constraint Query Languages Journal of Computer and System Sciences 51:26–52.
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.
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.
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.
P. Lim & P. Stuckey. (1990). Meta programming as constraint programming In North American Conference on Logic Programming, pages 416–430.
J. Lloyd. (1987). Foundations of Logic Programming, 2nd edition Springer-Verlag.
M. Maher. (1993). A logic programming view of clp In International Conference on Logic Programming, pages 737–753.
R. Ramakrishnan. (1991). Magic Templates: A Spellbinding Approach to Logic Programs Journal of Logic Programming 11:189–216.
R. Ramakrishnan & D. Srivastava. (1993). Pushing Constraint Selections Journal of Logic Programming 16:361–414.
P. Revesz. (1993). A Closed-Form Evaluation for Datalog Queries with Integer (Gap)-Order Constraints. Theoretical Computer Science 116:117–149.
P.Z. Revesz. (1995). Safe Stratified Datalog with Integer Order Programs In International Conference on Constraint Programming, LCNS 1000, pages 154-169.
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.
D. Srivastava. (1993). Subsumption and Indexing in Constraint Query Languages with Linear Arithmetic Constraints Annals of Mathematics and Artificial Intelligence 8:315–343.
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.
P.J. Stuckey & S. Sudarshan. (1994). Compiling query constraints In ACM Symposium on Principles of Database Systems, pages 56–67.
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.
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.
S. Tamaki & T. Sato. (1986). OLD Resolution with Tabulation In International Conference on Logic Programming, pages 84–98.
D. Toman. (1995). Top-Down Beats Bottom-Up for Constraint Based Extensions of Datalog In International Logic Programming Symposium, pages 189–203.
D. Toman. (1997). Computing the Well-founded Semantics for Constraint Extensions of Datalog: In Constraint Databases and Applications, LNCS 1191, pages 64–79.
D. Toman, J. Chomicki & D. Rogers. (1994). Datalog with Integer Periodicity Constraints In International Logic Programming Symposium, pages 189–203.
J. Ullman. (1989). Principles of Database and Knowledge-Base Systems, volume 2. Computer Science Press.
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.
H. Williams. (1976). Fourier-Motzkin Elimination Extension to Integer Programming Problems Journal of Combinatorial Theory A 21:118–123.
Author information
Authors and Affiliations
Rights 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
Issue Date:
DOI: https://doi.org/10.1023/A:1009799613661