From the assignment sheet:
In this assignment, you will refine the Families metamodel from the tutorial, and write a new ATL transformation to create an instance of this refined metamodel:
- Create a new metamodel named
ExtendedFamilies.ecore
. Create aFamily
class and a “Person” class. ThePerson
class is an abstract class. Create two subclasses ofPerson
:Male
andFemale
. In theFamily
class, create alastName
attribute [1..1] of typeEstring
and amembers
reference [0..*] of typePerson
,members
is a containment reference. Also add anoOfChildren
attribute [0..*] of typeEInt
. In thePerson
class, create afirstName
attribute [1..1] of typeEString
, afamily
reference [0..1] of typeFamily
, achildren
reference [0..*] of typePerson
, and aparents
reference [0..2] of typePerson
. Thefamily
reference is the opposite of themembers
attribute in theFamily
class, and thechildren
reference is the opposite of theparents
reference. - Create a new ATL transformation module named
Families2ExtendedFamilies.atl
. This transformation should transform each Member to a Male or a Female and set the correct parent/child references. Also add to the abovenoOfChildren
attribute the number of children of each family. - A new policy requires that the transformation output to also indicate if a family is single-parent or not as an attribute (in addition to the
lastName
). Add the necessary setup/rules to enforce this. Use the same transformation module as in Q2.
Use abstract rules, helpers and rule inheritance where possible (e.g. A Member2Person
abstract rule that specifies how a Member instance is transformed to a Person instance, without going into details about Male/Female or parent/child), and make sure you comment your intentions in the code.