Author Topic: Stereotypes based on Abstract UML types  (Read 3647 times)

Jayson

  • EA User
  • **
  • Posts: 352
  • Karma: +1/-0
    • View Profile
Stereotypes based on Abstract UML types
« on: March 23, 2021, 08:07:34 am »
Hi all

I am trying to figure out how to define stereotypes based on abstract types.
I am using the Profile Helpers as per usual, but when I drag the resulting stereotype onto the diagram, nothing seems to happen.
I've looked for documentation on abstract metaclasses, but I cannot find anything that provides some guidance on how to do this.

All and any help is appreciated.

Cheers :-)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8133
  • Karma: +228/-128
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #1 on: March 23, 2021, 12:05:25 pm »
Hi all

I am trying to figure out how to define stereotypes based on abstract types.
I am using the Profile Helpers as per usual, but when I drag the resulting stereotype onto the diagram, nothing seems to happen.
I've looked for documentation on abstract metaclasses, but I cannot find anything that provides some guidance on how to do this.

All and any help is appreciated.

Cheers :-)
Hi Jays,

I'm not sure what you mean by abstract metaclasses, but I can definitely state that if the stereotype is marked abstract, it will NOT be instantiated onto the diagram (ask me how I know...  ;))

We use abstract stereotypes extensively in our metamodel and have found them very useful for constructing hierarchies of properties that get assigned to the appropriate concrete stereotypes as required.

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

Jayson

  • EA User
  • **
  • Posts: 352
  • Karma: +1/-0
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #2 on: March 23, 2021, 12:11:15 pm »
Hey Paolo

Thanks for the response!
If you go into the Stereotype Profile Helper, the "Type" drop down offers four choices:

1. Element Extension,
2. Connector Extension,
3. Abstract Metaclass, and
4. Metaclass Extension.

It is #3 that I am talking about.

Cheers

Jays :-)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7707
  • Karma: +101/-18
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #3 on: March 23, 2021, 01:57:41 pm »
Extending an abstract metaclass will require you to manually specify in your toolbox profile which concrete metaclass you want to create.

EA can work it out for you if you specify a single concrete metaclass, while the profile helper will allow you to select which one you want if you extend multiple concrete metaclasses.
Eve

support@sparxsystems.com

Jayson

  • EA User
  • **
  • Posts: 352
  • Karma: +1/-0
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #4 on: March 23, 2021, 02:21:06 pm »
Please forgive my stupidity Eve as I am now more confused than before.
Got some follow up questions:

1. Whenever I create a Stereotype based on an abstract metaclass, I need to specify a concrete metaclass (such as Class or Association) in the toolbox (i.e. Class::AbstractStereotype). Is that correct?

2. If #1 is correct, what difference does selected difference concrete metaclasses (ie. Class, Association, Dependency) make on the element that appears on the page? That is, will there be any different if I specify Class vs Association in the toolbox?

3. What additional value do the metaclasses add? They don't seem to add any different custom properties. Is it more about different shape scripts or something else.

Sorry for the word salad of confusion!

Cheers

Jays :-)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7707
  • Karma: +101/-18
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #5 on: March 23, 2021, 06:12:44 pm »
I'll give some examples.

In my profile "ProfileX" I create stereotypes "StereotypeY" and "StereotypeZ".

StereotypeY extends the abstract metaclass "Classifier". StereotypeZ extends the concrete metaclass "Class".

The profile helper will allow you to create a reference to StereotypeZ, which will then define the item "ProfileX::StereotypeZ(UML::Class)". If you manually defined a toolbox item for "ProfileX::StereotypeZ", EA assume you want a Class, use that icon and create it as necessary. However, you can also apply that stereotype to an Activity because Activity is a kind of Class. In order to add that to the toolbox though you would need to explicitly add "ProfileX::StereotypeZ(UML::Activity)".

In the case of StereotypeY, there's a whole set of possible metaclasses that you could want to apply the stereotype to. The profile helper does not have the functionality to show all the specializations of the metaclasses you are extending, and the only one that is being extended is not something that can be created. So, you need to explicitly specify in the toolbox which of the possible metaclasses that you want to create.

The metaclass allows you to specify which of the UML types you are basing your element on. As an example, you'll get very different behavior when you ask to create a Class and a Dependency.
Eve

