[ATL] Transform to unknown target element [message #797529] |
Mon, 13 February 2012 15:45  |
Eclipse User |
|
|
|
Hello everyone,
I have a question about ATL. Hope you can help me.
I'm facing a problem about how to transform to an element without knowing in advance its existence in the metamodel. Say I have a class A, I want to check whether there's a class named "A1" inherited from A and if yes, transform a given value to A1. Any help will be appreciated.
|
|
|
Re: [ATL] Transform to unknown target element [message #798175 is a reply to message #797529] |
Tue, 14 February 2012 10:51   |
Eclipse User |
|
|
|
Hello again,
Could anyone help me on this problem? To be more specific, I'll give an example like this. I want to transform MM1!A to MM2!B. In MM2 I have many classes inheriting from B (B1, B2, ...). In MM1!A I have an attribute typed String like "inheritingClass:String". Now within the transformation rule, basing on the inheritingClass attribute form MM1!A (its value could be 'B1', 'B2', ...), is there any way to determine the subclass form B to which I will transform A's values?
Best regards.
|
|
|
|
Re: [ATL] Transform to unknown target element [message #798343 is a reply to message #798328] |
Tue, 14 February 2012 15:05   |
Eclipse User |
|
|
|
Hi Zheng,
Firstly, thank you for your answer. In fact, my problem is we don't know the value of inheritingClass attribute before writing the rule. I mean, is there a similar approach like this snippet of code:
for all subclasses of B
if there exists a subclass whose type name is equal to A.inheritingClass
then transform A's value to that subclass's value
.
Regards.
|
|
|
Re: [ATL] Transform to unknown target element [message #800652 is a reply to message #798343] |
Fri, 17 February 2012 10:11   |
Eclipse User |
|
|
|
Because my question is still not answered yet, I reparaphrase it to this question: Is it possible to reason about the existence of the elements of the meta-model in an ATL rule during the rule creation? Is it feasible to write a kind of code with the following philosophy:
If there exists an element named A in the target metamodel then transform a given value to it, else do nothing?
Regards.
|
|
|
Re: [ATL] Transform to unknown target element [message #800996 is a reply to message #800652] |
Fri, 17 February 2012 19:55   |
Eclipse User |
|
|
|
On 17/02/12 11:11, Capi Tali wrote:
> Because my question is still not answered yet, I reparaphrase it to this
> question: Is it possible to reason about the existence of the elements of the
> meta-model in an ATL rule during the rule creation? Is it feasible to write a
> kind of code with the following philosophy:
> If there exists an element named A in the target metamodel then transform a
> given value to it, else do nothing?
> Regards.
First of all: this goes against the philosophy of MDE and model
transformation. Models are first-order, and transformations should not reflect
on the metamodels but just use them.
The way around this first-order limitation, is to use a second transformation:
a higher-order transformation. This second transformation will generate your
first-order transformation, made to measure for your specific metamodel.
See also:
http://www.eclipse.org/m2m/atl/atlTransformations/#KM32ATLCopier
http://jordicabot.com/papers/ICMT10a.pdf
If the expected variation of output metamodels is bounded and small enough,
you can manually create one model transformation for each output metamodel as
well.
Regards,
Dennis
|
|
|
|
Powered by
FUDForum. Page generated in 0.70827 seconds