Book a Demo

Author Topic: search in stereotype  (Read 6637 times)

deefer

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
search in stereotype
« on: July 29, 2009, 05:51:36 pm »
Hi
I'm trying to build a search that looks for a keyword in the element stereotype.
The problem is that some elements have more than one stereotype, but the search doesn't look for the keyword in the other stereotypes, only in the first.
Do you have some suggestions?
Many thanks
Davide

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: search in stereotype
« Reply #1 on: July 29, 2009, 05:58:50 pm »
you can always define an SQL search.
That will allow you to search for anything.

deefer

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: search in stereotype
« Reply #2 on: July 29, 2009, 06:31:53 pm »
Thank you.

I've looked in the XML file of the model and I've discovered that the second stereotype is stored in a special tagged value called $ea_xref_property

do you know how to get that tagged value with an SQL query?
« Last Edit: July 29, 2009, 06:32:25 pm by davideferrari »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: search in stereotype
« Reply #3 on: July 29, 2009, 07:05:38 pm »
Deefer,

You should not be looking in the XMI file, but in the database.
Apparently the table t_xref keeps the references to the stereotypes. (maybe in addition to the "Steretoype" field on the t_object table)

Geert
« Last Edit: July 29, 2009, 07:05:55 pm by Geert.Bellekens »

deefer

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: search in stereotype
« Reply #4 on: July 29, 2009, 07:22:38 pm »
Many thanks, it is the right table.

How did you get to know about this t_xref table? (It is not listed in the SQL search list of tables...)

Davide
« Last Edit: July 29, 2009, 07:22:52 pm by davideferrari »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: search in stereotype
« Reply #5 on: July 29, 2009, 07:29:53 pm »
search the forum :-)

deefer

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: search in stereotype
« Reply #6 on: July 29, 2009, 09:20:32 pm »
Do you know whether the SQL query supports wildcards?
I'm trying to use this synthax:

SELECT * FROM t_xref WHERE t_xref.Description LIKE '%keyword%'

but i doesn't produce any result when I specify any keyword...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: search in stereotype
« Reply #7 on: July 29, 2009, 09:33:03 pm »
Yes it does, but there are certain rules that you have to follow.
Here is an example of an SQL search I wrote:
Code: [Select]
select collaboration.ea_guid as CLASSGUID,'Collaboration' as CLASSTYPE,collaboration.name as Name
,package.name as 'Package Name',package_p1.name as 'Package level -1',package_p2.name as 'Package level -2',package_p3.name as 'Package level -3'
from t_connector c
join t_diagram d on (c.diagramID = d.diagram_id)
join t_object collaboration on (d.parentid = collaboration.object_id)
join t_package as package on (collaboration.package_id = package.package_id)
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.name like '<Search Term>' + '(%)'

The important things are to include CLASSGUID, CLASSTYPE and Name, and the use of the '<Search Term>'.
Other then that you can use any SQL construct you like, as long as it is supported by the database underneath.
The above query was written for SQL server, and might not work on a local EAP file (MS Access). That last one is a bit tricky since it doesn't support standard SQL but uses it's own dialect.

deefer

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: search in stereotype
« Reply #8 on: July 29, 2009, 10:06:42 pm »
Many thanks Geert !

I've found the correct synthax for the .eap file (that I'm using):

SELECT * FROM t_xref WHERE t_xref.Description like '*keyword*'

Davide

deefer

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: search in stereotype
« Reply #9 on: July 30, 2009, 05:01:08 pm »
So, to recap, I've created this search that looks for a keyword in the requirements stereotype (also in the t_xref table)

SELECT ea_guid AS CLASSGUID, Object_Type AS CLASSTYPE, * FROM t_object, t_xref WHERE (t_object.Object_Type like '*requirement*') AND (t_object.ea_guid = t_xref.Client) AND (t_xref.description like '*keyword*') ORDER BY t_object.Package_ID

It can be used also for a RTF document generation

Cheers
Davide

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: search in stereotype
« Reply #10 on: July 30, 2009, 06:06:44 pm »
if you replace *keyword* with *<Search Term>* you can even use the Search Term box in EA and you don't need to change the SQL every time you wish to search for another keyword.

Geert

deefer

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: search in stereotype
« Reply #11 on: July 30, 2009, 06:49:30 pm »
Good idea, many thanks!