TACS 1994: Theoretical Aspects of Computer Software pp 96-120 | Cite as
Constraint programming and database query languages
Abstract
The declarative programming paradigms used in constraint languages can lead to powerful extensions of Codd's relational data model. The development of constraint database query languages from logical database query languages has many similarities with the development of constraint logic programming from logic programming, but with the additional requirements of data efficient, set-at-a-time, and bottomup evaluation. In this overview of constraint query languages (CQLs) we first present the framework of [41]. The principal idea is that: “the k-tuple (or record) data type can be generalized by a conjunction of quantifier-free constraints over k variables”. The generalization must preserve various language properties of the relational data model, e.g., the calculus/algebra equivalence, and have time complexity polynomial in the size of the data. We next present an algebra for dense order constraints that is simpler to evaluate than the calculus described in [41], and we sharpen some of the related data complexity bounds. We note that CQLs are applicable to spatial databases. This is because these languages have “spatial point set” as the semantics of their record data type and because existing multi-dimensional searching data structures can support I/O efficient access to sets of records. Finally, we observe that CQLs can be augmented with complex object data types, aggregate operations, and null-values, just like the relational data model.
Keywords
Query Language Spatial Database Relational Algebra Canonical Representation Constraint Logic ProgrammingPreview
Unable to display preview. Download preview PDF.
References
- 1.S. Abiteboul, C. Beeri. On the Power of Languages for the Manipulation of Complex Objects. INRIA Research Report 846, 1988.Google Scholar
- 2.S. Abiteboul and P. Kanellakis. Database Theory Column: Query Languages for Complex Object Databases. SIGACT News, 21, pp. 9–18, 1990.Google Scholar
- 3.S. Abiteboul and V. Vianu. Datalog Extensions for Database Queries and Updates. J. Comput. System Sci., 43 (1991), pp. 62–124.Google Scholar
- 4.A.K. Aylamazyan, M.M. Gilula, A.P. Stolboushkin, G.F. Schwartz. Reduction of the Relational Model with Infinite Domain to the Case of Finite Domains. Proc. USSR Acad. of Science (Doklady), 286(2):308–311, 1986.Google Scholar
- 5.D.A. Barrington, N. Immerman, H. Straubing. On Uniformity within NC1. JCSS, 41:274–306, 1990.Google Scholar
- 6.M. Baudinet, M. Niezette, P. Wolper. On the Representation of Infinite Temporal Data and Queries. Proc. 10th ACM PODS, 280–290, 1991.Google Scholar
- 7.R. Bayer, E. McCreight. Organization of Large Ordered Indexes. Acta Informatica, 1:173–189, 1972.Google Scholar
- 8.M. Ben-Or, D. Kozen, J. Reif. The Complexity of Elementary Algebra and Geometry. JCSS, 32:251–264, 1986.Google Scholar
- 9.L. Berman. Precise Bounds for Presburger Arithmetic and the Reals with Addition. Proc. 18th IEEE FOCS, pp. 95–99, 1977.Google Scholar
- 10.A.H. Borning. The Programming Language Aspects of ThingLab, A Constraint-Oriented Simulation Laboratory. ACM TOPLAS 3:4:353–387, 1981.Google Scholar
- 11.A. Brodsky, J. Jaffar, M.J. Maher. Toward Practical Constraint Databases. Proc. 19th VLDB, 322–331, 1993.Google Scholar
- 12.A. Brodsky, C. Lassez. Separability of Polyhedra and a New Approach to Spatial Storage. in [42].Google Scholar
- 13.A. Brodsky, Y. Sagiv. Inference of Monotonicity Constraints in Datalog Programs. Proc. 8th ACM PODS, 190–200, 1989.Google Scholar
- 14.A. Brodsky, Y. Sagiv. Inference of Inequality Constraints in Logic Programs. Proc. 10th ACM PODS, 227–241, 1991.Google Scholar
- 15.A.R. Bruss, A.R. Meyer. On Time-Space Classes and their Relation to the Theory of Real Addition. Proc. 10th ACM STOC, pp. 233–239, 1978.Google Scholar
- 16.S.R. Buss. The Formula Value Problem is in ALOGTIME. Proc. 19th ACM STOC, pp. 123–131, 1987.Google Scholar
- 17.A.K. Chandra, D. Harel. Structure and Complexity of Relational Queries. JCSS, 25:1:99–128, 1982.Google Scholar
- 18.J. Chomicki. Ptime Query Processing in Temporal Deductive Databases. Proc. 9th ACM PODS, 379–391, 1990.Google Scholar
- 19.J. Chomicki, T. Imielinski. Relational Specifications of Infinite Query Answers. Proc. ACM SIGMOD, 174–183, 1989.Google Scholar
- 20.E.F. Codd. A Relational Model for Large Shared Data Banks. CACM, 13:6:377–387, 1970.Google Scholar
- 21.J. Cohen. Constraint Logic Programming Languages. CACM, 33:7:52–68, 1990.Google Scholar
- 22.A. Colmerauer. An Introduction to Prolog III. CACM, 33:7:69–90, 1990.Google Scholar
- 23.G.E. Collins. Quantifier Elimination for Real Closed Fields by Cylindrical Algebraic Decomposition. Proc. 2nd GI conference on Automata Theory and Languages, LNCS 33, pp. 512–532, Springer-Verlag, 1975.Google Scholar
- 24.D. Comer. The Ubiquitous B-Tree. Computing Surveys, 11:2:121–137, 1979.Google Scholar
- 25.S.S. Cosmadakis, G.M. Kuper Expressiveness of First-Order Constraint Languages. Manuscript, December 1993.Google Scholar
- 26.J. Cox, K. McAloon, C. Tretkoff. Computational Complexity and Constraint Logic Programming. Annals of Math, and AI, 5:163–190, 1992.Google Scholar
- 27.M. Dincbas, P. Van Hentenryck, H. Simonis, A. Aggoun, T. Graf, F. Berthier. The Constraint Logic Programming Language CHIP. Proc. Fifth Generation Computer Systems, Tokyo Japan, 1988.Google Scholar
- 28.J. Ferrante, J.R. Geiser. An Efficient Decision Procedure for the Theory of Rational Order. Theoretical Computer Science, 4:227–233, 1977.Google Scholar
- 29.J. Ferrante, C. Rackoff. A Decision Procedure for the First Order Theory of Real Addition with Order. SICOMP, 4:1:69–76, 1975.Google Scholar
- 30.M.J. Fischer, M.O. Rabin. Super-Exponential Complexity of Presburger Arithmetic. SIAM-AMS Proc. volume VII, American Mathematical Society, 1974.Google Scholar
- 31.E. Freuder. Synthesizing Constraint Expressions. CACM, 21:11, 1978.Google Scholar
- 32.Y. Gurevich, S. Shelah. Fixed-Point Extensions of First-Order Logic. Annals of Pure and Applied Logic, 32, 265–280, 1986.Google Scholar
- 33.M.R. Hansen, B.S. Hansen, P. Lucas, P. van Emde Boas. Integrating Relational Databases and Constraint Languages. Computer Languages, 14:2:63–82, 1989.Google Scholar
- 34.R. Helm, K. Marriott, M. Odersky. Constraint-based Query Optimization for Spatial Databases. Proc. 10th ACM PODS, 181–191, 1991.Google Scholar
- 35.R. Hull, J. Su. Domain Independence and the Relational Calculus. Technical Report 88-64, University of Southern California.Google Scholar
- 36.N. Immerman. Relational Queries Computable in Polynomial Time. Information and Control, 68:86–104, 1986.Google Scholar
- 37.J. Jaffar, J.L. Lassez. Constraint Logic Programming. Proc. 14th ACM POPL, 111–119, 1987.Google Scholar
- 38.D.S. Johnson. A Catalogue of Complexity Classes. Handbook of Theoretical Computer Science, Vol. A, chapter 2, (J. van Leeuwen editor), North-Holland, 1990.Google Scholar
- 39.F. Kabanza, J-M. Stevenne, P. Wolper. Handling Infinite Temporal Data. Proc. 9th ACM PODS, 392–403, 1990.Google Scholar
- 40.P.C. Kanellakis. Elements of Relational Database Theory. Handbook of Theoretical Computer Science, Vol. B, chapter 17, (J. van Leeuwen editor), North-Holland, 1990.Google Scholar
- 41.P. C. Kanellakis, G. M. Kuper, P. Z. Revesz. Constraint Query Languages. Proc. 9th ACM PODS, 299–313, 1990. Full version available as Brown Univ. Tech. Rep. CS-92-50. To appear in JCSS.Google Scholar
- 42.P.C. Kanellakis, J.L. Lassez, V.J. Saraswat. Proceedings of the Workshop on the Principles and Practice of Constraint Programming (PPCP93). Newport RI, April 1993. Preliminary version available via anonymous ftp from wilma.cs.brown.edu (128.148.33.66) in the directory/pub/ppcp93. To appear from MIT Press.Google Scholar
- 43.P. C. Kanellakis, S. Ramaswamy, D. E. Vengroff, J. S. Vitter. Indexing for Data Models with Constraints and Classes. Proc. 12th ACM PODS, 233–243, 1993.Google Scholar
- 44.M. Kifer. On Safety, Domain Independence, and Capturability of Database Queries. Proc. International Conference on Databases and Knowledge Bases, Jerusalem Israel, 1988.Google Scholar
- 45.A. Klug. Equivalence of Relational Algebra and Relational Calculus Query Languages having Aggregate Functions. JACM, 29:3:699–717, 1982.Google Scholar
- 46.A. Klug. On Conjunctive Queries Containing Inequalities. JACM, 35:1:146–160, 1988.Google Scholar
- 47.P. Kolaitis, C.H. Papadimitriou. Why not Negation by Fixpoint? Proc. 7th ACM PODS, 231–239, 1988.Google Scholar
- 48.D. Kozen, C. Yap. Algebraic Cell Decomposition in NC. Proc. 26th IEEE FOCS, 515–521, 1985.Google Scholar
- 49.M. Koubarakis. Foundations of Temporal Constraint Databases. PhD Thesis. Nat. Tech. Univ. of Athens and Imperial College. 1993.Google Scholar
- 50.G.M. Kuper. Aggregation in Constraint Databases. in [42].Google Scholar
- 51.W. Leler. Constraint Programming Languages. Addison Wesley, 1987.Google Scholar
- 52.A. Levy, Y. Sagiv. Constraints and Redundancy in Datalog. Proc. 11th ACM PODS, 67–81, 1992.Google Scholar
- 53.E. McCreight. Priority Search Trees. SIAM J. Computing, 14:257–276, 1985.Google Scholar
- 54.A.K. Mackworth. Consistency in Networks of Relations. AI, 8:1, 1977.Google Scholar
- 55.U. Montanari. Networks of Constraints: Fundamental Properties and Application to Picture Processing. Information Science, 7, 1974.Google Scholar
- 56.I. S. Mumick, S. J. Finkelstein, H. Pirahesh, R. Ramakrishnan. Magic Conditions. Proc. 9th ACM PODS, 314–330, 1990.Google Scholar
- 57.F.P. Preparata, M.I. Shamos. Computational Geometry: An Introduction. Springer-Verlag, 1985.Google Scholar
- 58.R. Ramakrishnan. Magic Templates: A Spellbinding Approach to Logic Programs. Proc. 5th International Conference on Logic Programming, 141–159, 1988.Google Scholar
- 59.S. Ramaswamy, S. Subramanian. Path Caching: A Technique for Optimal External Searching. Manuscript submitted for publication.Google Scholar
- 60.J. Renegar. On the Computational Complexity and Geometry of the First-order Theory of the Reals: Parts I–III. Journal of Symbolic Computation, 13:255–352, 1992.Google Scholar
- 61.P.Z. Revesz. A Closed Form for Datalog Queries with Integer Order. Proc. 3rd International Conference on Database Theory, 1990, (to appear in TCS).Google Scholar
- 62.H. Samet. Applications of Spatial Data Structures: Computer Graphics, Image Processing, and GIS. Addison-Wesley, Reading MA, 1990.Google Scholar
- 63.H. Samet. The Design and Analysis of Spatial Data Structures. Addison-Wesley, Reading MA, 1990.Google Scholar
- 64.V.A. Saraswat. Concurrent Constraint Programming Languages. PhD thesis, Carnegie Mellon University, 1989.Google Scholar
- 65.D. Srivastava, R. Ramakrishnan. Pushing Constraint Selections. Proc. 11th ACM PODS, 301–316, 1992.Google Scholar
- 66.G.L. Steele. The Definition and Implementation of a Computer Programming Language Based on Constraints. Ph.D. thesis, MIT, AI-TR 595, 1980.Google Scholar
- 67.I.E. Sutherland. SKETCHPAD: A Man-Machine Graphical Communication System. Spartan Books, 1963.Google Scholar
- 68.A. Tarski. A Decision Method for Elementary Algebra and Geometry. University of California Press, Berkeley, California, 1951.Google Scholar
- 69.J.D. Ullman. Principles of Database Systems. Computer Science Press, 2nd Ed., 1982.Google Scholar
- 70.R. van der Meyden. The Complexity of Querying Indefinite Data about Linearly Ordered Domains. Proc. 11th ACM PODS, 331–346, 1992.Google Scholar
- 71.A. Van Gelder. Deriving Constraints among Argument Sizes in Logic Programs. Proc. 9th ACM PODS, 47–60, 1990.Google Scholar
- 72.P. Van Hentenryck. Constraint Satisfaction in Logic Programming. MIT Press, 1989.Google Scholar
- 73.M.Y. Vardi. The Complexity of Relational Query Languages. Proc. 14th ACM STOC, 137–146, 1982.Google Scholar