Skip to main content
October Donation Campaign Donate Now

Transformation of relational tables into nested structures - HowTo

This example contains an extension of the core weaving metamodel to create correspondences between a metamodel with flat structures and foreign keys relationshps (as in relational databases) to a metamodel that contains nested structures (as in XML). It provides a HOT (higher-order transformation) that transforms a weaving model into a transformation model.


Loading the weaving model into AMW:

The weaving model (models/FK2Nested_AMW.amw) can be loaded by double-clicking on the file or by using the wizard.

The following metamodel extension needs to be loaded when using the wizard:

  • dbtoxmlweavingmm.km3,

There are some choices that need to be done in the wizard:
  • WModel : DBModel,
  • WModelRefXMI : ModelRefXMILeft, and ModelRefXMIRight, respectively
  • In the page 3/3, it is necessary to select the 'left' and 'right' metamodels to link them with the correponding files.
    Left metamodel: FKMetaSchema.ecore.
    Right metamodel: NestedMetaSchema.ecore.
Remark: The extensions that do not appear directly in the wizard must be choosen using the "Browse in the workspace" button.

Executing the higher-order transformation

The file hot/AMWtoATL.atl is a higher-order transformation. There is a launch configuration file (*.launch) with the input and output models.
The transformation produces a transformation model output_atl/ATL-model.ecore. The output model must be extracted into the ATL concrete syntax (i.e., produce an ATL file). The model is extracted by right-clicking in the ecore model in the "AM3 Resource Navigator" view and by clicking in "Extract ATL-0.2 model into ATL-0.2 file". This action produces the ATL-model.atl file.

Executing the produced transformation

The ATL-model.atl transformation takes the model models/libraryFK.ecore (conforms to metamodels/FKMetaSchema.ecore) as input and it produces models/libraryNested.ecore (conforms to metamodels/NestedMetaSchema.ecore). There is a launch configuration that preconfigures the transformation settings.

Remark: This use case has been updated to be compatible with the latest releases and sources of ATL (ATL2006).

Back to the top