Translating SQL into KM3 using AMW and ATL - HowTo
This example contains a weaving model between a SQL DDL (Data Definition Language) metamodel and a KM3 metamodel.
The weaving model is used to produce an ATL transformation that translates SQL DDL models
into KM3 models. We used an SQL extracted from Mantis bug tracker.
Loading the weaving model into AMW:
The weaving model (models/mw_sql_km3.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
The complete weaving metamodel is saved at metamodels/mmw_sql_km3.ecore
This step is not necessary to execute the transformations.
Executing the transformations
There is an Ant Script (scripts/executeAll.xml) that takes the models/mantis.sql file,
and automatically produces a KM3 file.
It executes the following actions:
injects the mantis.sql file into the SQL model (models/mantis-SQLDDL.ecore) conforming to
the weaving model (models/mw_sql_km3.amw) contains links between the metamodels/SQLDDL.ecore metamodel and
the metamodels/KM3.ecore metamodel,
executes the ATL HOT (hot/AMWtoATL_SQL2KM3.atl) that takes the weaving model mw_sql_km3.amw as input
and produces the ATL model (output/SQL2KM3.ecore) conforming to the ATL metamodel,
extracts the ATL model into an ATL file (output/SQL2KM3.atl),
executes the ATL transformation (SQL2KM3.atl). This transformation takes the mantis-SQLDDL.ecore model as input
and produces the KM3 model (models/mantis-KM3.ecore) as output,
extracts the KM3 model (mantis-KM3.ecore) into a KM3 file (models/mantis-KM3.km3).
The HOT and the SQL2KM3 transformations can be executed separatedly as well.
Each transformartion has a predefined "launch configuration" file.
There are Ant scripts to execute the injection of .sql files (SQLDDLInjector.xml) and
the extraction of ATL models(ATLExtractor.xml). The files in the scripts/ folder are mandatory
files to execute the Ant Scripts.
When the ATL model is extracted into SQL2KM3.atl, the SQL2KM3.asm file is generated by the
ATL engine. It is possible that the executeAll.xml script tries to execute the transformation
before it is extracted (in the first time the script is executed),
causing an error. To solve this issue the script needs to be executed a second time.
This example was updated to be compatible with the latest releases and sources of ATL (ATL2006).