Book a Demo

Author Topic: Redefining Stereotypes in MDG  (Read 5474 times)

peterc

  • Guest
Redefining Stereotypes in MDG
« on: September 18, 2019, 06:18:38 pm »
What I want to achieve are multiple stereotypes of a requirement element, sharing some tagged values but having a unique value as well. Users should be able to change the stereotype of an existing element if they realise that it should be a different type, retaining the tagged values entered.

Initially I defined each stereotype individually (extending each from the Requirement metaclass), but when the stereotype of an existing element is changed then all the entered values for each Tagged Value is lost.

Secondly, I used one stereotype as a base and then used «redefines» for the others. This worked to retain tagged values entered, but for a Tagged Value with the same name on the redefining stereotype (where I also define an initial value on each defined stereotype), the result is TWO tagged values on elements, with the same name, but different values (when the stereotype is changed on an existing element).
My base stereotype is named UR, with an Attribute named "Category" and Initial Value "Functional"; one of my redefined stereotypes is named "URNF", with an Attribute named "Category" and Initial Value "Non-Functional".  When I change an initial Functional requirement to Non-Functional, the element has two tagged values, Category = Functional and Category = Non-Functional!
What I would have expected is that a redefined stereotype would have REPLACED an existing Tagged Value with the same name, not added a second one - Am I correct in this assumption? If so, then it's a bug, but I might be wrong in my assumption.

Thirdly, I tried creating a stereotype as a base, without Tagged Values that need to be unique (in the above example, without Category), redefining all my desired stereotypes. This works, but also leaves the base stereotype selectable by users. I have not found any way that a stereotype defined in the MDG can be hidden - is there any way that I could achieve that? If there is a way to hide a stereotype from being available after redefining then this is a workaround - I do also have the _metatype attribute defined on all of my stereotypes.

I have deviated slightly from the Sparx guidance on using «redefines» - the instructions are to give the redefining stereotype the same name as the base, but obviously I want different stereotypes, so I have given them different names. As a final option, I did try my third option, with the same name on both the base and the redefined stereotype, but the extra Tagged Value in the redefining stereotype was missing (it looks like the redefinition in this case got ignored).

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Redefining Stereotypes in MDG
« Reply #1 on: September 18, 2019, 07:20:51 pm »
Consider putting the "Type" in a stereotype property. I don't think that you can achieve that varying sort of tagged values. You probably need to define a superset of stereotype properties and use only those valid for the Type. Maybe an add-in could assist here.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Redefining Stereotypes in MDG
« Reply #2 on: September 18, 2019, 09:02:30 pm »
Consider putting the "Type" in a stereotype property. I don't think that you can achieve that varying sort of tagged values. You probably need to define a superset of stereotype properties and use only those valid for the Type. Maybe an add-in could assist here.

q.
You can find examples like that in the BPMN MDG.
If you change the Activity Type, you get a different set of tagged values.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Redefining Stereotypes in MDG
« Reply #3 on: September 18, 2019, 10:31:28 pm »
I don't see any change in the TVs when changing the type.

q.

peterc

  • Guest
Re: Redefining Stereotypes in MDG
« Reply #4 on: September 19, 2019, 05:43:05 pm »
I see what Geert means - changing the taskType modifies what is available to select from. This is different to how I have so far created my MDG (where the user changes the stereotype). I'd have to figure out how to migrate existing models to a different way of implementing the elements but it should not be too difficult to script as I'll know what I've changed.

What I don't see from looking at the BPMN 2.0 Technology.xml MDG Technology file installed with EA is how that is achieved (I don't see anything conditional in there about when different "Tag name" entries are visible or not). The BPMN 2.0 technology is available in every EA variant - is (anyone) or could (Sparx) the EA model that is used to generate the BPMN technology be available as a reference of how to do quite complicated customisation? It would be a lot easier to look at how someone has already done this than to figure it out from the MDG Technologies PDF.

I looked at the EA example model that comes with every installation and the example in there is quite limited.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Redefining Stereotypes in MDG
« Reply #5 on: September 20, 2019, 08:56:44 am »
Unfortunately, the behavior you are describing in the BPMN technology is written into EA, not the technology.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Redefining Stereotypes in MDG
« Reply #6 on: September 20, 2019, 09:22:16 am »
I couldn't understand why I could not get rid of certain MDGs. Now I know. Doesn't make me feel better though since users keep turning on MDGs they should not be using.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Redefining Stereotypes in MDG
« Reply #7 on: September 21, 2019, 03:07:59 am »
Unfortunately, the behavior you are describing in the BPMN technology is written into EA, not the technology.
That's too bad. I was hoping to be able to use that mechanism in the future.

Geert

peterc

  • Guest
Re: Redefining Stereotypes in MDG
« Reply #8 on: October 16, 2019, 10:02:23 pm »
I've discovered the special attribute for a metaclass _hidestype:
"Set the 'Initial Value' field to a comma-separated list of stereotypes to hide those stereotypes by setting the 'Hide Stereotyped Features' filter for each new stereotyped model element."

I've tried just putting my base stereotype but that doesn't get hidden and I don't understand the second half of the above sentence! Should I be able to use that to hide one specific stereotype from being selectable, leaving the ones that redefine it?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Redefining Stereotypes in MDG
« Reply #9 on: October 17, 2019, 09:33:14 am »
'Hide Stereotyped Features'.

Referencing your base stereotype in that property won't have any impact unless you have also applied that base stereotype to attributes or operations on your type.