1. About SubModel Engine for EMF
The engine provides a set of core functionalities to determine how models relate according to the submodel relationships, ranging from simple inclusion of elements sets to invariant submodels as defined in the paper : From subsets of model elements to submodels, a characterization of submodels and their properties.
The engine enables representing metamodels in addition to models using the same unified formalism. It also ensures consistency of the typing relationships (under a function called meta) between models and metamodels.
These concepts are defined in the paper: On submodels and submetamodels with their relation, a uniform formalization through inclusion properties
The functionalities provided by this engine enable:
-
to determine if an input model includes all the elements of a second input model;
-
to determine if an input model is a closed submodel of a second input model;
-
to determine if an input model is a covariant submodel of a second input model;
-
to determine if an input model is an invariant submodel of a second input model;
-
to get the strongest relationship between two models if it exists;
-
to compute the closure of a model with respect to a second one.
-
to compute the submodel of a model (model extraction)
-
to determine if a model is a member of a metamodel;
-
to determine if a model is a well formed model of a metamodel;
-
to compute the proper metamodel of a model;
-
to compute the model projection of a model according to a metamodel Model projection relative to submetamodelling dimensions
This engine is extensible and can be easily customized to work with multiple metamodels given that models conforming to a metamodel can be transformed in the formulation retained in the mentioned paper, that is as a set of model elements and a partial order derived from their dependency constraints.
2. What’s new in release 1.3.0
Compared to previous available release, the set of Eclipse Plugins embedded in this release includes many improvements and new features. That is summarized by the following figure (new features are written in bold while improved features are written in italic):
The core component provides the functionalities mentioned above and made them available as a service to the rest of the platform. This service is automatically recorded in the registry of all services available in the platform. EMF Model adapters are components that extend the engine for specific metamodels. They are recorded in the plugin registry and are discovered automatically by the core component. Currently, three EMF model adapters for the engine have been developped for the engine: Ecore Model, UML class diagram and collaboration diagram.
Improvements are the following:
-
the implementation of a projection operator which builds a submodel according to submetamodel dimensions.
-
the possibility for any EMF adapters to provide an export operation from a model described in our formalism into a new EMF model. This functionality was made possible by an enhancement of our submodel engine which can now preserve the link between a source EMF EObject and one or many model elements of our formalism (depending on the chosen model mapping).
-
the architecture of EMF adapters was streamlined. Any contributor can dynamically add an EMF adapter that handles all or part of functionalities (export function, meta support). From a client point of view, an important need is to easily retrieve the most appropriate adapter based on the capabilities offered. These required dimensions of flexibility and dynamic capabilities were achieved through OSGI services and the application of the "Chain of responsibility" design pattern (right of the figure Overall Architecture of Eclipse plugins).
-
the submodel engine now supports descriptive metadata of the models it manages. While being extensible for any kind of model information, predefined metadata are the EMF model location, the creation date and other useful details such as the operator used (if any) to build the model and the original source model from which it is derived.
The release also includes two end-user applications that are both Eclipse views (see End-User Applications for further details)
3. Installation
Submodel Engine requires Eclipse Neon (4.6) or higher.
Submodel Engine is distributed via an update site that allows you to easily install and receive updates:
-
Open Eclipse and select from menus Help > Install New Software…
-
Click Add…
-
Enter the following:
Name: |
Submodel Engine |
Location: |
-
Click Add.
-
uncheck the Group items by category box (bottom of the window)
-
Appearing under name should be "Submodel Engine Feature", check the box next to it.
-
Click Next > twice.
-
Accept the license agreement and click Finish.
-
Plugins are NOT digitally signed. Install them anyway.
-
Accept to restart Eclipse to make the changes effective.
4. Using Submodels Plugins
There are 3 submodel plugins for Java developers:
Plugin name | Description |
---|---|
fr.cristal.caramel.submodel.wfm |
Submodel Engine |
fr.cristal.caramel.submodel.compare |
Submodel comparator |
fr.cristal.caramel.submodel.adapter |
EMF adapter architecture |
According to the kind of Eclipse project, the configuration differs.
4.1. In an Plug-in Project
In case of a Plug-in Java Project:
-
Open the MANIFEST.MF file with the Plug-In Manifest editor
-
Select the Dependencies tab and add the 3 submodel plugins
4.2. In a Java Project
First, you have to create a user library:
-
Select from menu Window > preferences
-
From the preferences window, click on the Java > Build Path > User Libraries
-
Click New…, enter "Submodel Library" and click Ok
-
Click on Add External JARs… and add the 3 plugins to your new library
-
Click on Apply and Close button
Eclipse can store its plugins in its installation directory ($ECLIPSE_HOME$/plugins/) but some versions of Eclipse store plugins in a shared repository (ex: ~/.p2/pool/plugins) |
Now, you can add this library in any Java Project:
-
Right click on your project and go to the build Path > Configure Build Path > Select Java Build Path (on the left part) and the Libraries tab
-
click on Add Library…, then select User Library and click Next>, check Submodel Library and click Finish and Apply and Close
5. End-User Applications
Once plugins installed, select Window > Show View > Other… > Submodel Category to add the two Eclipse views described below.
5.1. The Meta Filter View
This Eclipse view allows to easily build new submodels of any kind according to metamodel constructs. Figure Annotated snapshot of the Meta Filter View shows a annotated snapshot of the Eclipse Meta Filter view.
The behavior of this software is as follows. When an EMF model m is selected in the Eclipse workspace, the submodel engine searches for the appropriate EMF adapter and then imports and analyses this model. The top part of the view (see mark 1 in the figure) shows the name of the model as well as its recognized metamodel M (here, a UML file in the example of the figure).
The lower part of the view is dedicated to metamodels ( 2 ). When m is detected, the following metamodels are loaded: the metamodel M of m, its proper metamodel (created by default) as well as all the sub-metamodels of M located in the current Eclipse project. Metamodels are represented in their EMF tree form and each EMF model element is selectable. Further sub-metamodels can be added/remove in this lower part ( 4 ).
It is possible to enable/disable the well-formed mode ( 3 ). When this mode is set to "On", only the invariant sub-metamodels of M are available.
This view allows you to build new EMF sub-metamodels ( 5 ) from the selected elements of the current metamodel. When the well-formed mode is set to "On", the sub-metamodel constructed by the extraction operator is made from a closed set of elements in M implying that the resulting sub-metamodel is an invariant one of M The resulting metamodel called subM can optionaly be exported to a new EMF ecore file or be directly used to generate and edit the projection model of m with regards to subM ( 6 ).
5.2. The submodel visualization tool
This Eclipse view provides a graphical representation of submodel relationships existing within a selection of models or model fragments.
To add a model into this view, you just have to drag and drop an EMF (meta-)model of the Eclipse workspace into this graphical space.
The content of the view is obtained by using the engine functionality for computing the strongest relationship between added models, each kind of resulting relationship being represented by a distinct color.
Supported kind of relationships are as follows:
-
submodel relationships (included, closed, covariant and invariant)
-
submetamodel relationships (member, wellformed)
-
operator relationships : thanks to metadata, the tool shows the used operator (if any) to build the model.
Figure Tool for visualizing submodel relationships presents a snapshot of this tool
As shown in the figure, the tool organizes all the selected models in a network of relationships that are computed thanks to the engine and displays this network graphically. Among other features, the tool allows to filter the network on a specific relationship and allows to reduce the focus on a particular model while navigating from one model to another inside the network. In addition, the tool gives the capacity to increase or reduce the set of selected models so that they can be compared dynamically.
6. Java Tutorial for the Submodel Engine
Click here to access to the Java Tutorial for the Submodel Engine