Query conditions

Query conditions are the criteria that you define for the search.

The conditions of your query appear under the Find part of the query.

By default, you run queries on the business rules but you can also search for specific types of business rules, such as:

You can also search for folders (rule packages), ruleflows, templates, smart folders, functions, templates, or variable sets.

Note:

You can query only the working version of project elements, that is, the version referenced in the baseline currently selected in Decision Center.

You start by selecting the project element you want to query. You can then refine the query by adding a filter in the form of a such that statement, followed by condition statements.

Example

Find all business rules
   such that the effective date of each business rule is after 31/1/2012
   and the effective date of each business rule is before 28/2/2012

You can refine queries using a such that statement to filter different project items:

Note:

You can identify which rules have changed in the current session (by querying on after my login time) or which rules you have changed (by querying on creator is me).

Filter by properties

You can filter the query according to one of the properties of the project elements being queried (see Project element properties).

For example, the following query displays only business rules whose status is new:

Find all business rules
   such that the status of each business rule is new

Filter by business terms

You can filter the query according to the business terms used in the conditions and actions of your rules. This type of filter is useful when trying to find rules affected by a policy change, for example:

Find all business rules
   such that each business rule modifies the value of the insurance rate

The following query constructs find rules that use or modify business terms:

uses the value of

Returns rules that use the values of certain business terms.

Example

The following query returns all business rules that use loan grade values:

Find all business rules
   such that each business rule uses the value of the loan grade in 'a report'
uses the phrase

Returns rules that call a given business term.

Example

The following query returns all business rules that use 'add to the corporate score in the loan report':

Find all business rules
   such that each business rule uses the phrase [ add 'a number' to the corporate
   score in 'a report' ]
uses the phrase ... where

Returns rules that call a given business term to which a constraint is applied

Example 1

The following query returns all business rules that call the term that sets the credit score of 'a borrower' to 'a number', where this number can equal 100:

Find all business rules
   such that each business rule uses the phrase [ set the credit score of 'a borrower' 
 to 'a number' , where 'a number' equals 100 ]

This query would return the following rule:

if the age of 'the borrower' is 30
then set the credit score of 'the borrower' to 100;

Example 2

The following query returns all business rules that call the term that sets the credit score of 'a borrower' to 'a number', where this number can be at least 100:

Find all business rules
   such that each business rule uses the phrase [ set the credit score of 'a borrower' 
 to 'a number' , where 'a number' is at least 100 ]

This query would return the following rule:

if the age of 'the borrower' is 30
then set the credit score of 'the borrower' to 200;

Example 3

The following query returns all business rules that call the term that gives the discount 'a number' to 'a borrower', where the credit score of 'a borrower' is at most 200:

Find all business rules
   such that each business rule uses the phrase [give the discount 'a number' to 'a borrower' where 
the credit score of 'a borrower' is at most 200]

When the elements mentioned in the constraint do not appear in a rule, the rule is returned. In the following rule, the fact that the category of 'the borrower' is Gold does not exclude the possibility that the credit score of 'the borrower' is at most 200.

This query would return the following rule:

if the category of 'the borrower' is Gold then give the discount 10 to 'the borrower';

This query would not return the following rule:

if the credit score of 'the borrower' equals 300 then give the discount 10 to 'the borrower';
modifies the value of

Returns rules that modify certain business terms.

Example

The following query returns all decision tables that modify the value of the insurance rate:

Find all decision tables
   such that each decision table modifies the value of 'the insurance rate'

Filter by behavior of rules during execution

You can filter the query according to the semantics of the rules, that is, their behavior during execution. This type of filter finds rules that could be applicable when certain conditions are true or become true. This filter is useful for testing the conditions under which rules would be executed to make sure that they behave as expected.

You can use the following semantic query constructs:

may apply when

Returns all rules whose condition part could meet the query condition, or where there is nothing in the rule condition that would contradict the query condition. This query can thus include rules with conditions that are not specifically relevant to the query condition.

Example

Rule 1: If the score of the borrower is at least 10 then...

Rule 2: If the age of the borrower is at least 21 then...

Rule 3: If the score of the borrower is less than 10 and the age of the borrower is more than 35 then...

Query 1:

Find all business rules
   such that each business rule may apply when the score of the borrower is 20 

Query 2:

Find all business rules
   such that each business rule may apply when the score of the borrower is 5

Query 1 returns Rule 1 and Rule 2. It returns Rule 1 because if the score of the borrower is at least 10, then it could be 20. It returns Rule 2 because there is nothing in Rule 2 that specifically says that the condition could not hold: the score of the borrower could be 20. It does not return Rule 3 because it contains a condition (score less than 10) that specifically indicates that the rule could not apply.

Query 2 returns Rule 2 and Rule 3. Rule 1 cannot apply because the query condition sets the score to below 10. In Rule 2, nothing specifically stops the rule from being applicable when the score is 5. In Rule 3 at least one of the conditions could apply, and there is nothing in the other condition that negates the fact that the score could be 5.

may become applicable when

