Overriding Stereotype's properties and assigning them a value [message #1065983] |
Fri, 28 June 2013 12:27  |
Eclipse User |
|
|
|
Hello all,
let's take the HwCommunication package in MARTE. It has a stereotype named HwBus with a property isSerial whose type is NFP_Boolean. Now, let's say that I want to create two stereotypes, HwSerialBus and HwParallelBus, that specialize it.
Of course, I want the property isSerial in HwBus is set to true in HwSerialBus and false in HwParallelBus. How do I do it?
I tried by overriding the property and assigning it a default value, but it hasn't worked. Let's take the HwSerialBus stereotype. I defined a property isSerial with type NFP_Boolean. I set it to read-only (read-only=true) and I gave it a default value (true). Finally I added the isSerial property of HwBus (the parent of HwSerialBus) as "Redefined property" in HwSerialBus. I saved the profile and I defined it. You can find it as an attachment to this thread.
Anyway, when I try to apply the profile to a model, I get the error "Selected profiles cannot be applied because their definition are not valid". Can someone help me?
Thank you in advance.
--
Matteo
|
|
|
|
|
Re: Overriding Stereotype's properties and assigning them a value [message #1066697 is a reply to message #1066685] |
Wed, 03 July 2013 15:44   |
Eclipse User |
|
|
|
Hi,
Ed Willink wrote on Wed, 03 July 2013 13:53
On 03/07/2013 17:59, Camille Letavernier wrote:
> Moreover, the concept of "Redefined" does not exist in Ecore. I
> suspect that you won't be able to achieve what you're trying to do at
> all.
...
There certainly is some support for redefinition.
Yes, there is. It works if you set the type of isSerial in HwSerialBus (the derived stereotype) to Boolean instead of NFP_Boolean (like the base stereotype). I attached the dummy profile and the dummy model with a correctly stereotyped Block to this thread. However you also have to leave unset the read-only attribute (read-only = false) otherwise it won't work...
I was making use of the "trick" of setting a read-only default value (true) for isSerial in HwSerialBus so as to constrain an attribute of the base stereotype to a fixed value in the derived stereotype. So, now, the question is: when defining a derived stereotype, how do I constrain to a given value an attribute that I inherit from a base stereotype?
--
Matteo
[Updated on: Wed, 03 July 2013 15:46] by Moderator
|
|
|
Re: Overriding Stereotype's properties and assigning them a value [message #1066723 is a reply to message #1066685] |
Thu, 04 July 2013 01:48  |
Eclipse User |
|
|
|
Ed,
I mean this is related to the language in which Ecore is implemented.
Redefinition (in CMOF) allows you to get completely rid of a
RedefinableElement in a specialized class. This does not work in Java at
all. Redefinition works fine in UML2 if the redefining element and the
redefined element have different names. Then, the access to the redefined
element (e.g., a feature) delegates the request to the redefining element.
That works quite nice.
Even UML2 has not solved this technology-related issue properly. For
example, have a look at DurationConstraint, whose association end
specification redefines the one inherited by Constraint. In fact,
DurationConstraint::specification refers to a DurationInterval (in the spec)
whereas the UML2 implementation still refers to ValueSpecification (which is
the class Constraint::specification is referring to). So, redefinition in
UML2 does not work properly if the names are identical.
Regards,
Marc-Florian
"Ed Willink" wrote in message news:kr1ofo$dc5$1@xxxxxxxxe.org...
Hi
On 03/07/2013 17:59, Camille Letavernier wrote:
> Moreover, the concept of "Redefined" does not exist in Ecore. I suspect
> that you won't be able to achieve what you're trying to do at all.
There is a lot of magic (to me) in the way that the MDT/UML2 support
succeeds in doing things for UML users that are not permitted in Ecore.
There certainly is some support for redefinition.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.04846 seconds