.. _section-KB Search: KB Search ~~~~~~~~~ The **KB Search** plugin can be used to search for identifiers in the KB. To perform searches on all local and imported ontology files, click the **All Flora Files** option under **Filtering Options**, as shown in :numref:`figure-KB-Search-file-scope-all.png`. On the other hand, to perform searches on identifiers belonging to only the current project or only the currently active ontology files, click the **Current Project** or the **Current KB** option. .. _figure-KB-Search-file-scope-all.png: .. figure:: ../../figs/KB-Search-file-scope-all.png :alt: Filtering Options for KB Search: **All Flora Files, Current Project** and **Current KB** Filtering Options for KB Search: **All Flora Files, Current Project** and **Current KB** **KB Search** uses filtering rules as search criteria. Under **Filtering Rules** in the **KB Search** window, a pull-down menu with 5 filtering options is available for each filtering rule to scope down the search space, as shown in :numref:`figure-KB-Search-rules.png`. .. _figure-KB-Search-rules.png: .. figure:: ../../figs/KB-Search-rules.png :alt: Five different options are available: **Head, Descriptor, Filename, Type, Body** for **Filtering Rules** Five different options are available: **Head, Descriptor, Filename, Type, Body** for **Filtering Rules** Each filtering rule can be further augmented with an input. Click in the white space after **contains identifier** to enable the field for input. Then type in a word, for example, son. The **SonRule** should be returned in the table below as a match. :numref:`figure-KB-Search-all-head-matches-son.png` shows the filtering rule and the match found in the **KB Search** results table. .. _figure-KB-Search-all-head-matches-son.png: .. figure:: ../../figs/KB-Search-all-head-matches-son.png :alt: KB Search using **All Flora Files** with rule: **Head** containing **son** KB Search using **All Flora Files** with rule: **Head** containing **son** Additional filtering rules can be appended to the list, and existing rules can be removed from the list. To add an extra rule, click the plus button to the right of the last rule. A blank new rule will be added, as shown in :numref:`figure-KB-Search-add-remove-rule.png`. Similarly, a rule can be removed by clicking the minus button to its right. .. _figure-KB-Search-add-remove-rule.png: .. figure:: ../../figs/KB-Search-add-remove-rule.png :alt: Buttons for adding and removing filtering rules Buttons for adding and removing filtering rules When multiiple filtering rules are used, either **All** or **Any** can be selected for the **Filter Matching** operation. The **All** option returns results which meet all the rules in the rules list, while **Any** returns results which satisfy at least one of the rules. Leave the default option **All** for **Filter Matching**. Then in the new rule just added, choose Body instead of Head, and type the word daughter in the **contains identifier** input bar. The search result now shows empty, as shown in :numref:`figure-KB-Search-All-son-daughter.png`. This is because there is no result which satisfy both criteria: head containing son and body containing daughter. .. _figure-KB-Search-All-son-daughter.png: .. figure:: ../../figs/KB-Search-All-son-daughter.png :alt: No result found for rules satisfying head containing son and body containing daughter No result found which satisfy both head containing son and body containing daughter .. When the **All** option is used, be sure that there is no empty rule. Otherwise no match will be found, as no result can satisfy an empty rule. See :numref:`figure-KB-Search-empty-rule.png` for an example. .. .. _figure-KB-Search-empty-rule.png: .. .. figure:: ../../figs/KB-Search-empty-rule.png .. :alt: **KB Search** returns no results with empty rule .. **KB Search** returns no results with empty rule Instead of **All**, choose **Any** for **Filter Matching**, this returns 4 matched results. Matched results returned are labeled according to the categories they are in, for examples, **L** for latent query and **R** for rule, as illustrated in :numref:`figure-KB-Search-multiple-rules.png`. .. _figure-KB-Search-multiple-rules.png: .. figure:: ../../figs/KB-Search-multiple-rules.png :alt: KB Search with multiple rules KB Search with multiple rules