Skip to main content

AMW Use Case - Aspect Oriented Modeling

AMW Logo

This use case demonstrates how AMW is used as an aspect oriented modeling solution to weave a generic communication protocol with specific communication types (this example is inspired on the paper of Florian Heidenreich et al.).


In aspect oriented modeling, the program with the main business logic and the cross cutting concerns are represented by models. There are many cross cutting concerns that are not part of the problem, such as security, logging, persistency, etc. Differently from traditional aspect oriented programming, in aspect oriented modeling there is no preferential entity. This means the weaving can be done in any model (e.g., weavings in the business models or in the cross cutting concerns).

The weaving operations are defined in a weaving model. The weaving model conforms to a weaving metamodel, which defines different kinds of possible links between the models. The links are domain specific, i.e., aspect oriented links. For example, create attribute, create method, add after, delete, merge, etc. The weaving operation is non invasive, i.e., the models remain unchanged.

Consider a simple example with two simple metamodels, MM1 and MM2. MM1 describes a simple and generic communication protocol (the core model). MM2 defines attributes of specific communicaiton types, such as Email, SMS, telephone, or fax (the advice model). The goal is to weave the generic protocol with the communication types.

The first step is to create the weaving operations as as extensions of the core weaving metamodel. The AOM extension takes into account three main issues:

  • Where to weave: the elements that can be woven are defined as extensions of WElementRef
  • How to weave: the different kinds of links are extensions of WLink
  • How many models to weave? It is possible to weave several models. This is defined in the extensions to WModel

In the illustration in Figure 1, the metamodel extension defines only one core model, because the advice could be defined directly as extensions of the weaving metamodel.

1. Extension to WModel

To add a second model, a new reference is included. The AMW plug-in handles this automatically, because the user interface adapts to any extension of the core metamodel (the plug-in automatically generate a set of standard menus based on the metamodel extension).

2. Extension to WModel and adaptive interface of AMW

The metamodel extension of Figure 3 enables to create methods and attributes of a source model into a class of a target model. Each reference points to a different WLinkEnd (Class, Method, Attribute). These references enable to create methods, classes and attributes.

3. AOM extension to WLink

The weaving operation is interpreted in the ATL engine. An ATL transformation matches every type of link and executes the appropriate weaving operation. The "Weave.atl" transformation takes the weaving model, the generic communication model and the communication type metamodels as input and produces a new woven model. An excerpt is shown in Figure 4.

4. Weave.atl

Download and examples


Implementation of the simple communication example using AMW and ATL .


This presentation is a general overview about how Aspect Oriented Modeling is used to solve current AOP problems.

Related use cases


Matching is the generic process that creates weaving models. This use case gives a general overview of the matching process, and how it is handled by AMW and ATL.

Florian Heidenreich and Henrik Lochmann. Using Graph-Rewriting for Model Weaving in the context of Aspect-Oriented Product Line Engineering. In Proceedings of the First Workshop on Aspect-Oriented Product Line Engineering (AOPLE'06) co-located with the International Conference on Generative Programming and Component Engineering (GPCE'06), Portland, Oregon, October 2006. (download)

Back to the top