A pattern is a general solution to a recurring engineering problem. Patterns are a very valuable part of the knowledge of domain experts, where the domain can be Software, Hardware, System design, or a specialty engineering discipline such as Safety, Security, Performance, etc. When engineering relies on modeling, a pattern naturally manifests itself as a recurring modeling principle - or modeling pattern.
The EMF Diff/Merge Pattern technology provides tool support for the creation, application, evolution and management of modeling patterns. The aim is to better share and disseminate the know-how of experts at the modeling level, hence contributing to productivity and quality in model-based engineering activities.
Concretely, a pattern consists of a set of elements and their interconnections, and a set of roles that associate some of the pattern elements with OCL constraints. Applying the pattern consists in binding all roles to existing model elements: the model elements and the pattern elements associated to the roles are merged while the remaining pattern elements are added in the model together with their interconnections. The model conforms to the pattern as long as all pattern elements and interconnections have counterparts in the model, and the model elements that are bound to roles conform to the OCL constraints of the roles. There can be several occurrences of the same pattern in a model and the same model element can play different roles of different patterns.
A major strength of the technology is its ability to let end users define patterns declaratively, solely based on diagrams and wizards, without programming, while providing the expressive power for dealing with classical architecture or design patterns. This is made possible by the EMF Diff/Merge engine.
The technology can be integrated into any EMF-based modeling environment. In addition, it can leverage Sirius-based environments to handle the diagramming aspects of modeling patterns such as layout and style. Albeit independent of modeling languages, the technology can be customized for a specific language or environment in order to improve the user experience.
The technology is integrated for example into the Capella modeling solution.
It has been partially funded by the ITEA MERgE project.
Patterns in Capella:
Patterns in UML Designer:
A pattern can be created from model elements or diagrams and stored in a catalog, which is a separate file. As a result, the model elements form the first instance of the pattern. The pattern can be applied at a specific location in the same model or in a different one, which gives birth to a new instance. When a pattern is applied, each of its elements is added into the model or merged with an existing element of the model. "Merged" means that the properties of the two elements are combined.
Patterns and instances have their own separate life cycles, but they can be synchronized whenever needed. Concretely, it is possible to check that an instance still conforms to its pattern and have an overview of the differences. If there are differences, the instance can be updated according to the last version of the pattern. Conversely, every instance can also be used for updating the pattern, thus allowing other instances to be updated accordingly.
The most notable features of the technology are:
- The storage of patterns in catalogs and their reuse throughout models.
- A pattern/model synchronization mechanism supporting the update and lifecycle management of patterns.
- The ability to validate that a model still conforms to patterns and to visualize pattern violations.
- Navigation and overview facilities for understanding the usage of patterns in complex models.
- Mechanisms for the semi-automatic application and creation of patterns based on OCL queries.
- Download: with EMF Diff/Merge up from release 0.4.0. Beware that using the tool in a new modeling environment is likely to require a new customization.
- GitHub project: the source code on GitHub
- Build: the location where the project is built