[ATL] Problem when copying association [message #94769] |
Sun, 09 November 2008 23:01  |
Eclipse User |
|
|
|
Hi all,
Im trying to copy the associations between selected classes from the
source model to the target one. The metamodels for both the source and
target are UML2. I selected first the classes to be copied according to
their stereotypes then I need to select the associations according to the
stereotype of their member ends. Since I couldnt navigate the target
model to copy only the associations of its classes, I have to repeat the
same condition in the association rule.
I use these rules to copy the classes and their associations, but I get
this error could not find operation hasStereotype on Sequence(OclAny)
having supertypes: [Collection(OclAny)] . A helper called hasStereotype
is defined and works fine only with the rule CopyClass. I get the same
error if I use isStereotypeApplied()
rule CopyAssociation{
from
s : UML!Association (s.memberEnd.hasStereotype(' myStereotype'))
to
t : UML!Association (
name <- s.name,
ownedEnd <- s.ownedEnd,
memberEnd <- s.memberEnd
)
}
rule CopyClass{
from
s : UML!Class (s.hasStereotype('myStereotype'))
to
t : UML!Class (
name <- s.name,
ownedAttribute <- s.ownedAttribute,
ownedOperation <- s.ownedOperation,
generalization <- s.generalization
)
)
How can I access this helper through the association?
Do I need to use a lazy rule to call it when I need to copy a specific
association or just a condition in a matched rule is enough?
Is the order of these two rules matter? If the CopyClass rule executed
first, then the selected classes are moved from the source model to the
target model and the second CopyAssociation rule will not find these
classes in the source model. Or we dont modify the source model so the
order doesnt matter.
Any help would be appreciated!
Rasha
|
|
|
Re: [ATL] Problem when copying association [message #94793 is a reply to message #94769] |
Mon, 10 November 2008 05:15   |
Eclipse User |
|
|
|
Hi Rasha
When i worked with ATL on UML2 I had some problems too with stereotypes
some solutions to try
1) try UML2 handler
2) instead of using s.hasStereotype
make an helper which will execute this (sorry for helper syntax i don't
remember):
helper personnalHasStereotype(name :String) .... =
s.getAppliedStereotypes()->select(s | s.name = name)
and try to put a debug on s.getAppliedStereotypes
I really have this problem and it seems the stereotypes methods with
Strings doesn't work
Rasha a écrit :
> Hi all,
>
> I�m trying to copy the associations between selected classes from the
> source model to the target one. The metamodels for both the source and
> target are UML2. I selected first the classes to be copied according to
> their stereotypes then I need to select the associations according to
> the stereotype of their member ends. Since I couldn�t navigate the
> target model to copy only the associations of its classes, I have to
> repeat the same condition in the association rule.
>
> I use these rules to copy the classes and their associations, but I get
> this error �could not find operation hasStereotype on Sequence(OclAny)
> having supertypes: [Collection(OclAny)] � . A helper called
> hasStereotype is defined and works fine only with the rule CopyClass. I
> get the same error if I use isStereotypeApplied()
> rule CopyAssociation{
> from
> s : UML!Association (s.memberEnd.hasStereotype(' myStereotype'))
> to t : UML!Association ( name <- s.name,
> ownedEnd <- s.ownedEnd,
> memberEnd <- s.memberEnd
> )
> }
> rule CopyClass{
> from
> s : UML!Class (s.hasStereotype('myStereotype'))
> to t : UML!Class ( name <- s.name,
> ownedAttribute <- s.ownedAttribute,
> ownedOperation <- s.ownedOperation,
> generalization <- s.generalization
> )
> )
>
> How can I access this helper through the association?
>
> Do I need to use a lazy rule to call it when I need to copy a specific
> association or just a condition in a matched rule is enough?
>
> Is the order of these two rules matter? If the CopyClass rule executed
> first, then the selected classes are moved from the source model to the
> target model and the second CopyAssociation rule will not find these
> classes in the source model. Or we don�t modify the source model so the
> order doesn�t matter.
>
> Any help would be appreciated!
>
> Rasha
>
>
|
|
|
|
|
|
|
|
|
|
|
Re: [ATL] Problem when copying association [message #96076 is a reply to message #96048] |
Tue, 25 November 2008 18:03  |
Eclipse User |
|
|
|
Hi Rasha,
After getting that connected info message you have to switch to the
Debug perspective.
Rasha schrieb:
> For getAppliedStereotype(stereotype), I have to use the fully qualified
> name of the stereotype, otherwise it doesn�t work.
> I tested getAppliedStereotype(stereotype) in different helper and it
> works fine.
>
> I have a problem with the debug. When I put a debug instruction, I got only
> INFO: Trying to connect to remote debuggee
> INFO: Connected.
>
> I have org.atl.eclipse.adt.debug as a plug in. Do I need something else?
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05547 seconds