Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] UseCase 2 HighLevel rules
[ATL] UseCase 2 HighLevel rules [message #47336] Mon, 18 June 2007 11:53 Go to next message
Eclipse UserFriend
Originally posted by: hein..fokus.fraunhofer

Hi all,

I've a problem in formulating the right ATL rules. My source model is an
UML model that contains UseCases, Actors as well as Associations between
them. My target model is also an UML based model that should contains
the same usecases, actors and associations and furthermore classes which
are derived from the usecase, actors and associations information. The
classes should be created in a new package named "ClassPackage".

The transformation of the several entities isn't very difficult

rule Actor{
from a1:UML2!Actor
to a2:UML2!Actor(
name<-a1.name,
general<-a1.general
),
c1:UML2!Class(
name<-a1.name,
general<-if a1.general->size()>0 then
UML2!Class.allInstances()->select(x|x.name=a1.general->first().name)
else Set{} endif
)
}

or...
rule UseCase{
from u1:UML2!UseCase
to u2:UML2!UseCase(
name<-u1.name,
--owner<-u1.owner,
include<-u1.include
),
c1:UML2!Class (
name<-u1.name,
useCase<-u1,
nestedClassifier<- if u1.include->size()>0 then
UML2!Class.allInstances()->select(c |
u1.include->collect(i|i.addition.name)->includes(c.name) )
else Set{} endif
)
}


However, my problem are the creation of the associations. I need to
create two associations that have different association ends in each
cases. Here is my initial rule for association

rule Asscociation{
from a1:UML2!Association
to a2:UML2!Association(
name<-a1.name,
memberEnd<-a1.memberEnd,
ownedEnd<-a1.ownedEnd

),
a3:UML2!Association(
name<-a1.name+'source_target',
ownedEnd<-a1.ownedEnd
)
}

a2 should be a simple copy of a1 (Actor<->UseCase), but a3 should be a
new association between the generated Classes in the target model from
an Actor and an UseCase. How to specify the right OwnedEnd member for
the association a3 with ATL.

Thanks in advance for any help
Christian
Re: [ATL] UseCase 2 HighLevel rules [message #47373 is a reply to message #47336] Mon, 18 June 2007 13:44 Go to previous messageGo to next message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 313
Registered: July 2009
Senior Member
Hi,

general spoken you need thisModule.resolveTemp(..) for that purpose
(see user manual, pp. 38-40).
Maybe like this:

rule Asscociation{
from a1:UML2!Association
to a2:UML2!Association(
name<-a1.name,
memberEnd<-a1.memberEnd,
ownedEnd<-a1.ownedEnd

),
a3:UML2!Association(
name<-a1.name+'source_target',
-- ownedEnd<-a1.ownedEnd
)
do { -- this do part is new
a3.ownedEnd <- thisModule.resolveTemp(a1.ownedEnd, 'c1');
a3.memberEnd <- thisModule.resolveTemp(a1.memberEnd, 'c2');
}
}

assumed I've understood your transformation...

Jens
Re: [ATL] UseCase 2 HighLevel rules [message #47402 is a reply to message #47373] Mon, 18 June 2007 13:45 Go to previous message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 313
Registered: July 2009
Senior Member
Sorry, typo:

....
do { -- this do part is new
a3.ownedEnd <- thisModule.resolveTemp(a1.ownedEnd, 'c1');
a3.memberEnd <- thisModule.resolveTemp(a1.memberEnd, 'c1');
}


Jens
Previous Topic:[ATL] Sequence as a source pattern ?
Next Topic:[ATL] Problem with inter-model references
Goto Forum:
  


Current Time: Tue Apr 16 08:57:56 GMT 2024

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

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

Back to the top