Book a Demo

Author Topic: Stereotype on constraints in UML Profile  (Read 3972 times)

potterm

  • EA User
  • **
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Stereotype on constraints in UML Profile
« on: December 03, 2006, 04:40:10 am »
I'm not sure whether I'm doing something wrong or whether this is bug, but here goes...

Basically I want to create a stereotyped constraint that shows an alternative image to the default "note-like" format used for constraints.

So I've created a stereotype "timingConstraint" that is associated with a ShapeScript which draws an hour-glass.   When this stereotype is applied to constraints it all works perfectly - I get an hour glass instead of the default note-like constraint.

However, I now want to include this stereotype in a UML profile, so I created it in a profile package as follows:
  • stereotype class "timingConstraint" with an _image attribute containing the ShapeScript (i.e. using the undocumented mechanism for including a ShapeScript in a UML Profile, as detailed in other posts on this forum)
  • a metaclass "Constraint" which the stereotype class extends
This all seems to work OK - the profile generates and I can import it into my model and show the stereotype constraint in the toolbox.  However, when I drag the stereotyped constraint onto the diagram two things go wrong:
  • It gets displayed in note format rather than using the stereotyped ShapeScript
  • Editing the resulting constraint gives me a Notes dialog rather than the normal Constraint dialog. In fact the icon created in the toolbox by this profile seems to create note elements rather than constraint elements.
Investigating further, I discovered that on import the profile actually creates two stereotypes rather than the single one I intended:
  • A first "timingConstraint" stereotype with a base class of "note".
  • A second "timingConstraint" stereotype with a bass class of "constraint". (Edit: and it includes the ShapeScript created within the original profile).
So it seems as if the profile is either getting generated incorrectly, or imported incorrectly (or I'm doing something wrong).

Any clues anyone?

Thanks,
Martin.
« Last Edit: December 03, 2006, 04:42:54 am by potterm »

potterm

  • EA User
  • **
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Re: Stereotype on constraints in UML Profile
« Reply #1 on: December 03, 2006, 04:49:31 am »
One further point - looking at the resulting XML generated for the profile it makes no reference to "note" elements whatsoever.  The <Apply type> tag has the value "Constraint", so it seems as if this could be an issue with the import of the profile...

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Stereotype on constraints in UML Profile
« Reply #2 on: December 03, 2006, 05:52:59 am »
Stereotype import is cumulative.

Check there is NO timingConstraint stereotype defined prior to import.  We've been caught by this before.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

potterm

  • EA User
  • **
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Re: Stereotype on constraints in UML Profile
« Reply #3 on: December 03, 2006, 07:30:41 am »
Thanks for the suggestion Paolo - yes I did check for this, and just to be absolutely certain I imported the profile into a completely clean (i.e. new) model, but get the same behaviour.

It seems to be the stereotyped constraint that is causing problems - for some reason EA treats it as a stereotyped note when imported through a profile.

Martin.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Stereotype on constraints in UML Profile
« Reply #4 on: December 03, 2006, 01:12:51 pm »
Quote
Thanks for the suggestion Paolo - yes I did check for this, and just to be absolutely certain I imported the profile into a completely clean (i.e. new) model, but get the same behaviour.

It seems to be the stereotyped constraint that is causing problems - for some reason EA treats it as a stereotyped note when imported through a profile.

Martin.
Definitely a bug - report it through the formal channels.

It's probably caused by the fact that Constraints and Notes attached to edges use the same mechanism and EA is getting confused.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!