Stateless Transforms

In general, a transform changes the result of a set expression into another set; this is a very flexible concept, and you can do all sorts of processing with transforms. You apply a transform to a set expression just by writing the transform in front of the expression; the result is a new set expression that returns the result of the original set expression transformed.

A commonly used transform is methods in, which reflects one relationship between methods and classes: methods are defined within classes. You apply this transform to a set expression that represents a set of classes, and the resulting set expression represents the methods that are defined in those classes. So the set expression methods in class "java.util.ArrayList" returns, well, just what you'd expect.

The language provides a selection of built-in transforms that reflect the relationships among the program objects in the BBQ database; they're listed in the reference. You'll often combine these transforms in a series to get the results you want. For example calls to is a transform that takes a set of methods and is often used with the methods in transform; the set expression calls to methods in class "java.util.ArrayList returns all the calls, from anywhere in the analyzed system, to methods in the ArrayList class. A series of transforms can be regarded as a single transform that combines their effects: ( calls to methods in ) is a transform that turns a set expression representing a set of classes into a set expression for all the calls to any methods defined in those classes.

You might think that putting the transform in front of the set expression is confusing. The rationale is this: a set expression should read like a noun phrase in English, and filters and transforms, like adjectives, precede the things they modify. When you read a set expression, you can picture the data flowing from the simple set expression through the transforms from right to left.

Stateless Transforms

In general, all the results of a transform may depend on any of the elements in the set being transformed. However, some transforms have the property of being stateless. These transforms will return the same result for any given transformed object, regardless of the other elements in the set to be transformed. Because of this, stateless transforms behave more predictably in the context of some transform operators such as exists and recursive. If a transform is stateless, that is noted in the synopsis for the transform in the reference.

Many operators that were stateless transforms in previous releases of the language are now implemented as value expressions. You can still use them in set expressions with the same syntax; you can also use them as part of value expressions.

browse-by-query home antlersoft free software sourceforge project page