Abstract
In this paper we study the expressive power of query languages for nested bags. We define the ambient bag language by generalizing the constructs of the relational language of Breazu-Tannen, Buneman and Wong, which is known to have precisely the power of the nested relational algebra. Relative strength of additional polynomial constructs is studied, and the ambient language endowed with the strongest combination of those constructs is chosen as a candidate for the basic bag language, which is called BQL (Bag Query Language). We prove that achieveing the power of BQL in the relational language amounts to adding simple arithmetic to the latter. We show that BQL has shortcomings of the relational algebra: it can not express recursive queries. In particular, parity test is not definable in BQL. We consider augmenting BQL with powerbag and structural recursion to overcome this deficiency. In contrast to the relational case, where powerset and structural recursion are equivalent, the latter is stronger than the former for bags. We discuss problems with using structural recursion and suggest a new bounded loop construct which works uniformly for bags, sets and lists. It has the power of structural recursion and does not require any preconditions to be verified. We find relational languages equivalent to BQL with powerbag and structural recursion/bounded loop. Finally, we discuss orderings on bags for rigorous treatment of partial information.
Supported in part by NSF Grant IRI-90-04137 and AT&T Doctoral Fellowship.
Supported in part by NSF Grant IRI-90-04137 and ARO Grant DAALO3-89-C-0031PRIME.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
S. Abiteboul and C. Beeri. On the power of languages for the manipulation of complex objects. In Proc. Int. Workshop on Theory and Applications of Nested Relations and Complex Objects, Darmstadt, 1988.
J. Albert. Algebraic properties of bag data types. In VLDB 91,pages 211–219.
V. Breazu-Tannen, P. Buneman, and S. Naqvi. Structural recursion as a query language. In DBPL 91,pages 9–19.
V. Breazu-Tannen and R. Subrahmanyam. Logical and computational aspects of programming with sets/bags/lists. In LNCS 510: ICALP 91,pages 60–75.
V. Breazu-Tannen, P. Buneman, and L. Wong. Naturally embedded query languages. In ICDT 92,pages 140–154.
P. Buneman, A. Ohori, and A. Jung. Using powerdomains to generalize relational databases. Theoretical Computer Science, 91: 23–55, 1991.
A. Chandra and D. Harel. Structure and complexity of relational queries. JCSS, 25: 99–128, 1982.
J. Van den Bussche and J. Paredaens. The expressive power of structured values in pure OODB. Technical Report 90–23, University of Antwerp, 1990. Extended abstract in PODS 91.
S. Grumbach and T. Milo. Towards tractable algebras for bags. In PODS 93,pages 49–60.
C. A. Gunter. Semantics of Programming Languages: Structures and Techniques. The MIT Press, 1992.
T. Imielinski and W. Lipski. Incomplete information in relational databases. Journal of the ACM, 31: 761–791, 1984.
N. Immerman, S. Patnaik and D. Stemple, The expressiveness of a family of finite set languages, in Proceedings of the 10th Symposium on Principles of Database Systems, 1991, pages 37–52.
L. A. Jategaonkar and J. C. Mitchell. ML with extended pattern matching and subtypes. In Proceedings of ACM Conference on LISP and Functional Programming, pages 198–211, Snowbird, Utah, July 1988.
A. Klausner and N. Goodman. Multirelations: semantics and languages. In VLDB 85,pages 251–258.
A. Klug. Equivalence of relational algebra and relational calculus query languages having aggregate functions. J. ACM, 29 (3): 699–717, 1982.
L. Libkin. A relational algebra for complex objects based on partial information. In J. Demetrovics and B. Thalheim editors, LNCS.495: Proceedings of Symposium on Mathematical Fundamentals of Database Systems, Rostock, May 1991, pages 36–41. Springer-Verlag, 1991.
L. Libkin and L. Wong. Semantic representations and query languages for or-sets. In PODS 93,Washington, D. C., May 1993, pages 37–48. Full paper available as UPenn Technical Report MS-CIS-92–88.
L. Libkin and L. Wong. Query languages for bags, Technical Report MSCIS-93–36, University of Pennsylvania, 1993.
L. Libkin and L. Wong. Aggregate functions, conservative extension, and linear orders. This volume.
E. Moggi. Notions of computation and monads. Information and Computation, 93: 55–92, 1991.
I. S. Mumick and O. Shmueli, How expressive is stratified aggregation, submitted.
P. Odifreddi. Classical Recursion Theory. North Holland, 1989.
A. Ohori, P. Buneman, and V. Breazu-Tannen. Database programming in Machiavelli: a polymorphic language with static type inference. In SIGMOD 89,pages 46–57.
G. Ozsoyoglu, Z. M. Ozsoyoglu, and V. Matos. Extending relational algebra and relational calculus with set-valued attributes and aggregate functions. ACM TODS, 12 (4): 566–592, 1987.
J. Paredaens and D. Van Gucht. Converting nested relational algebra expressions into flat algebra expressions. ACM Transaction on Database Systems, 17 (1): 65–93, 1992.
H. E. Rose. Subrecursion: Functions and Hierarchies. Clarendon Press, Oxford, 1984.
Y. Saraiya, Fixpoints and optimizations in a language based on structural recursion on sets, Manuscript, December 1992.
S. Vickers. Geometric theories and databases. In P. Johnstone and A. Pitts, editors, Applications of Categories in Computer Science, volume 177 of London Mathematical Society Lecture Notes, pages 288–314. Cambridge University Press, 1992.
P. Wadler. Comprehending monads. In Proceedings of ACM Conference on Lisp and Functional Programming, Nice, June 1990.
L. Wong. Normal forms and conservative properties for query languages over collection types. In PODS 93,pages 26–36, Washington, D. C., May 1993. Full paper available as UPenn Technical Report MS-CIS-92–59.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1994 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Libkin, L., Wong, L. (1994). Some Properties of Query Languages for Bags. In: Beeri, C., Ohori, A., Shasha, D.E. (eds) Database Programming Languages (DBPL-4). Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3564-7_7
Download citation
DOI: https://doi.org/10.1007/978-1-4471-3564-7_7
Publisher Name: Springer, London
Print ISBN: 978-3-540-19853-6
Online ISBN: 978-1-4471-3564-7
eBook Packages: Springer Book Archive