Task 2: Creating decision operations

You create two decision operations to define rulesets for the decision service.

About this task

In this task, you create decision operations. Each decision operation defines one ruleset and its input and output parameters. A ruleset combines business rules into an executable container that is deployed, and the parameters are used to exchange data between a ruleset and the client application.

You define each ruleset and its parameters as a decision operation that has a unique signature of input and output parameters. Decision operations can share rules and projects, which allows a decision service to change when new decision points require different signatures.

In Loan Validation Base/rules, two variable sets were created:
  • parameters: Contains the variables that are used in deployment to production.
  • ruleset variables: Contains variables that are used only in nonproduction.

Because all the projects of the decision service reference the BOM project, the variables are visible when you create any decision operation. You use these variables as input and output parameters when you create decision operations.

For the Loan Validation Service decision service, you create two decision operations:
  • One that takes all the rules that have the status validated from all of the referenced projects, by means of a query
  • A second, for testing purposes, that takes the rules that relate to scoring and grade from the three referenced projects
Image of decision service deployment structure
Note:

The tutorial uses rule properties, in this case the status property, as a strategy for rule selection. Another approach is to divide individual decisions according to rule project and rule package.

Step 1: Creating a query

You create a query to look for rules that have the status validated.

Procedure

  1. Right-click the queries folder under Loan Validation Service.
  2. Click New > Query.
  3. Enter validated rules query as the name of the query.
  4. Click Finish.
  5. Change the query in the editor to the following statement, and then save your work:
    Find all business rules
    such that the status of each business rule is validated
  6. Click Run query.
    The query search shows two matches, defaultInsurance and insurance, both from the Loan Validation Determination/rules/insurance package.

Step 2: Creating a decision operation

You create the first decision operation.

Procedure

  1. Click Loan Validation Service, and in the Decision Service Map, click Add decision operation.
  2. Enter loan validation production as the name of the operation and click Next.
  3. Select Loan Validation Service as the source rule project and click Next.
  4. Expand Loan Validation Service/rules.
  5. Select the loanvalidation.rfl ruleflow and click Finish. The Decision Operation editor opens.
  6. In the Business Rule Content section of the Overview tab, click Browse next to the Query field.
  7. Select validated rules query, and click OK.
    Note: Validator in the Business Rule Content section is set to Default Validator to select all the active rules within the scope of the source rule project.
  8. For completion, copy and paste the following text to the Description field:
    Used in production:
    - Input a loan request and a borrower.
    - Output the loan report.
    Rules from projects : Check, Determination, and Scoring with an extraction mechanism
    through a query: only rules with the validated status are used.
    Note: The length of the description is not limited. However, only the first 256 characters are exported.

Step 3: Adding input and output parameters

You add input and output parameters to the decision operation. The parameters are used to exchange information with the client application.

Procedure

  1. Click Define under the Signature section on the Overview page.
  2. Drag borrower and loan from Loan Validation Base > parameters to Input Parameters, and drag report to Output Parameters.
  3. Save your work. Your parameters must be defined as shown in the following image:

Step 4: Creating the second decision operation

You create the second decision operation.

Procedure

  1. Right-click Loan Validation Service.
  2. Select New > Decision Operation.
  3. Enter loan validation with score and grade as the name of the decision operation, and then click Next.
  4. Select Loan Validation Service as the source project, and then click Next.
  5. Expand Loan Validation Service/rules.
  6. Select the loanvalidation.rfl ruleflow and click Finish.
  7. Copy and paste the following text to the Description field:
    Used for testing and simulation:
    - Input a loan request and a borrower.
    - Output the loan report, the grade, and the score.
    Rules from projects: Check, Determination, and Scoring with no extraction mechanism.
  8. Click Define under the Signature section.
  9. Drag borrower and loan from Loan Validation Base/parameters to Input Parameters, and drag report to Output Parameters.
  10. Drag grade and score from Loan Validation Base/ruleset variables to Output Parameters.
  11. Save your work.

What to do next

In the next task, you create run configurations for your decision operations.