Generalization relationship between stereotypes [message #1058852] |
Wed, 15 May 2013 12:08 |
Matteo M. Messages: 40 Registered: May 2012 |
Member |
|
|
Hello,
Let's say that I have a UML profile defining a base stereotype called MyBaseStereo; the profile also defines a specialization of it, called MyDerivedStereo.
Now, let's say that I have an UML Model processed by a QVTo transform; in this Model I have a Class which I want to be stereotyped as MyDerivedStereo, because, conceptually, the Class _is_a_ MyDerivedStereo (and in turn is also a MyBaseStereo).
I apply the stereotype as myClass.applyStereotype(MyDerivedStereo) and it is correctly recognized as applied, but if I call myClass.isStereoTypeApplied(MyBaseStereo), this one returns false. Why this? How does the generalization relationship work for stereotypes?
EDIT: I forgot to say that if I apply the stereotype MyDerivedStereo, I'm also able to set values for properties defined in the base stereotype (myClass.setValue(MyBaseStereo, "attribute", attributeValue). Therefore, the base stereotype _is_ applied. But I'm not able to "detect" this fact by using myClass.isStereoTypeApplied(MyBaseStereo), and it becomes a pain when I want to select all the classes from a set that _are_ MyBaseStereo elements (stereotyped, e.g., as MyDerivedStereo1, MyDerivedStereo2, etc., that derive from MyBaseStereo) and that are collected in a set with other classes that are not stereotyped that way. Maybe is isStereoTypeApplied() not the right function to call?
--
Matteo
[Updated on: Thu, 16 May 2013 09:22] Report message to a moderator
|
|
|
|
Re: Generalization relationship between stereotypes [message #1060450 is a reply to message #1058852] |
Fri, 24 May 2013 17:02 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
IMHO Sterteotype generalization should work and the MDT/UML2 library
endeavours to support them and so MMT/QVTo should just work since it
just reuses MDT/UML2.
I suggest doing some Java API experiments with MDT/UML2 to see what
actually happens.
Regards
Ed Willink
On 15/05/2013 13:08, Matteo M. wrote:
> Hello,
>
> Let's say that I have a UML profile defining a base stereotype called
> MyBaseStereo; the profile also defines a specialization of it, called
> MyDerivedStereo.
>
> Now, let's say that I have an UML Model processed by a QVTo transform;
> in this Model I have a Class which I want to be stereotyped as
> MyDerivedStereo, because, conceptually, the Class _is_a_
> MyDerivedStereo (and in turn is also a MyBaseStereo).
>
> I apply the stereotype as myClass.applyStereotype(MyDerivedStereo) and
> it is correctly recognized as applied, but if I call
> myClass.isStereoTypeApplied(MyBaseStereo), this one returns false. Why
> this? How does the generalization relationship work for stereotypes?
>
> --
> Matteo
|
|
|
|
Powered by
FUDForum. Page generated in 0.02883 seconds