[QVTo] Extract port conjugation from an RSA-RTE model [message #539281] |
Thu, 10 June 2010 09:21 |
Peter Messages: 4 Registered: June 2010 |
Junior Member |
|
|
Hi all,
I am trying to extract the conjugation value of a port in an RSA-RTE model using QVTo.
I am a beginner with QVTo, and if someone can help me with this or give me any kind of hint, I would appreciate it a lot!
My trails so far can be summarized in:
The conjugation value of the port seems to be serialized in a stereotype "UMLRealTime:RTPort" that in turn refer to the port "uml:Port".
...
<uml:Package xmi:id="_JIiE0Gx-Ed-BGaWKxM5KLw" name="CPPModel">
...
<packagedElement xmi:type="uml:Class" xmi:id="_bFixEGyLEd-BGaWKxM5KLw" name="MyCapsule2C">
<ownedAttribute xmi:type="uml:Port" xmi:id="_wmTj0GyLEd-BGaWKxM5KLw" name="mytestprotocol_1" type="_MpBwEWx-Ed-BGaWKxM5KLw" aggregation="composite" isBehavior="true"/>
<ownedAttribute xmi:type="uml:Port" xmi:id="_161_kGyLEd-BGaWKxM5KLw" name="mytestprotocol_2" type="_MpBwEWx-Ed-BGaWKxM5KLw" aggregation="composite" isBehavior="true"/>
</packagedElement>
...
...
</uml:Package>
...
...
<UMLRealTime:RTPort xmi:id="_wmctwGyLEd-BGaWKxM5KLw" isConjugate="true" base_Port="_wmTj0GyLEd-BGaWKxM5KLw"/>
<UMLRealTime:RTPort xmi:id="_16_wkGyLEd-BGaWKxM5KLw" base_Port="_161_kGyLEd-BGaWKxM5KLw"/>
...
I have tried two approaches:
1) extracting the applied stereotypes on the port
2) extracting all stereotypes in the model, and "from-outside-and-in" find the source port for the stereotype
So far, I have failed with both approaches...
1) Following statements, both result in empty arrays
var portStereotypes := self.oclAsType(Port).getStereotypeApplications();
var portAppliedStereotypes := self.oclAsType(Port).getAppliedStereotypes();
- Perhaps I am reading th model in an incorrect way(??), resulting in that the references cannot be resolved(??)...
2) I can extract the "isConjugate" and the "base_Port" value, but only as strings!!
- it seems that the "UMLRealTime:RTPort" is an "anyType" and the attibutes above are encapsulated within "anyAttribute"
=> I can not convert the base_Port xmi:id to a reference (and therefore not resolve it)
=> I can neither get the xmi:id of the source port (_globalId() is not supported, should this be the correct way or is there an other way??) and therefore I can not compare the base_Port value with it (seems to be a rather ugly solution anyway...)
var insts := bbStructModel.objects()->select(inst | inst.metaClassName().equalsIgnoreCase('RTPort'));
insts->forEach(inst) {
...
var instAttrs := inst.oclAsType(typeMM::AnyType).anyAttribute;
...
...
instAttrs->forEach(instAttr) {
var instConj := instAttr.repr().equalsIgnoreCase("isConjugate=true");
log ('instConj', instConj);
var instPortRef := instAttr.oclAsType(EFeatureMapEntry).repr().substringAfter("= ");
log ('instPortRef', instPortRef);
var instPort := instPortRef.asEObject().resolve();
log ('instPortRef', instPort);
};
};
Thanks in advance,
Peter
|
|
|
Powered by
FUDForum. Page generated in 0.03172 seconds