support@sparxsystems.com

Jayson

  • EA User
  • **
  • Posts: 352
  • Karma: +1/-0
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #6 on: March 24, 2021, 03:48:13 am »
Argh! My brain hurts! LOL!

Thanks for that Eve.

So, some follow up Qs:

1. In the case of StereotypeY, I CANNOT create a toolbox item ProfileX::StereotypeY(UML::Classifier) cos that won't work. Correct?
2. But I CAN create a toolbox item ProfileX::StereotypeY(UML::Class) and that will instantiate a StereotypeY base on Class when dragged onto the diagram, correct?
3. So, what benefit does specifying Classifier in StereotypeY actually offer if I can't instantiate it? Why would I just not create StereotypeY with metaclass "Class" to begin with?

Cheers
Jays :-)

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2888
  • Karma: +52/-3
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #7 on: March 24, 2021, 08:16:01 am »
So, what benefit does specifying Classifier in StereotypeY actually offer if I can't instantiate it?


StereotypeY can be applied to any concrete specialization of Classifier (e.g. Class, Activity, Interface, UseCase, Actor, Node, Device, Component etc). When dropping a StereotypeY from the toolbox, you have to tell EA in advance which you want.
The Sparx Team
support@sparxsystems.com

Jayson

  • EA User
  • **
  • Posts: 352
  • Karma: +1/-0
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #8 on: March 24, 2021, 08:22:15 am »
Ahhhhh! Awesome! That clears it up - I think  ;).

Hopefully only one more question: Where can I find a list of the valid concrete classes for each abstract class?
I know and I mean REALLY know that you are going to tell me to look at some obscure UML documentation.

However, is there ANY chance of providing me to a link that has a look up table (or similar) for this?
I find trying to find anything in the UML specification to be about as easy as taking a kick to the groin!  ;D

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7707
  • Karma: +101/-18
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #9 on: March 24, 2021, 08:46:34 am »
Our user guide doesn't try to explain everything in the UML metamodel, so yes, the specification is where to get that information.

Instead of scouring through the pdf looking for the information you want though. Download the XMI for UML and import it into Enterprise Architect. Do a search for the metaclass you want and look at the traceability window for all specializations.

However, unless you're writing a profile where the semantics of the UML metamodel beneath is important (and you probably aren't) it's probably easier to just stick with a simple set of concrete metaclasses. A profile extending only Class, Association and Dependency is perfectly reasonable.
Eve

support@sparxsystems.com

Jayson

  • EA User
  • **
  • Posts: 352
  • Karma: +1/-0
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #10 on: March 24, 2021, 10:11:02 am »
I'm afraid my google-fu is not as good as yours.
Are you able to point me to the XMI file?

Cheers :-)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7707
  • Karma: +101/-18
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #11 on: March 24, 2021, 12:12:22 pm »
Sorry, I copied the url intending to add it to my post.

https://www.omg.org/spec/UML/20131001/UML.xmi

Which comes from https://www.omg.org/spec/UML/2.5/About-UML/.

For everything else search: OMG UML 2.5
Eve

support@sparxsystems.com

qwerty

  • EA Guru
  • *****
  • Posts: 12729
  • Karma: +361/-295
  • I'm no guru at all
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #12 on: March 25, 2021, 12:56:47 am »
The XMI is helpful for searching, but it comes with no diagrams/extra explanation. I create temp class diagrams to gather things I want to visualize. For a full description you need to download the UML PDF description from OMG (somewhere near the XMI source too).

q.

Jayson

  • EA User
  • **
  • Posts: 352
  • Karma: +1/-0
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #13 on: March 26, 2021, 04:41:16 am »
Cheers q.
Unfortunately I am rarely able to make any sense of that document.

It really is like they've gone out of their way to make like as hard as possible when writing it.
Maybe some ex-Sparx people wrote it?  ;D

qwerty

  • EA Guru
  • *****
  • Posts: 12729
  • Karma: +361/-295
  • I'm no guru at all
    • View Profile
Re: Stereotypes based on Abstract UML types
« Reply #14 on: March 26, 2021, 04:49:52 am »
You mean the PDF? That's indeed nothing you lay under the pillow for an evening lecture.

q.