Abstract
The magic set technique is a standard technique for query evaluation in deductive databases, and its variants are also used in modern commercial database systems like DB2. Numerous improvements of the basic technique have been proposed. However, each of these optimizations makes the transformation more complicated, and combining them in a single system is at least difficult.
In this paper, a new transformation is introduced, which is based on partial evaluation of a bottom-up meta-interpreter for SLD-resolution. In spite of its simplicity, this technique gives us a whole bunch of optimizations for free: For instance, it contains a tail recursion optimization, it transforms non-recursive into non-recursive programs, it can pass arbitary conditions on the parameters to called predicates, and it saves the join necessary to get subquery results back into the calling context. In this way, it helps to integrate many of the previous efforts.
The usefulness of these optimizations is illustrated with example programs querying the World Wide Web.
This paper is a completely rewritten and significally extended version of a paper which appeared in the electronic proceedings of the International Workshop on “Advances in Databases and Information Systems”, Moscow, 1996.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
S. Abiteboul, P. Bunemann, D. Suciu (eds.): Data on the Web: From Relations to Semistructured Data and XML. Morgan Kaufmann, 2000.
S. Brass, J. Dix: Semantics of (disjunctive) logic programs based on partial evaluation. The Journal of Logic Programming 40 (1999), 1–46.
C. Beeri, R. Ramakrishnan: On the power of magic. The Journal of Logic Programming 10 (1991), 255–299.
S. Brass: Magic sets vs. SLD-resolution. In J. Eder, L. A. Kalinichenko (eds.), Advances in Databases and Information Systems (ADBIS’95), 185–203, Springer, 1995.
F. Bry: Query evaluation in recursive databases: bottom-up and top-down reconciled. Data & Knowledge Engineering 5 (1990), 289–312.
A. Gupta, I. S. Mumick: Magic-sets transformation in nonrecursive systems. In Proc. of the Eleventh ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS’92), 354–367, 1992.
R. Himmeröder, G. Lausen, B. Ludäscher, C. Schlepphorst: On a declarative semantics for web queries. In Fifth International Conference on Deductive and Object-Oriented Databases (DOOD’97), 1997.
D. B. Kemp, K. Ramamohanarao, Z. Somogyi: Right-, left-and multi-linear rule transformations that maintain context information. In D. McLeod, R. Sacks-Davis, H. Schek (eds.), Proc. Very Large Data Bases, 16th Int. Conf. (VLDB’90), 380–391, Morgan Kaufmann Publishers, 1990.
D. Konopnicki, O. Shmueli: W3QS: A query system for the world-wide web. In U. Dayal, P. M. D. Gray, S. Nishio (eds.), Proc. of the 21st Int. Conf. on Very Large Data Bases, (VLDB’95), 54–65, Morgan Kaufmann, 1995.
I. S. Mumick, S. J. Finkelstein, H. Pirahesh, R. Ramakrishnan: Magic conditions. In Proc. of the Ninth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS’90), 314–330, 1990.
A. O. Mendelzon, G. Mihaila, T. Milo: Querying the world wide web. Journal of Digital Libraries 1 (1997), 68–88.
J. F. Naughton, R. Ramakrishnan, Y. Sagiv, J. D. Ullman: Efficient evaluation of right-, left-, and multi-linear rules. In Proceedings of the 1989 ACM SIGMOD International Conference on Management of Data, 235–242, 1989.
K. A. Ross: Modular acyclicity and tail recursion in logic programs. In Proc. of the Tenth ACM SIGACT-SIGMOD-SIGART Symp. on Princ. of Database Systems (PODS’91), 92–101, 1991.
R. Ramakrishnan, S. Sudarshan: Top-down vs. bottom-up revisited. In V. Saraswat, K. Ueda (eds.), Proc. of the 1991 Int. Symposium on Logic Programming, 321–336, MIT Press, 1991.
R. Ramakrishnan, D. Srivastava, S. Sudarshan, P. Seshadri: The CORAL deductive system. The VLDB Journal 3 (1994), 161–210.
D. Srivastava, R. Ramakrishnan: Pushing constraint selections. In Proc. of the Eleventh ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS’92), 301–315, 1992.
S. Sudarshan, R. Ramakrishnan: Optimizations of bottom-up evaluation with non-ground terms. In D. Miller (ed.), Proceedings of the International Logic Programming Symposium (ILPS’93), 557–574, MIT Press, 1993.
K. Sagonas, T. Swift, D. S. Warren: XSB as an efficient deductive database engine. In R. T. Snodgrass, M. Winslett (eds.), Proc. of the 1994 ACM SIGMOD Int. Conf. on Management of Data (SIGMOD’94), 442–453, 1994.
J. D. Ullman: Bottom-up beats top-down for Datalog. In Proc. of the Eighth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS’89), 140–149, 1989.
J. D. Ullman: Principles of Database and Knowledge-Base Systems, Vol. 2. Computer Science Press, 1989.
U. Zukowski, S. Brass, B. Freitag: Improving the alternating fixpoint: The transformation approach. In A. Nerode (ed.), Proc. of the 4th Int. Conf. on Logic Programming and Non-Monotonic Reasoning (LPNMR’ 97), 40–59, LNAI 1265, Springer, 1997.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Brass, S. (2000). SLDMagic — The Real Magic (With Applications to Web Queries). In: Lloyd, J., et al. Computational Logic — CL 2000. CL 2000. Lecture Notes in Computer Science(), vol 1861. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44957-4_71
Download citation
DOI: https://doi.org/10.1007/3-540-44957-4_71
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67797-0
Online ISBN: 978-3-540-44957-7
eBook Packages: Springer Book Archive