Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Can't use lazy rules with EMFTVM in Refining mode
Can't use lazy rules with EMFTVM in Refining mode [message #1736608] Thu, 30 June 2016 14:39 Go to next message
Sven L. is currently offline Sven L.Friend
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 #1736933 is a reply to message #1736608] Mon, 04 July 2016 12:29 Go to previous messageGo to next message
Sven L. is currently offline Sven L.Friend
Messages: 16
Registered: May 2012
Junior Member
I still don't know why it behaves this way, when using lazy rules, but I solved it by naming the INOUT model "IN" instead of "INOUT".
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 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

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:


  1. In refining mode, the OUT model is an alias for the IN model, and does not exist in EMFTVM bytecode anymore
  2. Each rule in EMFTVM bytecode needs to specify in which model to create its output elements, which is IN in this case
  3. 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
Re: Can't use lazy rules with EMFTVM in Refining mode [message #1737912 is a reply to message #1736981] Thu, 14 July 2016 06:39 Go to previous message
Sven L. is currently offline Sven L.Friend
Messages: 16
Registered: May 2012
Junior Member
Okay, thank you for clarifying.
Previous Topic:UML primitive types
Next Topic:[ATL] Unique rule has double output
Goto Forum:
  


Current Time: Thu Apr 25 10:36:47 GMT 2024

Powered by FUDForum. Page generated in 0.03517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top