Queries on definitions

You can refine a query by filtering on project element definitions.

Queries on definitions find rules that use or modify the value of a member or call a method. You can run this type of query against any type of rule. It is useful for identifying rules that are affected by policy change.

You can run queries on definitions against any type of rule. It is useful for identifying rules that are affected by policy change:
  • The uses the phrase and uses the phrase ... where predicates find rules that call a method.

    Although their naming is similar, the uses the phrase and uses the phrase ... where queries behave differently. The first query (uses the phrase) looks at the syntactic form of the rule, whereas the second query (uses the phrase ... where) looks at the behavior of a rule. That is to say that theuses the phrase query checks if the textual representation of a rule contains a method call; and the uses the phrase ... where query checks whether the execution of a rule calls the method and checks that the arguments of the method satisfies the constraints. The first query can return never-applicable rules, whereas the second query does not return never-applicable rules as they are not run.

  • The uses the value of and modifies the value of predicates find rules that use or modify the value of a member.
  • The is using the BOM class and is using the BOM member predicates find rules that use a BOM class or BOM member.

    Queries with the is using BOM class or the is using BOM member predicate work only if the workspace has been rebuilt since the last modification. If not, the results might not be accurate. The selected BOM class or member must be verbalized.

uses the phrase

The predicate uses the phrase <a method verbalization> returns rules that call the specified method.

Example

The following query returns all the action rules that call the method that adds 'a number' to the corporate score in 'a report':

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

uses the phrase ... where

The predicate uses the phrase ... where <a method verbalization with a constraint on method arguments> returns rules that call a given method to which a constraint on arguments is applied.

This query filters on the project element definition and on the semantic content of a rule.

Example 1

The following query returns all the business rules that call the method that sets the credit score of 'a borrower' to 'a number', where this number equals 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 could 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 the business rules that call the method that sets the credit score of 'a borrower' to 'a number', where this number is 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 could 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 the business rules that call the method 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 a rule does not show the BOM elements involved in the constraint, this 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 could 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';

Example 4

The following query returns all the business rules that call the method that sets the loan amount range to <min> and <max>, with a maximum rate of <rate> where the value of the <min> and <max> parameters are lower than 10000, and the <rate> parameter is greater than 15%:

Find all business rules
	such that each business rule uses the phrase [ set the loan amount range to 'a  number'  and  
'another number', with a maximum rate of 'a number 3', where 'a number' is lower than 10000, 
and 'another number' is lower than 10000, and 'a number 3' is greater than 15 % ] 

You can select a predefined variable for each placeholder. Each variable has the type of the corresponding placeholder. If the type of the variable is String or Number, you can select up to 10 variables: 'a number', 'another number', 'a number 3', 'a number 4', and so on. For any other type, you can select up to three variables.

You can also select the predefined variables in the constraint part of the query and apply a constraint to them.

uses the value of

The predicate uses the value of <an attribute, ruleset parameter, or variable> returns rules that use the values of certain members.

Example

The following query returns all the 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'

modifies the value of

The predicate modifies the value of <an attribute, ruleset parameter, or variable> returns rules that modify certain members.

Example

The following query returns all the decision tables that modify the insurance rate of the loan report ruleset parameter:

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

is using the BOM class

The predicate is using the BOM class returns the rules that reference a certain class either by using a binding to an instance of this class or by using the automatic variable linked to this class (Rule Designer only).

This query returns only business rule artifacts, it does not return technical rules.

Example

The following query returns all the business rules that use the class Borrower:

Find all business rules
   such that each business rule is using the BOM class "loan.Borrower"
You can also use the predicate is not using BOM class.

is using the BOM member

Returns the rules that reference a certain BOM member (Rule Designer only).

This query returns only business rule artifacts, it does not return technical rules.

Example

The following query returns all business rules that read or modify the amount attribute of the Loan class:

Find all business rules
   such that each business rule is using the BOM Member "loan.Loan.amount" 

You can also use the predicate is not using BOM member.

Note: You can use other queries such as uses the value of, modifies the value of, and uses the phrase to obtain more accurate results.