Main Page/Resources/Wires*/Tutorial

From Atenea

Jump to: navigation, search


A Simple Case Study

A brief overview of the Wires* tool is provided and the user will be guided through a simple step-by-step example of Wires*. A simple metamodel for Enterprises is considered. This metamodel describes a company and its employees:


In the example, a government decides to protect Small and Medium-sized Enterprises. This new policy forbids the establishment of businesses whose staff exceeds 10 employees. The objective is to design a chain of transformation using the graphical notation provided by Wires* to comply with the law regulation. For this purpose, we have designed an ATL transformation that divides one business into two small ones. This transformation wil be applied only to enterprises with more than 10 employees.

Creating a Wires* Project

The file contains the Wires* project with all the example related files. The zip is organized as follows:

  • Wires. The ATL project that contains (in different folders) all the resources .
    • inModels. It includes the Enterprise input model.
    • ModelTypes. It contains the Enterprise metamodel.
    • outModels. The folder where the output model will be stored.
    • TransformationTypes. It includes the ATL transformation files.
    • WiresModel. It contains the solution to this problem: the Wires* models and diagrams. Please ignore these files to follow the tutorial.


Creating a Wires* Model

Once we have all the coresponding models, metamodels, and ATL transformatons, we are ready to create a new Wires* Diagram for solving the problem. For this purpose, the user should move to the navigator view and select with the mouse right click->New->Examples->Wires Diagram, then click on Next and give names to the diagram (a .wires_diagram file) and to the model (a .wires file) represented by the diagram. In particular, we will create two Wires* diagrams: a types diagram, including the types definition, and an execution diagram, including the chain of ATL transformation's executions.

Designing the Types Diagram

The next step is to defined the types of our models and transformations (including queries). For this purpose, we need to create a Model Type (for the Enterprise Metamodel), an Atomic Model Transformation Type (for the Divide transformation), and a Query Type (for the Workers query) in the types diagram. We use the palette on the right to draw these elements. In the Properties view, for each element, users need to indicate the type name and the file's path.


Firstly, we draw a Model Type element. We set its name and path in the properties view. To fill the path gap we have to select the Enterprise metamodel file (Enterprise.ecore).

Then, we draw Atomic Model Transformation Type and Query Type elements. For these elements we select the Divide.atl and Workers.atl files, respectively, in their path properties.

The Formal parameters appear automatically when selecting the transformation path for Atomic Model Transf Type, but do not appear for Query Type. To create them manually just hover the mouse pointer over the Atomic Model Transformation Type or the Query Type and select the Input Formal Parameter and Output Formal Parameter icons. If we select these created elements, we can edit the name and type of the transformation input and output in the properties perspective. We have to fill the Name, TypeEl (the model type which the input or output model should conforms to) and Type Name properties. So, for Query Type, create one Input Formal Param name it "IN", select Model Type Enterprise as typeEl and type "Enterprise" as Type Name. Finally, create one Output Formal Param name it "OUT", select Model Type Integer as typeEl and type "Integer" as Type Name.

Designing the Execution Diagram

Now all the types are specified, so we are going to create the diagram that describes the sequence of execution strictly speaking. For being able to select the types from types diagram in this one we have to load the types resource. To do that just right click in the instances diagram canvas and click "Load Resource ...". Then select the types diagram file.


First, we draw a Model element and edit its properties. We have to fill in the Name, Path and Type properties. We select the model file (model.enterprise) in the Path gap and the Model Type Enterprise value in the Type gap. The next step is draw a Query element and select the Query Type WorkersType value in the Type gap. The actual parameters will be created automatically but we can edit them too. Last step is drawing a Data Flow element to join the model with the query input parameter.


Next step corresponds to the specification of the Decision Node. Decision Nodes are useful tools for helping you to choose between several courses of action. This element has a condition and two branches associated. Its condition determines which branch is taken for the routine execution. Note that the Input Actual Parameter takes the query output value and it is used in the Decision Node condition. It is identified with the same name in the condition and in the Input Actual Parameter, which has no Type.


At this stage, we are going to create the two courses of action. If the Decision Node condition is false, the input model is going to be duplicated. Otherwise if the condition is true an ATL transformation is going to be executed. This transformation is named Divide.atl and it splits an enterprise in two smaller enterprises.


It is necessary to create a model element to represent the output transformation model. We select its type property and its path (by typing the workspace relative path) in the properties perspective.

We use the Identity Transformation element of the palette to duplicate the input model. This element and its input and output parameters have not type. We use Data Flow elements to join its Input and Outputs Actual Parameters to input and output models elements respectively. Note that the input and the output parameter should have the same name.

Next step is to draw an Atomic Model Transformation element. In the properties perspective, we have to select the DivideType in the Type gap. Using Data Flow we join the input model with the input parameter of the transformation, and its output parameter with the output model.

As last step move to the navigator view and select mouse right click in "workers.wires" and select “Execute Wires* Model”. The "outModels\out.enterprise" file will be generated! You can try changing the Decision Node condition to get different results.

Personal tools