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
Matteo M. is currently offline Matteo M.Friend
Messages: 28
Registered: May 2012
Junior 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
Previous Topic:Writing it as extension for QVTo in Java
Next Topic:Does Eclipse QVTo implementation support typedef?
Goto Forum:
  


Current Time: Thu Nov 27 12:22:45 GMT 2014

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

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