Feature Models, Concise and Safe

Bx Examples Repository

Title: FeatureModelsConciseAndSafe

Version: 0.1


Industrial, Sketch.


This is a simple example for a model transformation kindly provided by Andrzej Wasowski.
It represents a common motivation for (bidirectional) model transformations, namely supporting the concurrent usage of different meta-models for working with essentially the same data.
A challenge with meta-modelling is typically that no meta-model is or can be perfect for all tasks: many design decision will have advantages and disadvantages, depending on what the models are to be used for.
A way to deal with this is to use multiple meta-models for different tasks or systems. Everyone gets the abstraction they want at the price of having to synchronise/convert back and forth between the different representations.


The meta-models depicted below both have a container Model that contains a single root Feature.
In the "safe" version of the meta-model, Groups of features contain their own features exclusively, enforcing the expected tree structure of a feature model.
Features can of course have solitarySubFeatures that are not in any group.
In the "concise" version of the meta-model, every feature contains all its subfeatures providing easy access for typical "foreach" operations on all features.
In this meta-model, groups only refer to their member features but do not contain them.


Although the concise meta-model might make some iteration-related operations easier, nonsensical models can be created, for instance, with features being members of multiple groups at the same time.
While this can be covered with OCL constraints or similar, the safe version rules this out structurally.
These different representations are illustrated in the concrete example below.



The consistency relation is a bijection (up to isomorphisms concerning position in lists). There is no information loss when converting from one representation to the other and each meta-model represents exactly the same things just structured differently.

Consistency Restoration

Properties [optional section]

Variants [optional section]


References [optional section]


Anthony Anjorin, Andrzej Wasowski



Artefacts [optional section]

If you can read TGGs, the following 6 concrete rules and 2 abstract rules show how this can be expressed.
Of interest is that pattern duplication can be avoided via rule refinement (indicated in the rule overview diagram).
The visualisations, however, are automatically generated and are complete (but the actual textual specification can do without redundant copy&paste).
Some simple attribute manipulation is also required (but not shown in the visualisation).
If you're interested in the complete executable specification (and EMF-based meta-models) you can find it on GitHub.

Rule overview showing refinement structure:
  • RootAxiomRule:
  • SubFeatureRule:
  • OrRule:
  • XOrRule:
  • CreateGroupsRule:
  • CreateOrRule:
  • CreateXOrRule:
  • SolitaryFeatureRule
Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.