|
|
|
Re: [ATL] MARTE profile [message #98206 is a reply to message #98191] |
Fri, 23 January 2009 13:24 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
Hello,
If you want to do an exact copy of the source model (stereotyped) to
target model (same sterotypes as source), you can try the ATL 3.0
refining mode.
Rasha a écrit :
> Hi William,
>
> I?m trying to copy a stereotype and its properties from the source to
> the target model. The source model is applied the MARTE profile. But
> sience I don?t know how to import the MARTE profile to my transformation
I assume that you're talking about a built-in profile (in an installed
plugin). Next ATL build (at least M5 galileo, so 6 feb, maybe sooner)
will provide a way to load a profile using the "pathmap:" prefix in
place of "uri:". This feature is ever available on the CVS HEAD.
> file, I used my own defined profile. I tried to copy the stereotype with
> the same way as any model element is copied.
>
> create OUT : UML from IN : UML, PRO : UML;
> rule Lifeline{
> from
> s : UML!Lifeline to t : UML!Lifeline(
> name <- s.name,
> stereotype <- s.stereotype
*snip*
This can't work, UML2 only allows to manage stereotypes through its API.
> ->collect(e|thisModule.Stereotype(e))
> )}
> lazy rule Stereotype{
> from
> s : UML!Stereotype to t : UML!Stereotype(
> name <- s.name
> )}
> But it doesn?t work since feature stereotype does not exist on
> UML!Lifeline.
>
> So, I tried to apply the profile to the target model
>
> helper def : MyStereotype : UML!Stereotype = OclUndefined;
>
> rule Model{
> from
> s : UML!Model to t : UML!Model( name
> <- s.name
> )
>
> do {t.applyProfile(UML!Profile.allInstancesFrom('PRO')->select(p |
> p.name ='MyProfile')->first());
>
> thisModule.MyStereotype <- UML!Profile.allInstancesFrom('PRO')->select(p
> | p.name=' MyProfile ')
> ->first().ownedStereotype->select(s | s.name='MyStereotype')->first(); }}
>
> rule Lifeline{
> from
> s : UML!Lifeline to t : UML!Lifeline(
> name <- s.name
> )
> do{
> t.applyStereotype(thisModule.MyStereotype);
> }}
>
> But I got an error
> ERROR: exception during invocation of operation applyStereotype on
> UML!Lifeline (java method: public org.eclipse.emf.ecore.EObject
> org.eclipse.uml2.uml.internal.impl.ElementImpl.applyStereoty pe(org.eclipse.uml2.uml.Stereotype))
>
>
Is it the complete exception ?
There can be many reasons here. Note that ATL rules execution order is
undefined, so maybe :
- the stereotype is applied before the profile
=> if you use RegularVM, use UML2 modelhandler for the output model
=> if you use EMFVM, check the "Support UML2 stereotypes" in the
Advanced tab of the launch config
- the MyStereotype variable isn't initialized when you apply it
- ?
Whatever, you should try to use debug('') method inside of your code to
see what is undefined.
ex:
t.applyStereotype(thisModule.MyStereotype.debug(''));
Best Regards,
William
> Thanks for your help,
>
> Rasha
>
>
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.53503 seconds