Family To Persons (B)

Bx Examples Repository

Title: FamilyToPersons (B)

Version: 0.1

Type: Industrial, Sketch, Now a benchmarx

Overview

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

This example has now been extended to a benchmarx described in detail in [1].

Models

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

familyTopersons.PNG

Consistency

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.

Discussion

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

[1] Anthony Anjorin, Zinovy Diskin, Frédéric Jouault, Hsiang-Shang Ko, Erhan Leblebici, Bernhard Westfechtel: Benchmarx Reloaded: A Practical Benchmark Framework for Bidirectional Transformations, BX 2017, 2017.

Author(s)

Anthony Anjorin

Reviewer(s)

Comments

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:

A virtual machine for the related benchmarx and implementations with various bx tools is also available on Share:

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