Skip to main content
Log in

Nonrecursive incremental evaluation of Datalog queries

  • Published:
Annals of Mathematics and Artificial Intelligence Aims and scope Submit manuscript

Abstract

We consider the problem of repeatedly evaluating the same (computationally expensive) query to a database that is being updated between successive query requests. In this situation, it should be possible to use the difference between successive database states and the answer to the query in one state to reduce the cost of evaluating the query in the next state. We use nonrecursive Datalog (which are unions of conjunctive queries) to compute the differences, and call this process “incremental query evaluation using conjunctive queries”. After formalizing the notion of incremental query evaluation using conjunctive queries, we give an algorithm that constructs, for each regular chain query (including transitive closure as a special case), a nonrecursive Datalog program to compute the difference between the answer after an update and the answer before the update. We then extend this result to weakly regular queries, which are regular chain programs augmented with conjunctive queries having the so-called Cartesian-closed increment property, and to the case of unbounded-set insertions where the sets are binary Cartesian products. Finally, we show that the class of conjunctive queries with the Cartesian-closed increment property is decidable.

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

Access this article

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

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

Instant access to the full article PDF.

Similar content being viewed by others

Explore related subjects

Discover the latest articles, news and stories from top researchers in related subjects.

References

  1. F. Afrati and S.S. Cosmadakis, Expressiveness of restricted recursive queries,Proc. ACM SIGACT Symp. on the Theory of Computing (1989) pp. 113–126.

  2. K.R. Apt, H.A. Blair and A. Walker, Towards a theory of declarative knowledge, in:Foundations of Deductive Databases and Logic Programming, ed. J. Minker (Morgan Kaufmann, 1988) pp. 89–148.

  3. S. Abiteboul, R. Hull and V. Vianu, Database theory: From A to F, manuscript (1994).

  4. K.R. Apt and J.-M. Pugin, Maintenance of stratified databases viewed as a belief revision system,Proc. 6th ACM Symp. on Principles of Database Systems (1987) pp. 136–145.

  5. A. Aho and J. Ullman, Universality of data retrieval languages,Proc. ACM Symp. on Principles of Programming Languages (1979) pp. 110–120.

  6. F. Bancilhon, Naive evaluation of recursively defined relations, in:On Knowledge Base Management Systems: Integrating Artificial Intelligence and Database Technologies, eds. M.L. Brodie and J. Mylopoulos (Springer, 1985).

  7. V. Breazu-Tannen, P. Buneman and L. Wong, Naturally embedded query languages,Proc. 1992 Int. Conf. on Database Theory, LNCS 646 (Springer, 1992) pp. 140–154.

  8. F. Bancilhon, D. Maier, Y. Sagiv and J.D. Ullman, Magic sets and other strange ways to implement logic programs,Proc. 5th ACM Symp. on Principles of Database Systems (1986) pp. 1–15.

  9. F. Bry, H. Decker and R. Manthey, A uniform approach to constraint satisfaction and constraint satisfiability in deductive databases,Proc. 1st Int. Conf. on Extending Database Technology (1988) pp. 488–505.

  10. A.L. Buchsbaum, P.C. Kanellakis and J.S. Vitter, A data structure for arc insertion and regular path finding,Proc. ACM-SIAM Symp. on Discrete Algorithms (1990).

  11. A. Chandra and P. Merlin, Optimal implementation of conjunctive queries in relational data bases,Proc. ACM SIGACT Symp. on the Theory of Computing (1977) pp. 77–90.

  12. G. Dong, On Datalog linearization of chain queries, in:Theoretical Studies in Computer Science, ed. J.D. Ullman (Academic Press, 1991) pp. 181–206.

  13. G. Dong, Datalog expressiveness of chain queries: Grammar tools and characterizations,Proc. 11th ACM Symp. on Principles of Database Systems (1992) pp. 81–90.

  14. G. Dong and J. Su, First-order on-line computation of transitive closure queries,Proc. 16th Australian Computer Science Conf. (1993) pp. 721–729.

  15. G. Dong and J. Su, First-order incremental evaluation of Datalog queries,Proc. 4th Int. Workshop on Database Programming Languages (1993).

  16. G. Dong and R. Topor, Incremental evaluation of Datalog queries,Proc. Int. Conf. on Database Theory, LNCS 636 (Springer, 1992) pp. 282–296.

  17. A. Gupta, D. Katiyar and I.S. Mumick, Maintaining views incrementally,Proc. ACM SIGMOD Conf., pp. 157–166.

  18. G.G. Hillerbrand, P.C. Kanellakis, H.G. Mairson and M.Y. Vardi, Tools for Datalog boundedness,Proc. 10th ACM Symp. on Principles of Database Systems (1991) pp. 1–12.

  19. G. Hillebrand, P. Kanellakis, H. Mairson and M. Vardi, Undecidable boundedness problems for Datalog programs, Technical Report RJ 8739, IBM Almaden Research Center, San Jose, CA (1992).

    Google Scholar 

  20. T. Ibaraki and N. Katoh, On-line computation of transitive closure of graphs, Inf. Process. Lett. 16(1983)95–97.

    Google Scholar 

  21. G.F. Italiano, Amortized efficiency of a path retrieval data structure, Theor. Comp. Sci. 48(1986)273–281.

    Google Scholar 

  22. Y. Ioannidis, A time bound on the materialization of some recursively defined views,Proc. Int. Conf. on Very Large Data Bases (1985).

  23. D. Jacobs and R. Hull, Database programming with delayed updates,Proc. 3rd Int. Workshop on Database Programming Languages (1991) pp. 416–428.

  24. H. Jakobsson, On materializing views and on-line queries,Proc. Int. Conf. on Database Theory, LNCS 646 (Springer, 1992) pp. 407–420.

  25. V. Küchenhoff, On the efficient computation of the difference between consecutive database states, in:Proc. 2nd Int. Conf. on Deductive Object-Oriented Databases, eds. C. Delobel, M. Kifer and Y. Masunaga, LNCS 566 (Springer, 1991) pp. 478–502.

  26. J. La Poutre and J. van Leeuwen, Maintenance of transitive closures and transitive reductions of graphs, Technical Report RUU-CS-87-25, Department of Computer Science, University of Utrecht, The Netherlands (1987). An extended abstract of this paper appeared in LNCS 314, pp. 106–120.

    Google Scholar 

  27. J.W. Lloyd and J.C. Shepherdson, Partial evaluation logic programming, J. Logic Program. 11(1991)217–242.

    Google Scholar 

  28. J.W. Lloyd, E.A. Sonenberg and R.W. Topor, Integrity constraint checking in stratified databases, J. Logic Program. 4(1987)331–343.

    Google Scholar 

  29. J.-M. Nicolas, Logic for improving integrity checking in relational data bases, Acta Inf. 18(1982)227–253.

    Google Scholar 

  30. X. Qian, On the expressive power of the bounded iteration construct,Proc. 2nd Int. Workshop on Database Programming Languages (1989) pp. 411–421.

  31. J.D. Ullman,Principles of Database and Knowledge-Base Systems, Vols. I and II (Computer Science Press, 1989).

  32. M.H. van Emden and R.A. Kowalski, The semantics of predicate logic as a programming language, J. ACM 23(1976)733–742.

    Google Scholar 

  33. M. Vardi, Decidability and undecidability results for boundedness of linear recursive programs,Proc. ACM Symp. on Principles of Database Systems (1988) pp. 341–351.

  34. O. Wolfson, H.M. Dewan, S.J. Stolfo and Y. Yemini, Incremental evaluation of rules and its relationship to parallelism,Proc. ACM SIGMOD Conf. (1991) pp. 78–87.

Download references

Author information

Authors and Affiliations

Authors

Additional information

Parts of the results in this paper appeared as extended abstracts in theProceedings of the 1992 International Conference on Database Theory (LNCS 646, Springer-Verlag), and in theProceedings of the 1993 International Workshop on Database Programming Languages (Workshops in Computing, Springer-Verlag).

Guozhu Dong gratefully acknowledges support of the Australian Research Council through research grants, and the Centre for Intelligen Decision Systems.

Work by Jianwen Su was supported in part by NSF Grants IRI-9109520 and IRI-9117094.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Dong, G., Su, J. & Topor, R. Nonrecursive incremental evaluation of Datalog queries. Ann Math Artif Intell 14, 187–223 (1995). https://doi.org/10.1007/BF01530820

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01530820

Keywords