EMF Styling
EMF Styling
EMF Styling is a model (Ecore based) customization/styling/refining CSS like textual DSL targeting MDSD tool chains end users.
The motivation is to address the problem of customizing intermediate models in a Eclipse EMF based MDSD toolchain such as Acceleo or openArchitectureWare in order to be able to do incremental model generation while preserving user model refinements. Indeed, currently, there are solutions to customize generated text with user code in model to text (M2T) transformations using either protected code regions or inheritance. But, as of today, there doesn't seem to be any such equivalent for customizing generated models in model to model (M2M) transformations which is both freely available, simple to use and aimed at MDSD end users.
The goal is not to create yet another full blown transformation language, it targets end user developers who are not familiar at all with metamodeling and model to model transformation languages. It therefore looks like CSS, and keeps its semantics: cascading, id selectors, type selectors, ... .
Screenshots of an example
This is a DDL customization scenario. Imagine the ddl/ddl1.xmi
is an intermediate model in a MDSD toochain (maybe a PSM in MDA terminology). It is generated from whatever PIM and is supposed to be itself transformed into concrete SQL DDL scripts. Let's suppose you want to customize that intermediate ddl model:
|
|
|
Overview |
Model code completion |
MetaModel code completion |
Source code for the illustrated sample is here:
https://scm.ops4j.org/repos/ops4j/laboratory/users/cedric.vidal/emfstyling/examples/trunk/biz.vidal.emfstyling.examples/
Building and running EMF Styling
There is no release yet. You need to build it yourself to play with it right now. In order to run it, you need to:
- Download openArchitectureWare 4.3 with the Xtext version bundled with it, not the version from Eclipse TMF. Personally, I used this oAW Update Site on a Eclipse 3.4 Classic, but it should also work with other installation methods.
- Checkout plugins from https://scm.ops4j.org/repos/ops4j/laboratory/users/cedric.vidal/emfstyling/sources/trunk/
- Start a new Eclipse application run configuration with all EMF Styling plugins active
- In the runtime workspace, checkout the examples project here https://scm.ops4j.org/repos/ops4j/laboratory/users/cedric.vidal/emfstyling/examples/trunk/biz.vidal.emfstyling.examples/
- Currently, the
ddl
and theentity
examples work. But, first, try the ddl example. - In order to run the ddl example, right click on
ddl/ddl1.oaw
and selectRun As > oAW Workflow
- File
ddl/ddl1-customized.xmi
should be generated as illustrated in the above overview screenshot.
Status
Alpha. This is a proof of concept. Anything might change anytime.
Limitations
Supported property types
Currently, only string properties are supported. If you attempt to define a property which is of any other type, you'll get an exception. This will obviously be fixed.
Input model refresh
Sometimes, the editor doesn't "see" modifications made to the input model to customize after it has been loaded a first time. I need to investigate this. If anybody knows how to solve that issue, please tell me, I'll correct it right away.
Rendering
If the metamodel of the input model is complicated or awkward to use like UML, then it might be awkward to customize using EMF Styling as well. This is because, EMF Styling uses pure reflection in order to discover the model and its metamodel and has absolutely no prior knowledge of them, so it cannot guess what's the best way to render them.
In the future, if a Xtext based textual editor is already registered in the platform for the input model, then EMF Styling might try to delegate to it the rendering of elements and attributes so that they look more like expected.
Validation
Because EMF Styling uses pure reflection, it cannot currently guess what are the validation constraints of the input model. Hence, using EMF Styling, it is possible that the customized model might end up not being valid respective to its metamodel.
In the future, EMF Styling might try to integrate with EMF Validation in order to detect if validation handlers are registered in the platform for the input model in order to narrow the content assist to avoid producing invalid models.
Specifying what's customizable
Currently, this is not possible. EMF Styling uses pure reflection and allows to customize all properties of all elements of any type in the input model.
In the future, an intermediate specification DSL might be introduced in order to specify what's customizable or not.
Source repository
https://scm.ops4j.org/repos/ops4j/laboratory/users/cedric.vidal/emfstyling/
FAQ
Doesn't another language/tool already do this ?
Sure, oAW already has XWeave which is great but is way too complicated and powerful for MDSD end users. What's more, as far as I know, XWeave and most of M2M transformation languages (ATL, Xtend, Obéo Acceleo Pro Transfo, QVT? ...) work at the metamodel level whereas this DSL works at the model level.
What's more, because typical M2M languages have to explicitely reference input metamodels, a given transformation cannot address any metamodel. Whereas, this DSL makes it possible to customize a specific element in the input model whatever its metamodel is.
Authors
Cédric Vidal, J2EE and MDA Architect at ProxiAD