This page contains a list of problems related to ATL usage. It gives hints towards solutions and links to examples.
How do I generate text from models?
There are several possibilies. We only detail some of them here.
You can specify a query over your model in ATL. An example of this is available in the UML2Java transformation.
The atlanticRaster zoo is also using this technique. It first transforms KM3 metamodels into DOT models with the KM32DOT.atl transformation. It then uses DOT2Text.atl to query a String from the DOT model. This string corresponds to the generated DOT code. Then, the build.xml ant scripts makes use of the am3.saveModel task with an ATL extractor pointing to the DOT2Text.atl transformation.
TCS (Textual Concrete Syntax) is a tool enabling the specification of textual syntaxes for metamodels. Once such a syntax has been specified, models can be serialized to text files.
One advantage of TCS is that text can also be parsed into models. It is therefore possible to use the same specification to enable the definition of models with any text editor.
How do I launch transformations programmatically?
The ATL development environment (ATL Development Tools, or ADT) provides several means to launch transformations:
- by specifying a launch configuration,
- by writing an ant script using the AM3 Ant Tasks.
However, in some cases, it is necessary to launch an ATL transformation from Java code. The AtlLauncher class can be used for this purpose. The KM3Projector class of the KM3 plugin contains example usages of the AtlLauncher class (e.g. the getEcoreFromKM3 method).
Remark: the AtlCompiler class may be used to compile ATL transformations into .asm files executable on the ATL Virtual Machine.