The Intelli-sense capabilities of Enterprise Architect are built using Sparx Systems' Code Miner tool. The Code Miner provides fast and comprehensive access to the information in an existing code base. The system provides complete access to all aspects of the original source code, either 'on the fly' as one might search in a code editor, or as search results produced by queries written in the Code Miner mFQL language.
On the Find in Files window, click on the 'Code Miner' tab.
Explore > Search > Files
The Code Miner Control
This control presents an interface for performing queries on several code bases at once. The code bases it uses are databases built using Enterprise Architect's Code Miner tool. These databases form a library, which can also be shared when deployed as a service. The queries that can be run are listed and selected using the toolbar, which allows easy access to the source code for the queries, for editing and composition. Queries do not need to be compiled; they are viewed, edited and saved as one would any source code file. Queries that take a single parameter can utilize any selection in an open code editor. The interface also supports manual parameter entry for queries that take multiple arguments.
The first control on the toolbar lists the namespaces available. Selecting a namespace limits the queries that are displayed to those within that namespace.
The next control provides a drop-down list of all the queries in the query file for the selected namespace.
The third control is an edit combo box. By default a single query parameter is taken from the selected text in an open code editor, but you can also type the parameter(s) directly into this field. Multiple parameters should be separated by commas. This is followed by theto run the query. Queries can be edited at any time using the next to the Search button.
The 'Result' panel is a tree control that lists the results of the query grouped by file.
Code Miner Libraries
Code Miner libraries are a collection of databases that can be used by Enterprise Architect Intelli-sense providers to obtain and query for information across several code bases. Each database is created from the root source code directory of a code base, using a specialized grammar appropriate for its language (C++, Java or C#).
The libraries are created, updated, removed or added in the 'Analyzer Script Editor'. A typical scenario for using this feature would be to create a database for a development project and additional databases for frameworks referenced by the project. Your development database can be updated frequently as code changes accrue, while the static frameworks would be updated less often. Libraries can be searched in a similar way to the 'File Search' tool, but Code Miner offers advanced search capabilities due to its mFQL language.
- Multiple domains / frameworks can be searched at once
- A query can be run in a fraction of the time required for a File Search
- Queries can be coded to assist with complex search criteria
- Queries can take multiple parameters
- All files are indexed based on equivalent UML constructs, allowing intelligent searches producing meaningful results in a modeling setting
Code Miner Query Files
Code Miner queries are maintained in a single source code file which should have the .mFQL extension. A basic set of queries is provided with each Enterprise Architect installation; these can be located in the config\codeminer sub directory. This query file should be named by default in any Analyzer Script you edit.
Before editing any queries it is advisable that you copy this file to a working location and name the copy in any Analyzer Script you use. This way you will always have a reference file to go back to.
Queries are best considered as functions that are written in the mFQL language. As such they have unique names, can be qualified by a single namespace and can specify parameters. The file provides the queries listed in the Intelli-sense control's toolbar. Whenever edits to a query file are saved, the queries listed in the search toolbar combo box will be updated accordingly. This image is an example of a simple query written in mFQL.