Model searches in Enterprise Architect

Knut Jetlund edited this page Dec 3, 2015 · 4 revisions

Home Basic UML Tools

Searching an EA Model

In EA, you can run model searches in order to quickly find elements of interest (not to confuse with searching using the Find in Project Browser button, accessible from the Project Browser Toolbar). Searches are accessible via Edit | Find in Project or Edit | Search in Model (Ctrl-F or Ctrl+Alt+A). Select a search in the Search drop-down list and click on the Run button.

Built-in searches

EA contains some predefined searches in category "Built-In" in the Search drop-down list.

built-in searches

Searches imported from an XML-file

Searches can be imported from an XML file (an XML file starting with tag <RootSearch>) using the Import Search button in the Search Builder Toolbar (make this toolbar visible by clicking on the Builder button). Searches imported from an XML-file will appear in the category "My Searches" in the Search drop-down list.

Searches part of an MDG Technology

An MDG Technology (an XML file starting with tag <MDG.Technology>) is imported using Tools | MDG Technology Import. Searches imported as part of an MDG Technology will appear in a category having the name of the MDG Technology in the Search drop-down list.

Creation of new search definitions

In EA, you can define your own searches (EA User Guide: Create Search Definitions). The most powerful searches are SQL searches enriched with EA-macros (Enterprise Architect files have by default Jet 3.5 as database engine, which is the same one as Microsoft Access is built on).

  1. Go to Edit | Find in Project (Ctrl-F or Ctrl+Alt+A).
  2. Click on the Builder button.
  3. Create a new search definition, give it a name and make sure that the Editor Type is SQL Editor.
    create new search definition
  4. Define your search in SQL, including macros if needed.
    search builder
  5. Select the element in the Project Browser you want to run the search on.
  6. Click on the Run button.

Using Searches for Validation

Searches can be used to point out classes, attributes or other UML-elements that do not conform to certain requirements or recommendations in standards and best practices.

TODO add examples

Sharing searches with others

Import and Export of Searches

The Export Search button in the Search Builder Toolbar displays a box where you can select the searches you want to export to an XML-file on your file system. This XML-file can then be imported by other people via the Import Search button.

Note that, if the file you import contains search definitions having the same name as search definition you already have, you'll end up with two search definitions with the same name.

It may be an option to store such an XML-file in the same repository as the UML-models.

Bundle searches in an MDG Technology


Tips & Tricks


If you have specified CLASSGUID and CLASSTYPE as part of the result set EA will render an according icon in front of each result line. Elements, Operations and Attributes can directly be opened via a double-click in the result set. Diagrams and Packages however do not open directly. Instead you have to locate them in the project browser via Alt-G and open from there [Inside Enterprise Architect] [EA User Guide].

select t_object.ea_guid as CLASSGUID, t_object.Object_Type as CLASSTYPE (, ...) from t_object
select t_attribute.ea_guid as CLASSGUID, 'Attribute' as CLASSTYPE (, ...) from t_attribute
select t_connector.ea_guid as CLASSGUID, t_connector.Connector_Type as CLASSTYPE (, ...) from t_connector
select t_diagram.ea_guid as CLASSGUID, t_diagram.Diagram_Type as CLASSTYPE (, ...) from t_diagram
select t_package.ea_guid as CLASSGUID, 'Package' AS CLASSTYPE (, ...) from t_package
select t_operation.ea_guid as CLASSGUID, 'Operation' AS CLASSTYPE (, ...) from t_operation


TODO: #Branch#

SQL with other tools


Further reading


You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.