Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Jayson on March 23, 2021, 08:07:34 am

Title: Stereotypes based on Abstract UML types
Post by: Jayson 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 :-)
Title: Re: Stereotypes based on Abstract UML types
Post by: Paolo F Cantoni 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
Title: Re: Stereotypes based on Abstract UML types
Post by: Jayson 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 :-)
Title: Re: Stereotypes based on Abstract UML types
Post by: Eve 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.
Title: Re: Stereotypes based on Abstract UML types
Post by: Jayson 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 :-)
Title: Re: Stereotypes based on Abstract UML types
Post by: Eve 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.
Title: Re: Stereotypes based on Abstract UML types
Post by: Jayson 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 :-)
Title: Re: Stereotypes based on Abstract UML types
Post by: KP 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.
Title: Re: Stereotypes based on Abstract UML types
Post by: Jayson 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
Title: Re: Stereotypes based on Abstract UML types
Post by: Eve 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.
Title: Re: Stereotypes based on Abstract UML types
Post by: Jayson 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 :-)
Title: Re: Stereotypes based on Abstract UML types
Post by: Eve 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 (https://www.omg.org/spec/UML/20131001/UML.xmi)

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

For everything else search: OMG UML 2.5
Title: Re: Stereotypes based on Abstract UML types
Post by: qwerty 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.
Title: Re: Stereotypes based on Abstract UML types
Post by: Jayson 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
Title: Re: Stereotypes based on Abstract UML types
Post by: qwerty 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.
Title: Re: Stereotypes based on Abstract UML types
Post by: Jayson on March 26, 2021, 05:06:34 am
Ya, I mean the PDF.
I have precisely ZERO problem trawling through documentation WHEN I CAN UNDERSTAND IT.
But it is just hideous.

All I want is a list of abstract metaclasses and the concrete classes they can realize, but I am buggered if I can find that information in the PDF.
Title: Re: Stereotypes based on Abstract UML types
Post by: Geert Bellekens on March 26, 2021, 05:34:43 am
I don't know, I don't feel like it's that horrible.

You have to use Ctrl-Shif-F search to find the info you need, but in the end I always find what I need to know.

Compared to the ArchiMate specs I think it's even much better. Based on the UML specs you can say, without a doubt, that something is allowed, or not. (almost mathematical)
When you try to do the same based on the ArchiMate specs you only get to "yeah, probably, maybe, looks like it."

Geert
Title: Re: Stereotypes based on Abstract UML types
Post by: KP on March 26, 2021, 08:22:19 am
UML didn't change between versions 2.4 and 2.5 but the document was completely re-structured. Have a look at the 2.4 spec and see if the structure of the document suits you better; from your needs, it sounds likely.
Title: Re: Stereotypes based on Abstract UML types
Post by: qwerty on March 26, 2021, 08:31:16 am
Uh, for me the 2.5 was much better than its predecessor :-/ But honestly, you need a strong will or urge to bite into any of those docs. Written by eggheads for eggheads.

q.
Title: Re: Stereotypes based on Abstract UML types
Post by: Paolo F Cantoni on March 26, 2021, 09:27:04 am
Uh, for me the 2.5 was much better than its predecessor :-/ But honestly, you need a strong will or urge to bite into any of those docs. Written by eggheads for eggheads.

q.
I am forwarding the following (anonymous) email...

We warn q to show more respect to eggheads!  He may regret his outburst!  We will not stand by and watch our comrades disparaged without any action!!!

ELF   (Egghead Liberation Front)


Happy Friday everybody!   ;) ;)  (and q, take care!)  :-X

Paolo
Title: Re: Stereotypes based on Abstract UML types
Post by: qwerty on March 26, 2021, 09:45:19 am
Since the ELF is always opposing the Liberated Egghead Foundation (LEF) I'm certain my comrades already took measures! Romanes ite domum (or so)!

q,