A model and metamodel are consistent when the metamodel specifies every concept used in the model definition. A metamodel can evolve (be adapted by a developer), which can cause inconsistency. We’ve recently added a tool to Epsilon, the HUTN / XMI bridge, that seeks to aid developers in manually managing inconsistency.
HUTN, an OMG standard, specifies a human-usable, textual notation for MOF-based models. Epsilon provides an implementation of HUTN for Ecore-based models. HUTN can be thought of as an alternative concrete syntax to XMI. While XMI is optimised for use by machines, HUTN is optimised for use by humans. We discuss HUTN in more detail in this paper at MoDELS 2008.
We have recently extended our HUTN implementation to include an XMI bridge, which allows us to generate HUTN source code from EMF models. Furthermore, the HUTN / XMI bridge can be used to report inconsistencies between a model and its metamodel, and to resolve those inconsistencies using a human-usable notation.
To demonstrate the HUTN / XMI bridge, here’s a short example. Below is an exemplar metamodel, along with a sample model:
Channel B has ConnectionPoint both?! as its reader and as its writer.
Suppose we now wish to make distinct ConnectionPoints that are used for writing and ConnectionPoints that are used for reading. We may elect to change our metamodel, as shown in the diagram below:When we try to load our model with EMF, we receive a single error, stating, for example, that “The class ‘ConnectionPoint’ is not a valid classifier.” By contrast, the HUTN/XMI bridge is able to produce a complete list of the inconsistencies:
(Produced by the Check Consistency option, available by right-clicking a .model file).
To aid developers in resolving consistency, the HUTN / XMI bridge can generate HUTN from a model’s XMI, even when that model is inconsistent with its metamodel:
Once there are no further inconsistencies, HUTN can be used to generate a model that is now consistent with its metamodel.
The HUTN / XMI bridge is a tool for manually managing inconsistency between models and metamodels. There are situations in which an automatic approach is more suitable. For example, perhaps you have a large number of inconsistent models. In those situations, we’d recommend using a different tool, such as COPE. You may also be interested in Antonio Cicchetti’s work; Cicchetti advocates a fundamentally different approach to the one used in COPE.
If you’d like to try the HUTN / XMI bridge, it’s available from the Epsilon SVN repository (access instructions). It will also appear in the upcoming 0.7.5 HUTN release*. We’ll be adding new features and fixing problems per user requests – do drop by the Epsilon newsgroup if you have questions, problems or suggestions.
* [Update 27/04/09] The HUTN XMI Bridge is included in HUTN 0.7.5, which was released today, as part of Epsilon 0.8.5.