Term Filters

Term filters are used to select specific classes, relations, or instances from an ontology. As described in Building Filters, the attribute, value, comparison, and aspect for a filter are specified in the Term Filtering panel (aka Search Panel):

filtering image

You can open the main filtering control with [Search] -> [Search Panel]. In some components, such as the Ontology Tree Editor and the Graph Editor, you can apply a filter in the component configuration panel (see Components for more information).

The search interface supports simple and compound queries. A simple search with only one criterion looks like this:

This search finds only terms where the name exactly matches 'development'.

The text field, where you type the value, provides an autocompletion feature:

Clicking on any of the suggested terms will automatically fill it into the text box.

Use the dropdown menus to choose whether to find terms that do (have) or do not (don't have) match the filter criteria, and to select the attribute and comparison. Click the button to show the aspect selector (when the aspect dropdown is showing, click to hide it). See Building Filters for explanations of the aspect, attribute, and comparison options.

Compound Filters

Simple queries such as the above example can be combined to perform complex searches using multiple criteria, subqueries, etc. To add a new criterion to a search, click the button in the lower left corner. A new set of dropdown menus and a new text box will appear:

Click to delete a line from the query.

When you have more than one search row, two more buttons appear, allowing you to perform AND or OR queries:

In the example above, "Matches all" is selected, so the query will find terms that match both criteria (equivalent to Boolean AND). If "Matches any" were selected, the query would find any terms that match either criterion (Boolean OR).

Subqueries

To create a subquery, add a search criterion as above, then click the button to indent the line for that criterion. Any additional criteria you add using the button will appear at the same level of indentation; to move a criterion out a level, use the button.

For example, if you want to query for terms that have 'development' in the name, and either 'R6' in the name or 'R8', set up this query:

Step-by-step instructions to construct this query:

You can also move existing query elements by dragging and dropping using the vertical blue bar at the left-hand edge of each criterion line.

Very complex queries with multiple levels of nesting can be created, e.g.:

How Compound Filters Are Matched: Speeding Up Your Searches

Compound filters are matched by evaluating whether their constituent filters match.

Constituent filters are matched in the order they were specified. The evaluation stops if the value of the compound filter can be determined, even if all the constituent filters have not been checked. For example, if the boolean operation is AND and one of the constituent filters doesn't match, the evaluation stops and the entire compound filter announces that it doesn't match (because if even one term of an AND expression is false, the whole expression is false). Similarly, if the boolean operation is OR and a constituent filter matches, the evaluation stops and the entire compound filter announces that it matches (if even one term of an OR expression is true, the whole expression is true).

Therefore: When constructing a compound filter, put filters that can be evaluated quickly FIRST. For example, it takes a long time to do any search with an "Ancestor" or "Descendant" search aspect, because all the descendants or ancestors of every term in the ontology have to be calculated. So add any filters that use an ancestor or descendant last, and add quickly evaluated filters first. That way slow filters don't have to be evaluated unless absolutely necessary, and the whole filtering operation will work more quickly.

Debugging Queries

The query debugging system can be useful for constructing queries that find the desired set of terms, and for tracking down why a particular filter does or doesn't match a given term. If the term(s) selected in the ontology editor panel fit(s) the criterion next to the lightbulb icon, the icon turns yellow ; if the term does not match, the lightbulb stays gray as in the Synonym filter below:

Results

The results of a query are displayed in a list; if any obsolete terms match, they are shown in red strikethrough:

To select a term of interest in an Ontology Tree Editor (in global selection mode) you can just click on the term in the search results list.

If you have performed multiple searches, you can scroll through the various search result tabs using the left and right arrow icons, or click the down arrow to see a pulldown list of search result panels:

Each search result panel is a component, and can be manipulated independently like any other component panel.