Translating KM3 into SQL DDL using AMW and ATL - HowTo

This example is a complete bridge between KM3 and SQL DDL (Data Definition Language) that uses injection, extraction, weaving and transformations. It is similar to the example that transforms SQL to KM3, but in the opposite direction.

This example contains a weaving model between a KM3 metamodel and a SQL DDL metamodel. It uses the same metamodel extensions as the ones used to transform SQL into KM3. The weaving model is used to produce an ATL transformation that translates KM3 models into SQL models. We used a KM3 file generated by the example "Translating SQL into KM3".

Most part of the ATL transformation is also used to generate the files of the Atlantic SQL DDL Zoo.

Instructions

Loading the weaving model into AMW:

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

When using the wizard, there are two metamodel extensions that need to be loaded : "mw_base_ext" and "metamodels/mmw_sql_km3". The complete weaving metamodel is saved at metamodels/mmw_sql_km3.ecore
This step is not necessary to execute the transformations.
Left metamodel: metamodels/KM3.ecore.
Right metamodel: metamodels/SQLDDL.ecore.

Executing the transformations

There is an Ant Script (scripts/executeAll.xml) that takes the models/mantis.km3 file, and automatically produces a .SQL file. It executes the following actions:

Remarks: