Advanced Search (SQL)
You can use an SQL query language to search for elements. You can access the saved advanced search in the Find submenu.
Complex Search Queries
You can use an SQL query language to find elements in a more direct manner; this constrains the target sets for the search into various levels.
You require the Use Bulk Commands privilege for defining an advanced search.
Saving an advanced search with a name means that it can be found in the Find submenu and used by all users when searching through all models.
Search queries are formulated in the Advanced tab in the Find dialog.
Editor
IntelliSense
You can use the [Ctrl]+[Space] shortcut keys to open an IntelliSense list when formulating the expression; you can then select valid icons from here. The text in front of the insertion point acts as a filter.
The IntelliSense list always provides names of classes, stereotypes, properties and values in the model language. The search only works with a query formulated in the model language.
You must formulate specification texts and property values with the enumeration and string types as placeholders if you want to successfully run a search with a set display language.
Syntax Highlighting
Icons are colored depending on their function in the expression.
- Target Type
- Property Name
- Property Value
- Query Name
- Comment
Query Formulation Basics
Syntax Diagrams
Queries can be formulated using a syntax inspired by SQL.
The following syntax diagrams show the basic query grammar.
Root
Query
Target Type
Combined Properties (CombinedPropExpr)
Subquery
Collection (Collect)
Navigation (Navigate)
Search target - SELECT FROM
Sets the element type searched for and shown in the result region. Information is then displayed using an Innovator data model's metaclass or a stereotype.
Examples:
- Metaclass: #Class#
- Stereotype: «class» #Class# [ROOT PROFILE]
Note:
- The search expression is formulated in the interface language (see blow)
- You can choose whether to enter a class and profile for the stereotype. However, stereotypes with the same name might be searched for in different profiles or even those belonging to different metaclasses.
- Inverted commas « and » are created in the editor by entering << and >>.
Tip: it is considerably easier to select the target type from the IntelliSense list than type it in.
If the ELEMENTS keyword is used as target type, then the element type is not constrained upon the search.
Search criteria - WHERE
Element Property
A search criteria is the querying of the elements' property on a value; the property corresponds to the target type.
Properties are element properties, stereotype properties, labels and specification texts. The icon identifies the type of property in the IntelliSense list.
You can search in all specification texts regardless of the type of text by using the SPECIFICATIONS keyword.
A search criteria is usually a triple property name, operator and comparison value.
Value Types
The following table describes the types of values and their format:
Value Type | Format |
Examples |
---|---|---|
Boolean value | TRUE, FALSE |
TRUE FALSE |
Numeric value | Integer |
-7 42 |
Text | Text in single inverted commas |
'Search template' |
Enumeration value | Text in single inverted commas |
'In progress' |
Date |
'YYYY-MM-DD' 'YYYY-MM-DD hh:mm' |
TODAY '2019-11-19' '2019-05-27 14:57' |
Note:
- Possible values for enumeration types can be selected via IntelliSense.
- "TODAY" shows the current date of execution for date format.
Operators for Textual Values
The following table describes the operators for textual values and their function:
Operators | Function |
Compare entire text with the value or |
Take case sensitivity into consideration |
---|---|---|---|
=, <> | Same, different | Entire text | No |
LIKE | Search with simple text pattern (see "Simple Text Patterns") |
Entire text | No |
CONTAINS | Simple text search | Appears in text | No |
REGEXP | Text search with regular expressions (see "Using Regular Expressions") |
Appears in text | yes |
Unary Operators
These operators do not require a value.
-
IS NULL, IS NOT NULL
Check values that have not been set
Can be used for textual values, enumeration types and date formats
-
IS DEFAULT, IS NOT DEFAULT
Check to see if it is the same as the default value
Can be used for stereotype properties, labels and specification texts
Placeholders
Placeholders can be used in the $Name$ format in textual values. A dialog then appears when the search is called; you can use this to enter the placeholders's value.
Logical Operators
You can combine search criteria using AND or OR links.
Use round parenthesis if required.
Subquery
Search criteria cannot be formulated solely for elements of the target type; they must also be formulated for elements which are linked to the target type's elements. This is what subqueries are for.
For subqueries, you must enter the relationship that will occur when leaving the target type in order to obtain a new initial set. You can filter this set by entering a type if required. The search criteria then appear that can be used for the new initial set. An element meets the subquery if at least one hit occurs. A comparison with another number can also be entered if required.
Example: Search for all classes that have Java constructors with precisely two input parameters
SELECT FROM #Class# WHERE ( SELECT FROM "Own Operations" : «JavaConstructor» #Operation# [J2SE] WHERE ( SELECT FROM "Parameter" WHERE "Direction" = 'Input' ) = 2 )
Warning: The search result is always elements of the target type of the top-most SELECT FROM statement. Classes and not parameters are searched for in the example.
Target Type Extension – COLLECT
The type of searched element is set in the SELECT expression. The keyword COLLECT allows the target type to be changed as a relationship is followed, as is the case with subqueries. The search result then contains elements of both types.
Example: Search for classes and their operations
SELECT FROM #Class# COLLECT "Own Operations"
If the SELECT expression is constrained with a WHERE, then the constraint also effects the following COLLECT.
Example: search for classes with “entity” in the name and their operations
SELECT FROM #Class# WHERE "Name" CONTAINS 'Entity' COLLECT "Own Operations"
The COLLECT expression can be constrained with a WHERE, as is the case with SELECT.
Example: Search for classes and their operations with at least one parameter
SELECT FROM #Class# COLLECT "Own Operations" WHERE ( SELECT FROM "Parameter" ) > 0
As with subqueries, you can filter according to type.
Example: Search for classes and their operations with «operation» stereotype
SELECT FROM #Class# COLLECT "Own Operations" : «operation» #Operation# [ROOT PROFILE]
Multiple COLLECT expressions can follow on from one another.
Example: Search for classes, their operations and parameters
SELECT FROM #Class# COLLECT "Own Operations" COLLECT "Parameter"
Navigation via Relationships – NAVIGATE
The keyword NAVIGATE is used if elements of various target types should be searched for but these are not necessarily linked via a connection, as is the case with COLLECT elements.
Example: Search for classes and parameters of their operations
SELECT FROM #Class# NAVIGATE "Own Operations" COLLECT "Parameter"
Unlike with COLLECT, elements with the new target type are not added to the result set with NAVIGATE. COLLECT and NAVIGATE behave the same with regard to constraints using the WHERE expression or filtering of the type.
Combine Search Results Using UNION and EXCEPT
You can combine multiple queries with the UNION and EXCEPT keywords.
Results from two queries are combined using UNION.
Example: Search for all classes and entities
SELECT FROM #Class# UNION SELECT FROM # Entity#
Use EXCEPT to reduce the result of a query by the result of a second query.
Example: Search for all constructs of classes
SELECT FROM #Class# COLLECT "Own Operations" : «Constructor» #Operation# [UML 2]
EXCEPT
SELECT FROM #Class#
Use UNION and EXCEPT to combine saved queries. You can select these from the IntelliSense list if required.
Example: Search for all classes and entities (using the stored search "search for entities")
SELECT FROM #Class# UNION Search for entities
You can use both local and model-wide searches. If searches with the same name appear in both instances, then the local search is used upon execution.
A stored search also contains its search area. It retains this if it is called within another query.
If a stored search contains placeholders, then their values are queried using a separate dialog.
Comments
Comments are derived using two hyphens and extend to the target end. Comments are shown in gray.
Technical Features
Various inverted commas are used for metaclasses, stereotypes, profiles, names and values of properties. If these characters are included in the respective expression itself, then you need to prefix the backslash (\). The same applies for the backslash character itself.
Queries can be run in both interface languages. A target type such as #Class# will also be found on the German interface.
Restriction
Full query functionality only occurs for set model languages. Query values for the model language are also used for alternative display languages, but only queries without direct text work.
Specification texts and property values with the enumeration and string types are always searched for with the value in the query. We therefore recommend that you use placeholders when carrying out a search in a display language so that you can enter the language-dependent value during the search.