Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » setValue() a Stereotype with another Stereotype
setValue() a Stereotype with another Stereotype [message #1210377] Tue, 26 November 2013 00:42 Go to next message
Matteo M. is currently offline Matteo M.Friend
Messages: 40
Registered: May 2012
Member
Hello,

I have a (source) SysML profile with one stereotype FooStereo, and a (target) SysML profile with two stereotypes, BarStereo and ZotStereo. A (navigable) association is defined from BarStereo to ZotStereo (named "run"). All the stereotypes inherit from Block.

The logics of the M2M transformation is simple: for each occurrency of FooStereo in the source model, a couple BarStereo/ZotStereo is generated in the dest model, and each BarStereo is associated with the corresponding ZotStereo.

This is the body of the mapping that creates Bar/Zot stereos for a given FooStereo (the mapping operates on UML::Class(es) that are stereotyped opportunely):

// add the class (BarStereo) to the dest
// model instance *so that the profiles
// are applicable* & set the name attribute
// (self is a FooStereo occurrency in the src model)
dst_mdl.packagedElement += result;
result.name := "Bar_" + self.name;
var zot_cls := object Class {name := "Zot_" + self.name;};
dst_mdl.packagedElement += zot_cls;

// apply stereotypes: BarStereo, ZotStereo
// (safelyApplyStereotype() is a custom helper
// that applies a Stereotype to an Element)
safelyApplyStereotype(result, bar_stp);
safelyApplyStereotype(zot_cls, zot_stp);

// set attributes
result.visibility := VisibilityKind::public;
result.setValue(bar_stp, "run", zot_cls);     // <--- does not have any effect (!?)


However, the latest instruction does not have any effect and all the BarStereos remain with "null"-valued run associations.

Note that I'm able to set the desired values for the associations manually through Papyrus, so I assume that it must be possible to do the same via QVT...

I've already had troubles with advanced used of setValues()/getValues() methods, see here: http://www.eclipse.org/forums/index.php/t/487933/. However, I learnt from Sergey (Boyko) that extended syntax of these methods is supported by UML. So I hope that a solution that does not involve the use of Java blackboxes is applicable also in this case.

Any idea on how to achieve the desired result?

Thank you in advance for your help,

--
Matteo
Re: setValue() a Stereotype with another Stereotype [message #1746509 is a reply to message #1210377] Mon, 31 October 2016 12:57 Go to previous message
Ferdinando Sodano is currently offline Ferdinando SodanoFriend
Messages: 7
Registered: October 2016
Junior Member
I've the same problem. Is there someone who can help me and knows the solution?
Previous Topic:Passing external variables from eclipse
Next Topic:How to set tagged values after applying a profile
Goto Forum:
  


Current Time: Thu Mar 28 14:26:36 GMT 2024

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

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

Back to the top