Comprehending Queries (1999) [1 citations — 0 self]
http://www.informatik.uni-konstanz.de/~grust/files
http://www.ub.uni-konstanz.de/kops/volltexte/1999/
CACHED:
Abstract:
There are no compelling reasons why database-internal query representations have to be designated by operators. This text describes a world in which datatypes determine the comprehension of queries. In this world, a datatype is characterized by its algebra of value constructors. These algebras are principal. Query operators are secondary in the sense that they simply box (recursive) programs that describe how to form a query result by application of datatype constructors. Often, operators will be unboxed to inspect and possibly rewrite these programs. Query optimization then means to deal with the transformation of programs. The predominant role of the constructor algebras suggests that this model understands queries as mappings between such algebras. The key observation that makes the whole approach viable is that (a) homomorphic mappings are expressive enough to cover declarative user query languages like OQL or recent SQL dialects, and, at the same time, (b) a single program form suffices to express homomorphisms between constructor algebras. Reliance on a single combining form, catamorphisms, renders the query programs susceptible to Constructive Algorithmics, an effective and extensive algebraic theory of program transformations. The text then takes a step from catamorphisms towards a higher-level query representation based on the categorical notion of monads. In a nutshell, monads are algebras exhibiting exactly the structure that is needed to support the interpretation of a query calculus, the monad comprehension calculus. Built on top of the abstract monad notion, the calculus maps a variety of query constructs (e. g., bulk operations, aggregates, and quantifiers) to few syntactic forms. The uniformity of the calculus facilitates the analysis and transformation, especially the normalization, of its expressions. Few but generic calculus rewriting rules suffice to implement query transformations that would otherwise require extensive rule sets.