A more specific query that returns only those rules whose condition part could meet the query condition. It does not return rules with conditions that are not specifically relevant to the query condition.

Example

Rule 3: If the category of the customer is Platinum then...

Rule 4: If the category of the customer is not Platinum then...

Rule 5: If the age of the customer is at most 65 then...

Rule 6: If the age of the customer is at most 65 and the category of the customer is not Platinum...

Query 1:

Find all business rules
   such that each business rule may become applicable when the category of
   'a customer' is Gold 

This query returns Rule 4 and Rule 6. It returns Rule 4 because if the category of the customer is not Platinum, it could be Gold. It returns Rule 6 for the same reason. The additional condition relating to the age of the customer does not contradict the condition in which the category may be Gold.

The query does not return Rule 3 because a rule that applies when the customer category is Platinum does not apply when the category is Gold. It does not return Rule 5 because the query looks for rules that could become applicable when the customer category is Gold, and the age of the customer is not relevant to this query. In other words, the condition of the rule cannot be affected by the fact that the customer category is Gold.

Query 2:

Find all business rules
   such that each business rule may become applicable when [the age of
   'a customer' is at least 21] 

This query does not return Rule 5 because it searches for rules that could “become” applicable when the customer age is over 21. Rule 5 is applicable even if the customer age is under 21. Therefore Rule 5 does not ”become” applicable, but it “remains” applicable even if the customer age changes from under 21 to over 21.

may lead to a state where

Returns rules that, when executed, could show a result that meets the query condition. This query takes into account both the condition and action parts of a rule. It filters rules based on their effect. It does not, therefore, return rules that have no influence on the query condition.

Example

Rule 7: If the age of the borrower is at least 25 then set the credit score of the borrower to 60

Rule 8: If the age of the borrower is more than 18 and less than 25 then set the credit score of the borrower to 20

Query:

Find all business rules
   such that each business rule may lead to a state where the credit score of
   the borrower is more than 50

This query returns Rule 7 but not Rule 8 because, when the age of the borrower has been checked and the credit score set, only Rule 7 shows a result of over 50.

For more examples, refer to Tutorial: Analyzing rules.

Filter by impact of rules during execution

You can filter rules by identifying the links and dependencies between them. You can check how the execution of a rule impacts the applicability of other rules, and how a rule is impacted by the execution of other rules.

may select

Returns the ruleflows and rule tasks that may select a given rule.

Example

The following query returns the ruleflows and rule tasks that may select "Rule 1".

Find all ruleflows
   such that each ruleflow may select "Rule 1"
may enable rule

Returns rules that make a given rule applicable.

Example

Rule 1:

if the age of the customer is 25 
then set the category of the customer to Bronze ;

Rule 2:

if the category of the customer is Bronze 
then give Champagne to the shopping cart of the customer with message: "Congratulations" ;

Query:

Find all business rules
   such that each business rule may enable "Rule 2" 

This query returns Rule 1 because it sets the category of the customer to Bronze, and thus makes the condition of Rule 2 valid.

may disable

Returns rules that make a given rule inapplicable

Example

Rule 1:

if the age of the customer is 18 
then set the category of the customer to Copper ;

Rule 2:

if the category of the customer is Bronze 
then give Champagne to the shopping cart of the customer with message: "Congratulations" ;

Rule 3:

if the age of the customer equals 25 and the category of the customer is Bronze 
then set the category of the customer to Diamond ;

Query:

Find all business rules
   such that each business rule may disable "Rule 2" 

This query returns Rule 1 and Rule 3. It returns Rule 1 because if the category of the customer is set to Copper it cannot be Bronze. It returns Rule 3 because although one of the conditions is that the category of the customer is Bronze, the action is to set the category of the customer to Diamond. Therefore, if the category of the customer is Diamond, Rule 2 is not applicable.

may be enabled by

Returns rules that are made applicable by a given rule

Example

Rule 1:

if the age of the customer is 18 
then set the category of the customer to Copper ;

Rule 2:

if the category of the customer is Bronze 
then give Champagne to the shopping cart of the customer with message: "Congratulations" ;

Rule 3:

if the age of the customer equals 25 and the category of the customer is Gold 
then set the category of the customer to Diamond ;

Query:

Find all business rules
   such that each business rule may disable "Rule 2" 

This query returns Rule 1. It returns Rule 1 because if the category of the customer is set to Copper it cannot be Bronze. It does not return Rule 3 because the action is to set the category of the customer to Diamond, and it can only be executed from a state where the category is already not Bronze. Therefore Rule 3 does not disable Rule 1.

may be disabled by

Returns rules that are made inapplicable by a given rule

Example

Rule 1:

if the age of the customer is 25 
then set the category of the customer to Bronze ;

Rule 2:

if the age of the customer equals 25 and the category of the customer is Copper
then set the category of the customer to Gold

Query:

Find all business rules
   such that each business rule may be disabled by "Rule 1" 

This query returns Rule 2 because it is made inapplicable by Rule 1. In Rule 1 the category of a customer whose age is 25, is set to Bronze, therefore it cannot be Copper.