Family To Persons

Bx Examples Repository

Title: FamilyToPersons

Version: 0.1

Type: Industrial, Sketch.


This is a well-known example adapted from the ATL Zoo.
It is sometimes referred to as the ATL "hello world" transformation.


The diagram below depicts a pair of consistent source and target models.
The source model to the left consists of a FamilyRegister, which contains a number of Families.
In this domain, a set of Members are connected to their Family via a reference that represents their "role" in the Family. For example, Cindy is a Member and plays the role of "mother" in the Family March.

The target model contains basically the same information, but represented quite differently.
Firstly, there is no concept of a Family as a container for family members.
All Persons are all placed directly into a global PersonsRegister.
It is, however, still possible to discern who belongs to the same family via a comparison of surnames (we assume surnames are unique).
The roles in a family are represented in the target model by explicit types: Cindy March isa Mother



FamilyRegister corresponds to PersonsRegister, Members to Persons according to the role they play in their Family.

Consistency Restoration

There are quite a few interesting deltas to try out: Moving Members in the source model between Families should result in appropriate renaming in the target model and vice versa.

Properties [optional section]

Variants [optional section]

The example can be extended by making the concept of a Family more realistic, e.g., allowing a Member to play different roles in multiple Families.

Constraints can (actually should!) also be added, e.g., a Family can have either: a Father and a Mother, two Fathers, or two Mothers, etc.

Finally, more relationships can be added between Members and Persons, e.g., marriage relationships, grandparents/grandchildren, in-laws, etc.


The example requires some interesting bidirectional attribute manipulation to "extract" families from target models.
Structure (in the source model) is also mapped to types (in the target model).

References [optional section]

See the ATL Zoo


Anthony Anjorin



Artefacts [optional section]

A virtual machine hosted on Share is available with a workspace containing both (Ecore) metamodels, the concrete example used above, and a TGG formalizing the consistency relation as a set of rules:

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.