Consider you have a very complex relation "A" with many nested object templates. The relation holds for a set of model elements and you want to retain that a subset of these elements are in the binding in order to use it as a condition for another relation "B". In this case you can retain the interesting model elements in the binding by creating a fictitious "F" relation with corresponding domain and invoking it in the where-clause of Relation "A". The when-clause of Relation "B" can then have a condition based on "F". The following example illustrates this.
/* transformation omitted */
top relation ComplexRelation {
enforce domain uml c:UMLClass {
..
attributes = a:UMLAttribute {
..
},
..
};
enforce domain uml p:UMLPackage {
..
};
enforce domain rdbms t:Table {
..
};
when {
..
}
where {
FicticiousRelation(a,t);
}
}
relation FicticiousRelation {
enforce domain uml a:UMLAttribute {};
enforce domain rdbms t:Table {};
}
top relation AnotherRelation {
..
when {
..
not MyComplexCondition(a, t);
}
}In the above example, AnotherRelation requires that the fictitious relation should not exist between "a" and "t". Without this pattern, the when-clause of AnotherRelation would have required the complex condition in ComplexRelation which resulted in the binding containing "a" and "t".