As an example of how comprehensions are translated into intermediate algebraic forms, consider the following:
Algebraic forms can be displayed as operator trees in which the tree leaves are collections of objects (e.g., class extents) and the output of the tree root is the output of the algebraic form.
There are a number of proposals lately that instead of rewriting correlated queries into more efficient queries or algebraic forms, offer new evaluation algorithms that perform better than the default nested loop evaluation of embedded queries.
If we use the rules in Definition 3, this comprehension is translated into algebraic form as
A monoid comprehension [direct sum]{ [e.sub.1] [] v [left arrow] [e.sub.2], [bar]r} that may appear at any point in a calculus form (including the ones inside other comprehensions) is translated into an algebraic form by [??[direct sum]{ [e.sub.1] [] [bar]r}[??.sub.v] [e.sub.2].
The functionality of an algebraic form can be better understood if we use a stream-based interpretation in which a stream of tuples flows from the leaves to the root of the tree.
The algebraic form of QUERY B after unnesting is shown in Figure 8.B.
The algebraic form of QUERY C is shown in Figure 8.C.
The algebraic form of this query is shown in Figure 8.D.