Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » lazy rules with returning sequence
lazy rules with returning sequence [message #897434] Tue, 24 July 2012 02:58 Go to next message
Martin Benedict is currently offline Martin Benedict
Messages: 22
Registered: June 2012
Junior Member
I have written a lazy rule transforming a model element from source model to two model elements of the target models.
The problem now is that a lazy rule only returns the first element of the to block. Now I have two elements to be returned. The first is a class and the second is an association. Both elements result from one model element.
How can I reach that both elements are returned by the lazy rule?

Here is a code sample:

from
    ep: M!AnElement
to
   epSeq : Sequence{c2, as }, -- I want to do something like this, but this is not working

--these elements should be bundled for return
		c2: UML!Class (
			name <- ep.name.firstToLower()
		),
		as: UML!Association (
			ownedEnd <- Set{p1},
			navigableOwnedEnd <- Set{p2} -- directed association
			
		),
--.......


Thanks for any help
Martin
Re: lazy rules with returning sequence [message #897443 is a reply to message #897434] Tue, 24 July 2012 03:43 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 522
Registered: July 2009
Senior Member
Using a called rule instead of a lazy rule as you can stipulate the elements to return in the do section.
rule XXX(ep: M!AnElement){
to
		c2: UML!Class (
			name <- ep.name.firstToLower()
		),
		as: UML!Association (
			ownedEnd <- Set{p1},
			navigableOwnedEnd <- Set{p2} -- directed association
			
		)
do{
Sequence{c2, as };
}
}
Re: lazy rules with returning sequence [message #897448 is a reply to message #897443] Tue, 24 July 2012 03:49 Go to previous message
Martin Benedict is currently offline Martin Benedict
Messages: 22
Registered: June 2012
Junior Member
Marvellous, this is working for me. I often try to use lazy rules, but this seems for many purposes to be not the right track.
Previous Topic:lazy rule doesn't return class
Next Topic:EMFModelAdapter has and strange behaviour with UML models
Goto Forum:
  


Current Time: Wed Jul 30 23:20:59 EDT 2014

Powered by FUDForum. Page generated in 0.06598 seconds