Skip to main content


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 06:58 Go to next message
Martin Benedict is currently offline Martin BenedictFriend
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 07:43 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
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 07:49 Go to previous message
Martin Benedict is currently offline Martin BenedictFriend
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: Thu Apr 25 23:36:07 GMT 2024

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

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

Back to the top