Book a Demo

Author Topic: Searching for stereotypes  (Read 5641 times)

William McKenzie

  • EA User
  • **
  • Posts: 61
  • Karma: +0/-0
    • View Profile
Searching for stereotypes
« on: February 09, 2012, 12:52:12 pm »
I'm trying to develop a model search to find elements with a given stereotype.  But the built-in query builder only seems to look at the primary stereotype.  What I want to search for is any element that has my stereotype applied as an additional stereotype.

Do I need SQL for this?

Any samples?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Searching for stereotypes
« Reply #1 on: February 09, 2012, 06:02:24 pm »
William,
Yes I think you need an SQL Search.
Try this one:
Code: [Select]
select c.ea_guid as CLASSGUID,c.object_type as CLASSTYPE,c.name as Name, c.stereotype as Stereotype
,xref.Description as AllStereotypes
,package.name as PackageName ,package_p1.name as PackageLevel1,package_p2.name as PackageLevel2
,package_p3.name as PackageLevel3
from (((((t_object c
inner join t_package as package on c.package_id = package.package_id)
left join t_xref as xref on xref.Client = c.ea_guid )
left join t_package as package_p1 on package_p1.package_id = package.parent_id)
left join t_package as package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on package_p3.package_id = package_p2.parent_id)
where
c.Stereotype like '#WC#<Search Term>#WC#'
or
(xref.Name = 'StereoTypes'
and xref.Description like '#WC#<Search Term>#WC#')

Geert

William McKenzie

  • EA User
  • **
  • Posts: 61
  • Karma: +0/-0
    • View Profile
Re: Searching for stereotypes
« Reply #2 on: February 10, 2012, 01:17:19 am »
Thanks, Geert.  That worked - sort of  :)

Funny thing, it works in the search dialog, but not when I try to use it in the Relationship Matrix.  Is it possible I need to select additional columns to make it appropriate for the Relationship Matrix?



~Bill

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Searching for stereotypes
« Reply #3 on: February 10, 2012, 06:31:33 am »
Sorry, I wouldn't know. I've never really used matrices that much.

Geert
« Last Edit: February 10, 2012, 06:32:11 am by Geert.Bellekens »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Searching for stereotypes
« Reply #4 on: February 10, 2012, 09:24:51 am »
Quote
Thanks, Geert.  That worked - sort of  :)

Funny thing, it works in the search dialog, but not when I try to use it in the Relationship Matrix.  Is it possible I need to select additional columns to make it appropriate for the Relationship Matrix?



~Bill
How would you apply any search at all in a relationship matrix? You only have profiles here.

q.

William McKenzie

  • EA User
  • **
  • Posts: 61
  • Karma: +0/-0
    • View Profile
Re: Searching for stereotypes
« Reply #5 on: February 10, 2012, 10:16:09 am »
In both the source and target of the matrix, you can either select a model node and filter by type, or 'Apply Model Search'.  When I apply model search using the SQL above, I get no elements in respective axis, even though the search works fine from Edit->Model Search.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Searching for stereotypes
« Reply #6 on: February 10, 2012, 07:53:26 pm »
I see. The problem here is that the SQL search is really a wild one. You can return "bad" things. The default search with filters is much more strict. And thus it's the only allowed selection. Btw.: I didn't know about it so it's been introduced in a not too old release. In former releases you only had the browser navigation.

q.