Author Topic: Stereotype from Profile (A<=B<=C) C.Stereotype gives me B, but how do I find A  (Read 2275 times)

David Rains (bioform)

  • EA User
  • **
  • Posts: 83
  • Karma: +0/-0
    • View Profile
So I have a root stereotype sedEntity (purpose is to keep a collection of elements identified and inheriting a shared set of tagged values) that is NOT exteneded, but is then stereotyped into others(e.g, cvTerm and cvSynonym as classes; cvGlossary as package, ... as an association, etc,)

When I am writing some script automation, I need to verify early that the element that has been selected is a stereotyped sedEntity, I can see the element's stereotype, but how do I determine the next one up the chain, so to speak...

Looking at the tagged window, I see cvTerm:Dog and its tagged values, and under that sedEntity: Dog and the sed tagged values... but what is the repository path or where in the repository table structure would these be found....

Thanks (Been away from EA for a bit, but it is becoming a major part of my paying job again!! Yipee!!) So having to knock off some serious rust...

Takeshi K

  • EA User
  • **
  • Posts: 425
  • Karma: +17/-1
    • View Profile
Hello David,

Element.HasStereotype() might help you. Please see the help in detail.

HTH,
--
t-kouno

qwerty

  • EA Guru
  • *****
  • Posts: 12825
  • Karma: +366/-295
  • I'm no guru at all
    • View Profile
MDG stereotypes are stored in t_xref (with some crude encoding in a string containing @STEREO in the Description). You can also lookup EAElement.stereotypeEx which contains all stereotypes as comma separated list (hopefully none of your stereotypes contains a comma :-/).

q.

David Rains (bioform)

  • EA User
  • **
  • Posts: 83
  • Karma: +0/-0
    • View Profile
Well, this seems a bit more complicated t_xref is the correct place a for an element with multiple stereotypes, however, my need is for a stereotyped element based on a stereotyped element in a profile. Turns out that in that case, there is ONLY 1 stereotype string (not 2) embedded in the description field.

I tried several ways of looking back through t_stereotypes ("A" is not listed there, I think because it is never extended?)... so I can still determine my "is this an "A" stereotype" function by testing for the presence of an inherited tagged value not quite as clean, but will work for now...

The good thing is EA is showing the stereotype(s) and both sets of inherited tags on that "Tagged Value" window so it should be accessible just a matter of figuring it out later... any other ideas would be appreciated...

David aka "bioform:


KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2901
  • Karma: +52/-3
    • View Profile
Stereotype generalizations aren't stored in the database, they are extracted from the UML profile at runtime and held in memory. If the profile is under your control, maybe the simplest solution would be to hard code a map of generalizations in your script/addin.
The Sparx Team
support@sparxsystems.com

David Rains (bioform)

  • EA User
  • **
  • Posts: 83
  • Karma: +0/-0
    • View Profile
Okay KP, that is good to know! I spent some time trying to follow the links back across the profile diagram to no good outcome...

So my workaround was to add a placeholder TV in the stereotype that I can look for... E.g. Class Stereotype Neo, added TV isTheOne, boolean, Const, True
So all of my stereotypes that are related in my profile, are generalizations of this base stereotype (Neo) with an inherited TV (isTheOne), if I find it, then there you go...

Anyone think of a better solution?  This is not actually an Add-In, but rather a working prototype (profile/scripts) I can use and experiment with before identifying the requirements of the Add-In...
« Last Edit: September 06, 2018, 03:24:08 am by David Rains »