Can't use lazy rules with EMFTVM in Refining mode [message #1736608] |
Thu, 30 June 2016 14:39 |
Sven L. Messages: 16 Registered: May 2012 |
Junior Member |
|
|
Hi everyone,
I'm using the EMFTVM (based on this example Running ATL (EMFTVM) Transformations Programatically) to run some transformations in refining mode.
This has worked fine so far, but I now have run into problems when using lazy rules. I would always get this exception, when running a transformation which contains a lazy rule (does not matter if the rule is actually called, or not):
java.lang.IllegalArgumentException: Model IN not found for t: Families!Member (models: [IN])
at org.eclipse.m2m.atl.emftvm.impl.ExecEnvImpl.resolveRuleElementModels(ExecEnvImpl.java:1613)
at org.eclipse.m2m.atl.emftvm.impl.ExecEnvImpl.resolveRuleModels(ExecEnvImpl.java:1593)
at org.eclipse.m2m.atl.emftvm.impl.ExecEnvImpl.run(ExecEnvImpl.java:2083)
at com.example.transformation.ATLLauncher.run(ATLLauncher.java:153)
I used this minimal example based of the Families2Persons example, which illustrates the problem:
-- @atlcompiler emftvm
-- @nsURI EMFTVM=http://www.eclipse.org/m2m/atl/2011/EMFTVM
-- @path Families=/Families2Persons/Families.ecore
module Families2Persons;
create OUT: Families refining IN: Families;
lazy rule LazyRule {
from
s: Families!Member
to
t: Families!Member (
firstName <- s.firstName + 'test'
)
}
-- End of Transformation
If I remove the lazy keyword from the rule it works without any issues. The transformation also works as expected, when started from my eclipse. However, if I run it from the standalone application it crashes.
So this leads me to believe that this might be a bug in the EMFTVM, but I cannot find out why it works when called from inside eclipse, but not when called from the standalone application.
Any ideas how to solve this?
I'm aware that this problem does not appear when using the normal mode, but I would like to keep using refining mode, if possible, since I have a rather large metamodel and models. Furthermore I would most of the time only transform a small part of the models.
Any help is much appreciated,
Sven
|
|
|
|
Re: Can't use lazy rules with EMFTVM in Refining mode [message #1736981 is a reply to message #1736933] |
Mon, 04 July 2016 19:00 |
|
When using the API, you have to take care to use the exact model names as they appear in the transformation module. If not, EMFTVM will complain. What happens in this case is:
- In refining mode, the OUT model is an alias for the IN model, and does not exist in EMFTVM bytecode anymore
- Each rule in EMFTVM bytecode needs to specify in which model to create its output elements, which is IN in this case
- Matched rules in refining mode refine the same model element where possible, but lazy rules always create new model elements; your problem did not occur for matched rules, because your matched rule had zero output elements and only modified properties of the input element
Cheers,
Dennis
|
|
|
|
Powered by
FUDForum. Page generated in 0.03383 seconds