Skip to main content
Jump to: navigation, search


< To: AMW

This is the AMW wiki FAQ.

How to create weaving metamodel extensions?

The AMW prototype is developed based on the core weaving metamodel. The weaving metamodel extensions that are used by the prototype must extend this core, or extend other weaving extensions.

We illustrate the development of metamodel extensions using the metamodel extension. This extension is the simplest extension provided by the weaver, supporting generic link management.

The following classes of the core metamodel can be extended: WModel, WModelRef, WElementRef, WLink, WLinkEnd, WElementRef.


The WModel extensions are the root element of a weaving model. The references leftModel and rightModel refer to the woven models. They must subset the wovenModel reference from the core weaving metamodel.

The subsets annotation means that these references are derived from the wovenModel reference. The AMW prototype uses this annotation to load the woven models correctly.

class Model extends WModel {
    -- @subsets wovenModel
    reference leftModel container : WModelRef;
    -- @subsets wovenModel
    reference rightModel container : WModelRef;

Obs.: The annotations must be defined after a blank line. This is due to some limitations on the parser.


-- @welementRefType ElementRef
class ModelRef extends WModelRef {
-- @welementRefType ElementRefXMI
class ModelRefXMI extends WModelRef {


-- @wmodelRefType ModelRef
class ElementRef extends WElementRef {
-- @wmodelRefType ModelRef
class ElementRefXMI extends WElementRef{


class Link extends WLink {
   -- @subsets end
   reference left container : WLinkEnd oppositeOf link;

   -- @subsets end
   reference right container : WLinkEnd oppositeOf link;


class LinkEnd extends WLinkEnd {

What are the dependencies of AMW? Which are the other plugins that should be installed?

AMW depends on two plugins from ATL and AM3 plugins:

  • org.atl.eclipse.engine
  • org.atl.eclipse.km3

However, it is advisable to install all ATL and KM3 plugins, because AMW contains complex scenarios that use all the components of the AMMA platform, such as ATL transformations, or AM3 Ant Tasks.

Where can I find more information about the model management tasks used in AMW examples?

More information can be found in the AM3 Ant Tasks page.

Which version of AMW, AM3 and ATL should be installed to avoid version problems?

The required versions of the three plugins are mentioned in the corresponding download pages: AMW, AM3, ATL.

Why the menu "Extract ATL-0.2 model into ATL-0.2 file" does not appear when I try to extract an ATL model that was created from a weaving model?

Specific extraction and injection menus are available only in the "AM3 Resource Navigator", not in the "Package Explorer" view.

Why I have an "antlr/tokenstream" error?

AMW depends on the ATL plugins. So the ATL engine must be installed follwing the ATL installation guide. This error happens because the ATL engine cannot find antlr.jar. This file must be copied in "lib" folder of "org.atl.eclipse.engine" plugin.

How to develop higher-order transformations to transform a weaving model into a transformation model?

This answer uses the ForeignKey2Nested example as illustration.

The main requirement is to know well the input metamodel (the weaving metamodel) and the output metamodel (the ATL metamodel). The weaving metamodel varies according to the application scenario. The ATL metamodel is fixed.

In the example, the weaving metamodel is created based by the right metamodel, i.e., with nested structure. The weaving model has "Nested" subjects (which is under a link between "BookRcd" and "Book"). Then, we have the input values as equality of "FK"s.

So, usually there are extensions of "WLink"s and "WLinkEnd"s in the weaving metamodel, and rules, input and output patterns in the ATL metamodel.

Consider this simple example:

module A2B;
create OUT : B from IN : A;

an ATL has a "Module" as root element. A module has a "name". Than it has the input and output models and metamodels (In, A, OUT, B).

After that, a module contains a set of rules:

rule A2B { <- this corresponds to a "rule" in the ATL metamodel

  in : A!Class  <- this is the "input pattern"
  out : B!Table ( <- this is the "output pattern"
     name <-,     <- these are the "bindings"
     value <- in.value    <- bindings

The initial part (module and input models), is usually fixed, so they can be created using a single rule.

- The rules will be based in the weaving model, so WLinks and its extensions in rules. In the keys to nested example, this corresponds to the "ElementLink" element. - The input pattern is a "left" WLinkEnd. - The output pattern is a "right" WLinkEnd.

The bindings are child links ("Equals" are bindings).

Finally, one hint to better understand the ATL metamodel (that is a key point) is to write a simple transformation by hand and to click over some element in the debug mode. The outline in the right shows the corresponding model elements.

Why the weaving panel raises an exception when I create a new weaving model using an Ecore metamodel and not a KM3 extension?

It is not possible to extract a weaving metamodel that was completely created in KM3 (mwcore + extension) using the AM3 menus. The weaving metamodel contains specific annotations that are not yet handled by the injector (this will be corrected).

To be able to load a weaving metamodel from an Ecore file, it is necessary to extract the metamodel using the menus available in the weaving panel.

Back to the top