Filter Before Processing

This is an architectural pattern.


When combining large models to derive information from selected elements of the models, pre-filter one or both to reduce their size by selecting only the elements that are relevant for the combination.

Application conditions

This can be applied to transformations which combine separate source models to derive selected information in a target model. It can also be applied to transformations operating on a single model, to filter out elements of the model that are irrelevant to the transformation. The pattern is appropriate if significant size reductions in input models can be achieved by discarding irrelevant data.


Introduce a filter transformation which produces a smaller input model by using implicit information about what data is relevant to the combination transformation: other data is filtered out.

For transformations tau with a single input model, m, elements of m which cannot match or be navigated by a rule of tau can be removed by pre-filtering to produce a smaller input model m1.


The source model size can be decreased substantially, as can the processing cost of the main transformation.


A new model and transformation need to be introduced; the filter transformation depends upon the second input model or upon the main transformation. The filter may involve fixed-point iteration because of cascaded deletion effects.

Applications and examples

An example could be searching for N-sized groups of actors/actresses who perform together in three or more movies (Horn, 2014): the input model m1 can be filtered to remove films with less than N cast members, and to remove actors who perform in less than 3 films.

Related patterns

Construction and Cleanup is a dual to this pattern: a cleanup transformation post-filters an output model after the main transformation processing.

(Horn, 2014) T. Horn, C. Krause, M. Tichy, The TTC 2014 Movie Database Case, TTC 2014.