Figure 5.13: Helper view, used to connectsubSystemswithcomponents
complete overviewoption, is especially useful for a quick overview of the complete system. Besides, it
enables the user to connect the different sub-systems with internal relationships.
Figure 5.14: Context model in specifiction(black box) mode
5.3
Structural view extension
nAOMi currently only supports part of the structural view. One of our goals is to extend this view such that it is fully functional. By doing this together with introducing the context view, two functional views will be available to analyse and edit the system.
The original metamodel for the structural view is shown in Figure 5.15. This metamodel contains asub-
jectComponent, which is connected to acomponentby anaquiresrelation. ThesubjectComponentrefers to
the component that has been selected in the dimension explorer of nAOMi. All the components connected
to thesubjectComponentare modelled as normal components. Furthermore, the metamodel only supports
one of the four possible association relationships. By using this metamodel for the structural view, the func- tionality of this view is limited, since three out of four associations can not be represented. Besides, the
acquiresassociation is modelled between asubjectComonentand acomponent, meaning it is not possible to
create this connection between twocomponents, although according to the SUM metamodel this connection
44 CHAPTER 5. CONTEXT VIEW DESIGN
Figure 5.15: The current structural view metamodel
In order to solve this problem, the metamodel for the structural view needs to be replaced by the ’structural’
part of the SUM metamodel, which is shown on the left side ofstateContainment in Figure 5.11. This
enables the complete utilization of all possibilities of the structural view, and models the view as it was originally intended.
5.4
Conclusion
In this chapter we discussed the modelling implementation of the additional view. We started with a view selection procedure were we tested a sequence diagram and a context diagram based on the defined crite- ria. During this process we found that generating the DSL representation for the sequence diagram was impossible with the current functionality of the visualization editor. Since the context diagram met all the criteria, we chose to extend nAOMi with a context view. The implementation of this view consists of three steps, which have all been discussed in detail. First we designed the context metamodel and showed how its instance model looks like. Since the instance model was still shown in the LML representation, we designed a customized DSL representation to show the context view in its intended representation. Next we extended the SUM metamodel with our context metamodel, to allow the view to be used in the SUM-based envi- ronment. We looked into the alternative representations that are especially useful to give a clear overview of the system. Finally we briefly discussed the extension of the structural view, which is now completely supported.
Chapter 6
Model transformations
This chapter discusses the transformations necessary to implement an additional view, as well as the trans- formations to extend the structural view. We start by introducing ATL, which is the transformation language used to write our transformations. After that we examine the transformation chain, which shows the order in which the different transformations are executed. Next we discuss the transformations in detail, by explain- ing some parts of the transformation code. Since most transformations have similar functionality not all transformations will be discussed in depth. In total, there are seven transformations, of which the complete code can all be found in Appendices A to G.
6.1
ATL
All transformations are written in the ATLAS transformation language (ATL) [24]. ATL is a popular trans- formation language, initially designed for MDE model transformations. Traditionally, it does not support multi-level model transformations. However, an ATL extension had been developed to support multi-level transformations, which is used by nAOMi. ATL is a hybrid language that uses both imperative as well as declarative programming, though most of the transformations consists of declarative statements. The mainly
used concepts of ATL arerules,lazy rules,guardsandhelpers.
1. Rules: Rules are statements that match certain components of the source model to components of
the target model. Listing 6.1 shows two rules, namelyactorandrelationshipFrom. Each rule consist
of afrom, toand optionally adosection. The fromsection defines which component of the source
model should be transformed, and can contain possibleguardsto add requirements to the rule. Theto
section defines the target component, and contains the mapping of the source attributes to the target
attributes. Finally, thedosection is the imperative section, and is executed when the rule is finished.
Thedosection is often used to perform certain statements that are hard to achieve in the declarative
section.
2. Lazy rules: Lazy rules are similar to rules, but can be called from other places, whereas normal rules are only performed when matched components are found in the source file.
46 CHAPTER 6. MODEL TRANSFORMATIONS
3. Guards: Guards are statements that can be added to thefrom section of a rule. Guards add extra
requirements to the execution of the rule. For example, the rule actor in Listing 6.1 contains two
guards at line 3. The actor is only transformed when either of these guards return true.
4. Helper: Helpers are used to define methods or attributes that can be called from other places in the
transformation. Listing 6.1 contains several calls to helpers, all starting withthisModule. Please note
thatthisModulecan also be used to call lazy rules. Listing 6.3 shows several helpers. Each helper
starts with ”helper def”, followed by its name, type and value.
Besides these main concepts, ATL uses attributes, collections and other concepts that are not discussed in detail. During the explanation of the different transformation, we will explain these concepts if found necessary to understand the transformation.