[ETL] Accessing one output of a multiple "to's" transformation [message #660241] |
Thu, 17 March 2011 14:19 |
|
Hello,
I have a transformation rule that has multiple to's:
rule InitialPlace
transform node : sysmlModel!InitialNode
to p : hilesB!Place, arc : hilesB!Arc {
p.name = "InitialNode";
arc.from_point = node.equivalent("InitialPlaceService");
arc.to_node = p;
}
I was wondering if there is a way to access an specific output element of the transformation as in ATL. So when I do:
...
pn.elements.addAll(a.node.collect(n : sysmlModel!InitialNode | n).first().equivalents("InitialPlace"));
...
I could decide to add the places or the arcs.
Thanks,
Horacio
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
|
Re: [ETL] Accessing one output of a multiple "to's" transformation [message #660512 is a reply to message #660422] |
Fri, 18 March 2011 18:04 |
|
Hello Dimitris,
In ATL, when you use the resolveTemp() operation to resolve references to elements transformed by other rules (similar to ETL's equivalent()), if the transformation rule that resolves the reference to the element has mutiple "to's", you can specify the one you actually want to be used. From the ATL manual:
rule Case3_R1 {
from
i : MM_A!ClassA
to
o_1 : MM_B!Class1 (
linkToClass2 <- thisModule.resolveTemp(i.linkToClassB, 'o_n')
)
}
rule Case3_R2 {
from
in : MM_A!ClassB
to
o_1 : MM_B!Class3 (
...
),
...
o_n : MM_B!Class2 (
...
),
...
}
In the resolveTemp operation of rule Case3_R1, the reference to "i.linkToClassB" will be provided by the rule Case3_R2. However, that rule has 'n' to's. In the resolveTemp call I can specify that I want the reference to the element result of transformation to o_n. This way I can choose which of the to's I want to be used to solve the reference.
My question is if ETL's equivalent (or equivalents) operation can provide a similar behavior.
Thanks,
Horacio
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Re: [ETL] Accessing one output of a multiple "to's" transformation [message #661614 is a reply to message #660512] |
Fri, 25 March 2011 15:06 |
|
Hi Horacio,
Apologies for the late reply. This seems to have somehow slipped my attention. The equivalents() operation returns a sequence of sequences containing all the target elements that have been produced from the source element on which it's been applied. You can flatten it into a normal sequence using .flatten() and then query the sequence to get the elements you're interested in.
Cheers,
Dimitris
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04053 seconds