Problem with Stereotype application [message #1097191] |
Thu, 29 August 2013 10:57 |
saadia dhouib Messages: 36 Registered: April 2010 |
Member |
|
|
I am trying to applay a stereotype in a qvto transformation, but the the method applystereotype does not do anything.
I am using 3.3.0 version of QVTO on Kepler:
QVT Operational SDK 3.3.0.v20130521-0837
This is the code of the transformation:
modeltype UML uses uml('http://www.eclipse.org/uml2/4.0.0/UML');
transformation MarteTransformation(in MarteProfile : UML, out model : UML);
main() {
var prof : Profile := MarteProfile.objectsOfType(Profile)![name = "GCM"];
var stereo : Stereotype = MarteProfile.objectsOfType(Stereotype)![name = "FlowProperty"];
log("profile: ", prof);
log("stereo: ", stereo);
assert fatal (prof = stereo.profile);
var model : Model := object Model {name := 'model'};
var cls : Class := object Class {name := 'class'};
model.ownedType += cls;
var prop : Property := object Port {name := 'prop'};
log("list of applicable stereotype:");
prop.getApplicableStereotypes()-> forEach(stereotype){
log("applicable stereotype:", stereotype.name);
};
cls.ownedAttribute += prop;
model.applyProfile(stereo.profile);
prop.applyStereotype(stereo);
log ("this is the applied stereotype: ",prop.getAppliedStereotype("FlowProperty"));
}
And this is the console displayed messages:
profile: , data: org.eclipse.uml2.uml.internal.impl.ProfileImpl@1add57d9 (name: GCM, visibility: <unset>) (URI: null)
stereo: , data: org.eclipse.uml2.uml.internal.impl.StereotypeImpl@7d0d936b (name: FlowProperty, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
list of applicable stereotype:
this is the applied stereotype:
|
|
|
|
Re: Problem with Stereotype application [message #1097857 is a reply to message #1097191] |
Fri, 30 August 2013 08:51 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
When stuck and no one can help, the debugger is your friend.
- did the stereotype really get applied?
- was it applied to the right object?
- was the right object saved to XMI?
- did the serialization corrupt the sterotype?
My understanding of QVTo stereotypes is very limited. Deep within the
specification 8.4.3 (3) is a * operator. I don't know whether this is
relevant to your problem or not.
Regards
Ed Willink
On 29/08/2013 11:57, saadia dhouib wrote:
> I am trying to applay a stereotype in a qvto transformation, but the
> the method applystereotype does not do anything.
>
> I am using 3.3.0 version of QVTO on Kepler:
> QVT Operational SDK 3.3.0.v20130521-0837
>
> This is the code of the transformation:
> modeltype UML uses uml('http://www.eclipse.org/uml2/4.0.0/UML');
>
> transformation MarteTransformation(in MarteProfile : UML, out model :
> UML);
>
> main() {
> var prof : Profile := MarteProfile.objectsOfType(Profile)![name =
> "GCM"];
> var stereo : Stereotype =
> MarteProfile.objectsOfType(Stereotype)![name = "FlowProperty"];
> log("profile: ", prof);
> log("stereo: ", stereo);
> assert fatal (prof = stereo.profile);
>
> var model : Model := object Model {name := 'model'};
> var cls : Class := object Class {name := 'class'};
> model.ownedType += cls;
> var prop : Property := object Port {name := 'prop'};
> log("list of applicable stereotype:");
> prop.getApplicableStereotypes()-> forEach(stereotype){
> log("applicable stereotype:", stereotype.name);
> };
> cls.ownedAttribute += prop;
>
> model.applyProfile(stereo.profile);
> prop.applyStereotype(stereo);
> log ("this is the applied stereotype:
> ",prop.getAppliedStereotype("FlowProperty"));
>
> }
>
>
>
> And this is the console displayed messages:
> profile: , data:
> mailto:org.eclipse.uml2.uml.internal.impl.ProfileImpl@1add57d9 (name:
> GCM, visibility: <unset>) (URI: null)
> stereo: , data:
> mailto:org.eclipse.uml2.uml.internal.impl.StereotypeImpl@7d0d936b
> (name: FlowProperty, visibility: <unset>) (isLeaf: false, isAbstract:
> false, isFinalSpecialization: false) (isActive: false)
> list of applicable stereotype:
> this is the applied stereotype:
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03165 seconds