Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Overriding Stereotype's properties and assigning them a value(I tried several ways but I always get "Selected profiles cannot be applied because their definition are not valid")
Overriding Stereotype's properties and assigning them a value [message #1065983] Fri, 28 June 2013 16:27 Go to next message
Matteo M. is currently offline Matteo M.Friend
Messages: 40
Registered: May 2012
Member
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 #1066675 is a reply to message #1065983] Wed, 03 July 2013 16:59 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Matteo,


First, you should use Papyrus 0.10 with Eclipse Kepler (Released last week). It provides more detailed diagnostics on profile errors.

The UML Profile "definition" is a transformation from a UML Profile to an Ecore metamodel. Ecore has much more restrictions than UML in terms of naming. In particular, in Ecore, it is forbidden to have two properties with the same name in the same class hierarchy (While this is allowed in UML). So, maybe you should try to change the name of your redefined property.

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.


Regards,
Camille


Camille Letavernier
Re: Overriding Stereotype's properties and assigning them a value [message #1066685 is a reply to message #1066675] Wed, 03 July 2013 17:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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
Re: Overriding Stereotype's properties and assigning them a value [message #1066697 is a reply to message #1066685] Wed, 03 July 2013 19:44 Go to previous messageGo to next message
Matteo M. is currently offline Matteo M.Friend
Messages: 40
Registered: May 2012
Member
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 19:46]

Report message to a moderator

Re: Overriding Stereotype's properties and assigning them a value [message #1066723 is a reply to message #1066685] Thu, 04 July 2013 05:48 Go to previous message
Marc-Florian Wendland is currently offline Marc-Florian WendlandFriend
Messages: 83
Registered: January 2013
Member
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
Previous Topic:Which parts of the standard of SysML is supported?
Next Topic:How to show labels on activity diagram control flows
Goto Forum:
  


Current Time: Tue Apr 23 11:01:12 GMT 2024

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

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

Back to the top