| [news.eclipse.modeling.m2m] Re: [ATL] Re-usable modules with metamodels as formal parameters? |
On 2007-03-19 11:39:51 +0100, Dennis Wagelaar <dennis.wagelaar@xxxxxxxxx> said:
Superimposition cannot do *exactly* what you want. It can work for you, if it's possible to use the same meta-model and model names (IN, OUT, MB, MA, etc.). In this case, you can define a general transformation module with the common transformation rules already in there. Then, you define another transformation module with some specific rules (and perhaps additional models/meta-models), which you can "superimpose" on top of the general transformation module.
Hi Dennis,
thanks for the update.
Superimposition is not exactly what I need because my metamodels are really different. They contain different metaclasses, only some of which are common across several metamodels. This is why I really need formal parameter substitution at ATL compile time, not superimposition at load time.
To give you an example:
AndroMDA generates code for enterprise applications in Java or C#.
AndroMDA has one metamodel (EnterpriseApp) for enterprise applications, it contains a Service and an Entity metaclass. Services and Entities can have methods with parameters and their types, so this metamodel also contains the metaclasses Method, Parameter and Type.
AndroMDA contains a second metamodel (Spring) for Spring-enabled beans. This metamodel contains the metaclass SpringBean. Because SpringBeans can have methods with parameters and their types, the Spring metamodel also contains the same metaclasses Method, Parameter and Type.
Now, AndroMDA even contains a third metamodel called OOP (for object oriented programming). This metamodel contains Class, Interface, Property, Method, Parameter, Type and Comment. So, you see, Method, Parameter and Type again.
(By the way: I create these metamodels in UML 2 and let them include the same sub-model for the OOP metaclasses so that I do not have to repeat myself).
Now, I have three got ATL transformations:
* UML2EnterpriseApp * EnterpriseApp2Spring * Spring2OOP
Each one of these transformations has to copy methods with parameters and types from the source to the target model - always the same code except that the metamodels are different although they contain some common metaclasses.
What can we do so that I can write this "copy" code only once? It's really essential for proper operation in AndroMDA.
rule Method {
from s : MM!common::Method
to t : MM!common::Method (
...)
}rule SpringBean {
from s : MM!spring::SpringBean
to t : MM!spring::SpringBean (
...)
}
Some months ago, Frédéric proposed this kind of "formal metamodel parameter substitution". Would it be difficult to implement? Who has got the necessary knowledge about the compiler?
Cheers, Matthias
-- Regards, Dennis