Annotating EMF models made easy with EMF Profiles
Have you ever been in a situation in which you would like to annotate an EMF model with additional information, but the last thing you wanted to do was to change its metamodel to made that possible? We bet the answer is yes for almost everybody that has been using EMF for a while. EMF Profiles is here to help you!
There are many reasons why changing the metamodel is not desired both organizational (e.g., the additional information is only needed for one particular project and you don’t want to pollute others) and technical (e.g., avoiding the tedious task to recreate the graphical modeling environment and migrate already existing models to the new metamodel version).
EMF Profiles is an open source project to solve this situation providing a light-weight model annotation mechanism that obeys the following five design principles:
- Annotation of models should be as light-weight as possible, hence, no adaption of existing metamodels should be required.
- Pollution of existing metamodels with project-specific information must be avoided.
- Separation of concerns between the annotations and the original model is needed to allow importing only those annotations of current interest for a particular modeler in a specific situation.
- Avoidance of proprietary formats: annotations should be treated like normal models.
- Intuitive model annotation mechanism. Modelers should be able to use the environments and editors they are familiar with.
As a way to realize these five design principles in EMF Profiles, we adapted the idea of UML Profiles to general EMF models. Love them or hate them, but UML Profiles have been a key enabler for the success of UML. Similarly as UML Profiles allow for extending the UML metamodel, EMF Profiles enable extending any Ecore-based metamodel by means of Stereotypes and Tagged Values. Stereotypes may be applied on EMF Models in any EMF tree-based editor or any GMF-based diagram editor. EMF Profiles just use standard extension points of both to integrate seamlessly with them. Same for setting tagged values, they are just set like normal feature values in the property view.
In this presentation, we will demonstrate how EMF Profiles can be used in every-day modeling activities. In particular, we will present how arbitrary models can be annotated easily for model review purposes, as well as how EMF Profiles allow you adding additional information to existing models for generating more complete code.
More information on EMF Profiles, as well as screencasts may be found at the project homepage, the EMF Profiles post at the modeling-languages.com blog, and the slides from previous presentations at TOOLS 2011 and EclipseCon NA 2012 Modeling Symposium.