Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: ngong on October 09, 2020, 03:50:46 am

Title: How to delete spurious stereotypes?
Post by: ngong on October 09, 2020, 03:50:46 am
In my models I am using stereotypes derived from a project specific profile definition.
I do updates to the profile on demand, import the new one to the model by overriding the old one, and sync the stereotypes with the model.
Now it happened that an information-flow shows an old name of a renamed stereotype. Unfortunately, renamed stereotypes are not updated on sync.
But worse, the old name stands as the first stereotype of the information-flow, pretending to be part of the profile.
When I try to deselect it, it is not checked, the old name is not there and the new one is not checked.

How can I delete a spurious stereotype? Are scripting (how?) or xmi export / change with notepad++ / xmi import the only choices?
How to delete any stereotype from an element?

You may download an example here (http://shorturl.at/tCF39): how to delete the stereotype Profile::stereotype from the information flow?
Title: Re: How to delete spurious stereotypes?
Post by: qwerty on October 09, 2020, 04:00:13 am
Repository.Execute("DELETE FROM t_stereotypes")


q.
Title: Re: How to delete spurious stereotypes?
Post by: Geert Bellekens on October 09, 2020, 04:02:58 am
You could also do it directly in the database.

The only "other" choice is to write a query that gets you all the elements, and then update them manually.

In a script you could

- get the items with the old stereotype based on a query
- update each items StereotypeEx field with the fully qualified new stereotype
- you might need to delete some tagged values as well if they no longer exist in the new stereotype.

Geert
Title: Re: How to delete spurious stereotypes?
Post by: Geert Bellekens on October 09, 2020, 04:04:08 am
Repository.Execute("DELETE FROM t_stereotypes")


q.
Yeah, that will prevent users from using the stereotype on new items, but the old ones will still have the old stereotype.

Geert
Title: Re: How to delete spurious stereotypes?
Post by: qwerty on October 09, 2020, 04:07:12 am
Right, eliminating rubbish is a bit more difficult. This one just should be run once a week...

q.
Title: Re: How to delete spurious stereotypes?
Post by: ngong on October 09, 2020, 04:49:57 am
If I could delete the stereotype manually I would be happy.
Title: Re: How to delete spurious stereotypes?
Post by: qwerty on October 09, 2020, 05:46:29 am
No. Only for a single appearance. For a global delete you need to script it.

q.
Title: Re: How to delete spurious stereotypes?
Post by: KP on October 09, 2020, 08:33:04 am
In my models I am using stereotypes derived from a project specific profile definition.
I do updates to the profile on demand, import the new one to the model by overriding the old one, and sync the stereotypes with the model.
Now it happened that an information-flow shows an old name of a renamed stereotype. Unfortunately, renamed stereotypes are not updated on sync.
But worse, the old name stands as the first stereotype of the information-flow, pretending to be part of the profile.
When I try to deselect it, it is not checked, the old name is not there and the new one is not checked.

How can I delete a spurious stereotype? Are scripting (how?) or xmi export / change with notepad++ / xmi import the only choices?
How to delete any stereotype from an element?

You may download an example here (http://shorturl.at/tCF39): how to delete the stereotype Profile::stereotype from the information flow?

So are you saying that if you remove a stereotype from a profile then you can't remove the now non-existent stereotype from an element because it's not listed in the stereotype picker dialog? I believe that used to be a bug but has now been fixed. Maybe upgrade.

Or, if all else fails, export to XMI, hand edit the XMI, import the XMI.
Title: Re: How to delete spurious stereotypes?
Post by: qwerty on October 09, 2020, 08:55:57 am
´You may download an example here (http://shorturl.at/tCF39)
That's just a link to shorturl, not to your model.

q.
Title: Re: How to delete spurious stereotypes?
Post by: Sunshine on October 09, 2020, 10:05:33 am
I usually fix those issues with a JScript as I don't have a DB tool installed on my desktop and our organisation's policies prevent those in production.
IIRC I did share it somewhere in this forum


Think its was here
https://www.sparxsystems.com/forums/smf/index.php/topic,39510.msg244620.html#msg244620 (https://www.sparxsystems.com/forums/smf/index.php/topic,39510.msg244620.html#msg244620)
and the code is here
https://sparxsystems.com/forums/smf/index.php/topic,30653.msg223132.html#msg223132 (https://sparxsystems.com/forums/smf/index.php/topic,30653.msg223132.html#msg223132)


Hope that helps
Title: Re: How to delete spurious stereotypes?
Post by: ngong on October 09, 2020, 10:55:05 pm
@KP: I installed 15.2, and you are right: the problem is gone. I can remove the stereotype.
thank you for hint.