Rule queries can be contained in packages, so you can add several rule queries to a package. However, this operation requires installation of the Facility Explorer plug-in. To create a multirule query proceed as follows:
-
Click Options on the File menu to open the Options dialog box. Install the Facility Explorer plug-in, and click the OK button.
-
Click Facility Explorer on the View menu. The Facility Explorer displays the Query project, which is a repository structure used to save predefined queries.
-
Check that the Query Library contains only one package (Rule Query) and one entry (Rule Query_2) that corresponds to the monorule query you created in the previous example, as shown in Figure 17.21.
-
Figure 17.21 Query Package with Rule Query
-
Add a new rule query to the rule package. You can either click the package and then click the
button or right-click the rule package and click Add Rule Query on the shortcut menu.
- You can also click Add Rule Query on the Project menu. Your query package should now look like Figure 17.22.
-
Figure 17.22 Adding a Rule Query to the Package
-
Rename the rule package and rule queries you have created to, for example, Priority, Set Low Priority, and Display High Priority to give them a meaningful name. Now right-click the rule query to open the Facility Editor and write the following rule for the Set Low Priority query:
For each business rule
such that priority is minimum
Do
set priority to low
and insert as query result
Your rule query should look like Figure 17.23.
Figure 17.23 Multirule Query Example
-
Click the Priority Package and then click the
button or click Query Editor on the View>Query Panels menu to open the Query Editor. The message The selected query cannot be edited here because it does not contain a single rule
is displayed. This is a warning only, because if the package contains no rule, more than one rule, or one rule and a ruleflow structure the Query Editor does not know what to display.
-
Click the
button at the top right to display the drop-down list, and then click Priority to display the rule query as shown in Figure 17.24.
-
Figure 17.24 Selecting a Package in the Query Editor
-
Click the
button to execute the rule query. The rule query should set the priority to "low" for all rules with the priority "minimum", and include others with high priority (detected by the other rule query) in the results. In this example ten elements are found and displayed in the Query Results panel as shown in Figure 17.25.
-
Figure 17.25 Multirule Query Results
|