|
|
|
|
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1698543 is a reply to message #1698019] |
Tue, 16 June 2015 10:16 |
Alexander Fülleborn Messages: 132 Registered: April 2013 |
Senior Member |
|
|
Hi again Antonio,
in the meantime, I have been able to fix this Problem and to provide a solution. I suppose that it works as designed, namely that I can only call an Operation for the same Kind of element (model, class) only exactly one time, at least when I apply this in guards. Am I right?
Instead of calling the same Operation for the same element instance several times in different guards, I centralized such a call in the pre section and store the resulting object instance in a variable, see the subsequent Piece of code:
[...]
/* store the relevant retrieval request source problem-context
pattern model: */
for (m in SrcRetReqPcp!Model.all) {
for (s in m.getAppliedStereotypes()) {
if (s.name == "ProblemContextPattern") {
gv_srcRetReqPcp = m;
breakAll;
}
else if (s.name <> "ProblemContextPattern") {
continue;
}
}
}
[...]
In the specific guards of the several rules, I then just refer to the variable, see:
[...]
rule transformElemOfTypePcpModel
transform iv_srcModel : SrcRetReqPcp!Model
to cv_tgtModel : TgtInstRetReqSp!Model {
guard: iv_srcModel == gv_srcRetReqPcp
[...]
Hence, for me this issue is solved.
Thanks again for your Support and Kind regards, Alex
|
|
|
|
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1698681 is a reply to message #1698640] |
Wed, 17 June 2015 09:00 |
|
The "X!Y" syntax refers to type Y in model X: it can't be used with regular variables. In particular, "X!Y.all" gets all the instances of that type Y in model X, so this is working as intended.
Since you are looping through m.getAppliedStereotypes() on the variable s, shouldn't you use an expression that starts from s or m? Without knowing your metamodel and the kind of query you want to do, we can't help you much more, I'm afraid.
EOL offers extension operations such as collect(...) or filter(...) on collections, which may be useful. You could do something like CorrespondingPcp!Class.all.select(c | ... expression using c, m and s ...) to retrieve the CorrespondingPcp!Class instances that match the condition in that expression.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03764 seconds