ABSTRACT
Certain variants of object-oriented Datalog can be compiled to Datalog with negation. We seek to apply optimisations akin to virtual method resolution (a well-known technique in compiling Java and other OO languages) to improve efficiency of the resulting Datalog programs. The effectiveness of such optimisations strongly depends on the precision of the underlying type inference algorithm. Previous work on type inference for Datalog has focussed on Cartesian abstractions, where the type of each field is computed separately. Such Cartesian type inference is inherently imprecise in the presence of field equalities. We propose a type system where equalities are tracked, and present a type inference algorithm. The algorithm is proved sound. We also prove that it is optimal for Datalog without negation, in the sense that the inferred type is as tight as possible. Extensive experiments with our type-based optimisations, in a commercial implementation of object-oriented Datalog, confirm the benefits of this non-Cartesian type inference algorithm.
- Serge Abiteboul and Cassio Souza dos Santos. IQL(2): A model with ubiquitous objects. In Paolo Atzeni and Val Tannen, editors, Database Programming Languages (DBPL-5), Electronic Workshops in Computing. Springer, 1995. Google Scholar
Digital Library
- Serge Abiteboul, Richard Hull, and Victor Vianu. Foundations of Databases. Addison-Wesley, 1995. Google Scholar
Digital Library
- Serge Abiteboul, Georg Lausen, Heinz Uphoff, and Emmanuel Waller. Methods and rules. In ACM SIGMOD International Conference on Management of Data, pages 32--41. ACM Press, 1993. Google Scholar
Digital Library
- Roland Backhouse. Fixed point calculus. In Algebraic and Coalgebraic Methods in Mathematics of Program Construction, volume 2297 of LNCS, pages 89--148. Springer, 2002. Google Scholar
Digital Library
- François Bancilhon, David Maier, Yehoshua Sagiv, and Jeffrey D. Ullman. Magic sets and other strange ways to implement logic programs. In Principles of Database Systems (PODS), pages 1--16. ACM Press, 1986. Google Scholar
Digital Library
- Sacha Berger, Emmanuel Coquery, Wlodzimierz Drabent, and Artur Wilk. Descriptive typing rules for Xcerpt and their soundness. In François Fages and Sylvain Soliman, editors, Principles and Practice of Semantic Web Reasoning, volume 3703 of LNCS, pages 85--100. Springer, 2005. Google Scholar
Digital Library
- Piero A. Bonatti. On the decidability of containment of recursive Datalog queries - preliminary report. In Principles of Database Systems (PODS), pages 297--306, 2004. Google Scholar
Digital Library
- Maurice Bruynooghe, John P. Gallagher, and Wouter van Humbeeck. Inference of well-typings for logic programs with application to termination analysis. In Chris Hankin and Igor Siveroni, editors, Static Analysis Symposium (SAS '05), volume 3672 of Lecture Notes in Computer Science, pages 35--51. Springer, 2005. Google Scholar
Digital Library
- Diego Calvanese, Giuseppe De Giacomo, and Moshe Y. Vardi. Decidable containment of recursive queries. In International Conference on Database Theory (ICDT '03), pages 330--345, 2003. Google Scholar
Digital Library
- Edward P. F. Chan. Containment and minimization of positive conjunctive queries in OODB's. In Principles of Database Systems (PODS), pages 202--211, 1992. Google Scholar
Digital Library
- Surajit Chaudhuri. Finding nonrecursive envelopes for Datalog predicates. In Principles of Database Systems (PODS), pages 135--146, 1993. Google Scholar
Digital Library
- Surajit Chaudhuri and Phokion G. Kolaitis. Can Datalog be approximated? In Principles of Database Systems (PODS), pages 86--96, 1994. Google Scholar
Digital Library
- Horatiu Cirstea and Claude Kirchner. Types for web rule languages: a preliminary study. Technical Report IST5067779/Nancy/I3-D2/D/PU/a1, Rewerse: reasoning on the web, 2004.Google Scholar
- Stavros Cosmadakis, Haim Gaifman, Paris Kanellakis, and Moshe Vardi. Decidable optimization problems for database logic programs. In Proceedings of the 20th annual ACM Symposium on Computing, pages 477--490, 1988. Google Scholar
Digital Library
- Patrick Cousot. Types as abstract interpretations. In Symposium on Principles of Programming Languages (POPL), pages 316--331. ACM Press, 1997. Google Scholar
Digital Library
- Patrick Cousot and Radhia Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Symposium on Principles of Programming Languages (POPL), pages 238--252. ACM Press, 1977. Google Scholar
Digital Library
- Evgeny Dantsin, Thomas Eiter, Georg Gottlob, and Andrei Voronkov. Complexity and expressive power of logic programming. In IEEE Conference on Computational Complexity (CC '97), pages 82--101, 1997. Google Scholar
Digital Library
- Anuj Dawar. Types and indiscernibles in finite models. In J. A. Makowsky, editor, Logic Colloquium '95, Lecture Notes in Logic, pages 51--65. Springer, 1995.Google Scholar
- Oege de Moor, Damien Sereni, Mathieu Verbaere, Elnar Hajiyev, Pavel Avgustinov, Torbjörn Ekman, Neil Ongkingco, and Julian Tibble. .QL: Object-oriented queries made easy. In Ralf Lämmel, João Saraiva, and Joost Visser, editors, Generative and Transformational Techniques in Software Engineering, LNCS. Springer, 2007.Google Scholar
- Oege de Moor, Mathieu Verbaere, Elnar Hajiyev, Pavel Avgustinov, Torbjörn Ekman, Neil Ongkingco, Damien Sereni, and Julian Tibble. .QL for source code analysis. In Source Code Analysis and Manipulation (SCAM '07), pages 3--16. IEEE, 2007. Google Scholar
Digital Library
- Andrew Dinn, Norman W. Paton, M. Howard Williams, Alvaro A. A. Fernandez, and Maria L. Barja. The implementation of a deductive query language over an OODB. In 4th Conference on Deductive and Object-Oriented Databases, volume 1013 of LNCS, pages 143--160. Springer, 1995. Google Scholar
Digital Library
- Thom W. Frühwirth, Ehud Y. Shapiro, Moshe Y. Vardi, and Eyal Yardeni. Logic programs as types for logic programs. In Logic in Computer Science (LICS), pages 300--309. IEEE Computer Society, 1991.Google Scholar
Cross Ref
- John P. Gallagher and Kim S. Henriksen. Type analysis and transformation tool. http://wagner.ruc.dk/Tattoo/, 2007.Google Scholar
- John P. Gallagher, Kim S. Henriksen, and Gourinath Banda. Techniques for scaling up analyses based on pre-interpretations. In M. Gabbrielli and G. Gupta, editors, International Conference on Logic Programming (ICLP '05), volume 3668 of LNCS, pages 280--296. Springer, 2005. Google Scholar
Digital Library
- John P. Gallagher and Germán Puebla. Abstract interpretation over non-deterministic finite tree automata for set-based analysis of logic programs. In Practical Aspects of Declarative Languages (PADL), volume 2257 of LNCS, pages 243--261. Springer, 2002. Google Scholar
Digital Library
- Nevin C. Heintze and Joxan Jaffar. A finite presentation theorem for approximating logic programs. In Symposium on Principles of Programming Languages (POPL), pages 197--209, 1990. Google Scholar
Digital Library
- Jakob Henriksson and Jan Maluszyński. Static type-checking of datalog with ontologies. In Hans Jürgen Ohlbach and Sebastian Schaffert, editors, Principles and Practice of Web Reasoning, volume 3208 of LNCS, pages 76--89. Springer, 2004.Google Scholar
- John Hughes. Type specialisation for the lambda-calculus; or, a new paradigm for partial evaluation based on type inference. In Olivier Danvy, Robert Glück, and Peter Thiemann, editors, Dagstuhl Seminar on Partial Evaluation, volume 1110 of LNCS, pages 183--215. Springer, 1996. Google Scholar
Digital Library
- Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, 1993. Google Scholar
Digital Library
- Benjamin S. Lerner, Matthew Flower, Dan Grossman, and Craig Chambers. Searching for type-error messages. In Programming Language Design and Implementation (PLDI), pages 425--434, 2007. Google Scholar
Digital Library
- Alon Y. Levy and Dan Suciu. Deciding containment for queries with complex objects. In Principles of Database Systems (PODS), pages 20--31, 1997. Google Scholar
Digital Library
- Witold Litwin and Tore Risch. Main memory oriented optimization of OO queries using typed datalog with foreign predicates. IEEE Transactions on Knowledge and Data Engineering, 4(6):517--528, 1992. Google Scholar
Digital Library
- Mengchi Liu, Gillian Dobbie, and Tok Wang Ling. A logical foundation for deductive object-oriented databases. ACM Transactions on Database Systems, 27(1):117--151, 2002. Google Scholar
Digital Library
- Kim Marriott, Harald Søndergaard, and Neil D. Jones. Denotational abstract interpretation of logic programs. ACM Transactions on Programming Languages and Systems, 16(3):607--648, 1994. Google Scholar
Digital Library
- Atsushi Ohori, Peter Buneman, and Val Breazu-Tannen. Database programming in Machiavelli - a polymorphic language with static type inference. In Principles of Database Systems, pages 46--57, 1989. Google Scholar
Digital Library
- Benjamin Pierce. Types and Programming Languages. MIT Press, 2002. Google Scholar
Digital Library
- Semmle Ltd. Company website with free downloads, documentation, and discussion forums. http://semmle.com, 2007.Google Scholar
- Oded Shmueli. Equivalence of datalog queries is undecidable. Journal of Logic Programming, 15(3):231--241, 1993. Google Scholar
Digital Library
- Vijay Sundaresan, Laurie Hendren, Chrislain Razafimahefa, Raja Vallée-Rai, Patrick Lam, Etienne Gagnon, and Charles Godin. Practical virtual method call resolution for Java. ACM SIGPLAN Notices, 35(10):264--280, 2000. Google Scholar
Digital Library
- Jeffrey D. Ullman. A comparison between deductive and object-oriented database systems. In 2nd International Conference on Deductive and Object-Oriented Databases, LNCS, pages 263--277, 1991.Google Scholar
Cross Ref
- Moshe Y. Vardi. Automata theory for database theoreticians. In Principles of Database Systems (PODS), pages 83--92. ACM Press, 1989. Google Scholar
Digital Library
Index Terms
Type inference for datalog and its application to query optimisation
Recommendations
Type inference for datalog with complex type hierarchies
POPL '10Type inference for Datalog can be understood as the problem of mapping programs to a sublanguage for which containment is decidable. To wit, given a program in Datalog, a schema describing the types of extensional relations, and a user-supplied set of ...
Type inference for datalog with complex type hierarchies
POPL '10: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesType inference for Datalog can be understood as the problem of mapping programs to a sublanguage for which containment is decidable. To wit, given a program in Datalog, a schema describing the types of extensional relations, and a user-supplied set of ...
Type checking and inference for polymorphic and existential types
CATS '09: Proceedings of the Fifteenth Australasian Symposium on Computing: The Australasian Theory - Volume 94This paper proves undecidability of type checking and type inference problems in some variants of typed lambda calculi with polymorphic and existential types. First, type inference in the domain-free polymorphic lambda calculus is proved to be ...






Comments