Book a Demo

Author Topic: Extract association element-stereotypes  (Read 5491 times)

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Extract association element-stereotypes
« on: August 29, 2023, 06:02:09 pm »
Hi,

I assigned two stereotypes to an element. If I open the properties mask I see that the two stereotypes have been assigned.
1. In the t_object table I see that the first of the two stereotypes has been assigned for that element. In which table do I find the other assignment?
2. In the case of this multiassignment, there is also a way to extract which element a stereotype is associated with without using SQL, using the tool directly (e.g., the search mask)

Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Extract association element-stereotypes
« Reply #1 on: August 29, 2023, 06:08:26 pm »
1. t_xref is where the stereotype details are stored.
2. You can see the assigned stereotypes in the properties.

Geert

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Re: Extract association element-stereotypes
« Reply #2 on: August 30, 2023, 05:46:21 pm »
   My element 'OrgEinStereo' has two stereotypes: OC_Role, RVS_OrgEin
   
   
Code: [Select]
select * from t_object where name like 'OrgEinStereo'   
   I find that Stereotype = 'OC_Role" and ea_guid = '{10682E9B-0BF8-480a-8BC9-FC56A96F9894}'
   
   
Code: [Select]
select * from t_stereotypes where stereotype like 'RVS_OrgEin'   
   I find that ea_guid  ={7A22F652-C7F9-4dd1-8E78-6F2BDC8F8C43}
   
   
Code: [Select]
select * from t_xref where client = '{10682E9B-0BF8-480a-8BC9-FC56A96F9894}'   
   XrefID = {454471C6-7FA0-4089-A7D7-C1B85F30D7BB}
   Name = Stereotypes
   Type = element property
   Visibility = Public
   Partition = 0
   Description = @STEREO;Name=OC_Role;FQName=StrategyMap::OC_Role;@ENDSTEREO;@STEREO;Name=RVS_OrgEin;GUID={7A22F652-C7F9-4dd1-8E78-6F2BDC8F8C43};@ENDSTEREO;
   Client = {10682E9B-0BF8-480a-8BC9-FC56A96F9894}
   Supplier = <none>
   
   
I find the GUID of the stereotype in the Description field. This means that I need to find the reference to the stereotype in this field. Should I use e.g. this query? Or is there a field in the xref table that gives me the reference immediately?


Code: [Select]
SELECT s.*
FROM (SELECT substring(value, charindex ('=', value) +1, len (value)) as ea_guid, client
FROM t_xref 
CROSS APPLY STRING_SPLIT(description, ';')
where name = 'Stereotypes'
and value like 'GUID%'
) as xref_stereotype
join t_stereotypes s on s.ea_guid = xref_stereotype.ea_guid
join t_object o on o.ea_guid = xref_stereotype.client
where o.name like 'OrgEinStereo'
   
« Last Edit: August 30, 2023, 05:47:53 pm by ea0921 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Extract association element-stereotypes
« Reply #3 on: August 30, 2023, 05:58:19 pm »
You shouldn't rely on t_stereotypes at all.

Most stereotypes will not be there. Simply use the fields in the t_xref.Description column.

Geert

PS. Using multiple stereotypes is not a good idea and leads to all kinds of complications. Much easier to use a single stereotype.