Author Topic: Access list of Stereotypes  (Read 19844 times)

thomaskilian

  • Guest
Access list of Stereotypes
« on: May 05, 2006, 06:24:33 am »
I could not find this in the documentation. How can I get hold of multiple stereotypes via the automation interface? I only found the primary stereotype as a string. Nothing about a collection of stereotypes.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8570
  • Karma: +254/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Access list of Stereotypes
« Reply #1 on: May 05, 2006, 07:36:01 am »
Quote
I could not find this in the documentation. How can I get hold of multiple stereotypes via the automation interface? I only found the primary stereotype as a string. Nothing about a collection of stereotypes.
They're in:
    eaElement.GetStereotypeList()
as a comma separated list (as I recall)

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

thomaskilian

  • Guest
Re: Access list of Stereotypes
« Reply #2 on: May 07, 2006, 12:12:40 pm »
Thanks, Paolo. I'll check that tomorrow :-)

Sparx: This is not documented, is it?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Access list of Stereotypes
« Reply #3 on: May 07, 2006, 02:18:15 pm »
Actually I think it is, although if I remember correctly I needed to try it out before the documentation made sense. With the benefit of hindsight the docs improved somewhat...
No, you can't have it!

thomaskilian

  • Guest
Re: Access list of Stereotypes
« Reply #4 on: May 07, 2006, 09:02:14 pm »
The pointer was right :)

But why a comma separated list? Okay - there's likely no stereotype with a comma inside, but I'd expect a collection for things like that. Am I wrong?

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8570
  • Karma: +254/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Access list of Stereotypes
« Reply #5 on: May 07, 2006, 09:14:13 pm »
Quote
The pointer was right :)

But why a comma separated list? Okay - there's likely no stereotype with a comma inside, but I'd expect a collection for things like that. Am I wrong?
No you're not wrong, but then you'd NOT expect two ways of getting one of the stereotypes and one way to get the rest.

It's the EA UI (Unique Interface) again, this time at the automation level.

I suspect the UML specification precludes a comma as a legitimate character in a stereotype name.

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

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Access list of Stereotypes
« Reply #6 on: May 08, 2006, 04:28:59 am »
BTW, I think I remember from someplace that if you search on - or otherwise use or expect - the stereotypes to be separated by a 'comma space' pair, you will fail. EA will consider the space to be the first character of the latter stereotype and act accordingly, something you likely do not want.

Given that users or other software may format or expect lists for readability it is often worth running the stereotype lists through something like a regular expression filter in either or both directions.

Just thought I'd save you a bit of hair pulling when the time came.

David
No, you can't have it!

PDC

  • EA User
  • **
  • Posts: 86
  • Karma: +4/-0
  • Systems Engineer
    • View Profile
Re: Access list of Stereotypes
« Reply #7 on: February 09, 2024, 01:28:08 am »
Sorry if resurrecting such an old topic annoys people, but I thought this was a genuinely useful one that could do with a little bump.

The method GetStereotypeList is now documented (if it wasn't before?) and certainly works in my javascript.
https://www.sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/element2.html

It's useful to be able to query the full list of stereotypes. Even if it is still implemented as a comma-separated list, rather than a (more standard in EA?) Collection.


Happy for nobody to reply to this. I just see lots of discussions about the challenges of managing/querying multiple stereotypes per Element, and I only found this topic after much googling rather than via any meaningful link in the User Guide :)
Phil

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Access list of Stereotypes
« Reply #8 on: February 09, 2024, 08:08:55 pm »
makes me nostalgic, though...

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13171
  • Karma: +549/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Access list of Stereotypes
« Reply #9 on: February 09, 2024, 10:42:02 pm »
Wow, 2006, that's around the same time I joined this forum, when EA was this new and upcoming modelling tool.

Geert

Elpis

  • EA User
  • **
  • Posts: 36
  • Karma: +6/-0
  • Make MDA/MBSE vital.
    • View Profile
Re: Access list of Stereotypes
« Reply #10 on: February 16, 2024, 10:08:24 pm »
The method GetStereotypeList is now documented (if it wasn't before?) and certainly works in my javascript.
[...]
It's useful to be able to query the full list of stereotypes. Even if it is still implemented as a comma-separated list, rather than a (more standard in EA?) Collection.

And there is Element.StereotypeEx property which returns comma separated list, as well. But only names, not fully-qualified. I don't know whether GetStereotypeList() is any different on this aspect - no info in Sparx help.