[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] [ATL]2 target objects from one source object

I had 2 rules like those:
rule A {
from c_in: S:class
to
c_out: O:class (
c_out.elements<-c_in.properties
)
}
--
rule B {
from p_in: S:property
to
p_out: O:field (
...
)
}
And ATL did that awesome magic, it knew that each property on c_in.properties was mapped to a O:field, and populated the c_out.elements with them.


When I try to improve rule B to generate 2 objects from each property, an odd thing happens: ATL adds only the first generated element:

rule B {
from p_in: S:property
to
p_out: O:field (
...
),
g_out: O:method (
...
)
}
--result: c_out.elements will have only O:field


rule B {
from p_in: S:property
to
g_out: O:method (
...
),
p_out: O:field (
...
)


}
--result: c_out.elements will have only O:method

I want to have both elements together. I still can use imperative code to solve this, but I would like to understand how it works, if it's the first elements that's the official one, or if there is a better way to do that in declarative way.
What would happen if instead of 2 objects, I use the iterative target pattern element ? it will associate the first element, all elements or no element at all?
my ATL version is 2.0, eclipse 3.3 (going to upgrade soon)


Thanks