0% found this document useful (0 votes)
127 views165 pages

Tutorials

The document provides tutorials for FICO® Blaze Advisor® version 7.8, focusing on decision rules management for Java and COBOL. It includes an overview of features, detailed modules for developing rule services, and guidance on deploying these services. The content is proprietary to Fair Isaac Corporation and is intended for internal evaluation purposes only.

Uploaded by

367tharun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views165 pages

Tutorials

The document provides tutorials for FICO® Blaze Advisor® version 7.8, focusing on decision rules management for Java and COBOL. It includes an overview of features, detailed modules for developing rule services, and guidance on deploying these services. The content is proprietary to Fair Isaac Corporation and is intended for internal evaluation purposes only.

Uploaded by

367tharun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 165

FICO Blaze Advisor Tutorials

FICO® Blaze Advisor®

decision rules management system

Version 7.8

TUTORIALS

For Java
© 2011–2021 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac
Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose,
reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation
purposes to determine whether to purchase a license to the software described in this documentation, or
as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate).
Use of this documentation and the software described in it must conform strictly to the foregoing
permitted uses, and no other use is permitted.

FICO® Blaze Advisor® 7.8


Last Revised October 31, 2021
Version 7.8
Template LG 9.0
Contents

TUTORIALS OVERVIEW ............................................8


Overview of the Features Tutorials Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Rule Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Data Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Policy Underwriting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Repository Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Business Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

CHAPTER 1:
Introductory Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Module 1 - Developing a Rule Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Opening the Blaze Advisor Perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Creating a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Developing the Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Writing Rules in Rulesets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Creating the AdjustIncomeRuleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Creating the SpecifyFreeGiftRuleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Generating the Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Invoking the Decision Table Wizard and Selecting the Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Defining the Decision Table Ruleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Creating Condition Cell Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Creating the Action Cell Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Editing the Values in the Decision Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Generating an Instance File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Inserting a Dynamic Cell Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Adding Rules to the Decision Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Assembling the Ruleflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Defining the Ruleflow Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Creating a main() Function to Test the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Building and Running the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Module 2 - Importing a Java Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Deleting or Renaming the Blaze Advisor Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Importing the External Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Module 3 - Generating an RMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Generating the Rule Maintenance Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Editing Values in the RMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Viewing the Change in the Blaze Advisor IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Fair Isaac Corporation Confidential and Proprietary Information 3


Contents

Customizing an RMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Module 4 - Deploying the Rule Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Deployment Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Deleting the Reference to the Test Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Specifying the Entry Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Generating the Configuration Class Files Needed for Deployment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Editing the Client File to Pass Java Code to the Rule Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Running the Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

CHAPTER 2:
COBOL Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Module 1 - Developing a COBOL Rule Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Opening the Blaze Advisor Perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Creating a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Enabling the Features of Blaze Advisor for COBOL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Developing the Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Creating an Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Writing Rules in Rulesets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Creating the AdjustIncomeRuleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Creating the SpecifyFreeGiftRuleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Generating the Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Invoking the Decision Table Wizard and Selecting the Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Defining the Decision Table Ruleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Creating Condition Cell Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Creating the Action Cell Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Editing the Values in the Decision Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Generating an Instance File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Inserting a Dynamic Cell Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Adding Rules to the Decision Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Creating a Function to Print the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Assembling the Ruleflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Defining the Ruleflow Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Building and Running the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Module 2 - Importing a COBOL Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Deleting the Blaze Advisor Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Importing the COBOL Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Module 3 - Generating an RMA for a COBOL Rule Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Generating the Rule Maintenance Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Editing Values in the RMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Viewing the Change in the Blaze Advisor IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Customizing an RMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Module 4 - Generating COBOL Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Deleting the Reference to the Test Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Creating an Entry Point for Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Configuring the Deployment Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Using the Wizard to Generate COBOL Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Fair Isaac Corporation Confidential and Proprietary Information 4


Contents

CHAPTER 3:
Ruleset Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Opening the Project and Including Folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Creating the Knockout Ruleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Creating the Variable, Event Rule, and Pattern. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Writing the Knockout Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Writing the First Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Writing Rules Using the Count Property of an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Writing the Final Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Writing a Function to Test the Ruleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Testing the Knockout Ruleset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Examining the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

CHAPTER 4:
Decision Table Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Working in the Decision Table Tutorial Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Creating the Decision Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Setting the Decision Table Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Creating Condition Cell Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Creating the Action Cell Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Editing the Decision Table Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Modifying an Expression Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Writing the Rules Using the Decision Table Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Generating the Instance File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Creating the Structure of the Decision Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Importing Decision Table Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Testing the Decision Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Examining the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Examining the Generated Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Reusing the Decision Table Template and Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

CHAPTER 5:
Score Model Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Opening the Score Model Project and Including the XML BOM and Utilities Folders . . . . . . . . . . . . . . . . . . . 103
Editing a Reason Code List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Using the Score Model Wizard to Create the Score Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Creating Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Setting Reason Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Writing Rules in the Score Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Generating the Instance File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Creating Bins for the Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Testing the Score Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Examining the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Viewing the Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Reusing the Score Model Template and Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Fair Isaac Corporation Confidential and Proprietary Information 5


Contents

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

CHAPTER 6:
Templates Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Opening the Templates Tutorial Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Converting the Ruleset to a Global Ruleset Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Consolidating Similar Rules in a Rule Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Creating Editable Rule Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Creating an Editable Rule Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Creating Editable Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Creating a List of Enumeration Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Creating an Editable Condition Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Creating an Editable Action Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Creating a Display Format for the Rule Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Enabling Multiple Rule Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Creating a Table for Rule Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Generating the Instance File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Adding New Rules in the Instance Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Testing the Ruleset Template Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Examining the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

CHAPTER 7:
RMA Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Opening the RMA Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Creating a Rule Maintenance Application Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Generating the Rule Maintenance Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Editing Values in the RMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Editing the Display Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Using Filters in a Display Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Editing the Score Model Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Editing the Decision Table Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Viewing the Changes in the Blaze Advisor IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Relaunching the RMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

CHAPTER 8:
Ruleflow Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Assembling the Data Validation Ruleflow Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Creating the Data Validation Ruleflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Defining a Ruleflow Variable and the Start Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Adding the Knockout Rules Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Adding a Decision Branch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Adding Tasks to the Branches. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Defining the Entry Point Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Testing the Ruleflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

Fair Isaac Corporation Confidential and Proprietary Information 6


Contents

CHAPTER 9:
Deployment Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Opening the Deployment Tutorial Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Configuring the Deployment Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Releasing the Data Validation Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Generating the Deployment Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Building the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Adding Client Code to Read the Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Building and Running the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
The Results of Building and Running the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

Fair Isaac Corporation Confidential and Proprietary Information 7


Tutorials Overview

The Blaze Advisor Tutorials provide hands-on experience using the FICO® Blaze Advisor®
decision rules management system. These include:
 “Introductory Tutorial” on page 13
This tutorial provides a high-level introduction to creating a deployable rule service.
 “COBOL Tutorial” on page 45
This tutorial shows how to create a COBOL subprogram from a rule project.
 A set of feature tutorials that focus on specific product features or specific aspects of
the development process.
The feature tutorials include:
 “Ruleset Tutorial” on page 76
 “Decision Table Tutorial” on page 88
 “Score Model Tutorial” on page 101
 “Templates Tutorial” on page 117
 “RMA Tutorial” on page 134
 “Ruleflow Tutorial” on page 141
 “Deployment Tutorial” on page 155
These are stand-alone tutorials that can be worked through separately. However, they
are all based on a common business scenario. Completed versions of the tutorial
projects are included in the context of a working implementation of the scenario. You
can explore the complete implementation to see how the various projects and entities
work together to form the business solution.
For a description of the business scenario and solution, see “Overview of the Features
Tutorials Scenario” on page 8.

Overview of the Features Tutorials Scenario


Each feature tutorial is built around some aspect of a hypothetical Auto Insurance Policy
Decision Rules Management System (DRMS) that supports the development and
deployment of rule services for making underwriting and pricing decisions about auto
insurance policy applications. The system encompasses:
 The development and testing of the ruleflows, templates, and other technical library
entities
 The generation and maintenance of the Rules Maintenance Application (RMA) that
provides the rule authoring environment
 Releasing iterative versions of the rule services
 Deploying the rule services

Fair Isaac Corporation Confidential and Proprietary Information 8


:

The folder structure and the various projects in the repository are designed to allow different
users, filling different roles, to perform their work on the various component pieces that
make up the rule services without jeopardizing or interfering with the work of others.
Common components are shared while project-specific items are isolated. Working through
a tutorial should give you some ideas about how to set up your repository and projects to
facilitate concurrent development by multiple users, in addition to providing hands-on
experience with the development tools available in Blaze Advisor.

Rule Services
There are two rule services under the Auto Policy Rules\Rule Services folder:
 A Data Validation service that verifies the application data submitted by a potential
customer, and runs some preliminary knockout rules to identify applications that are
obviously unacceptable and avoid further processing.
The “Deployment Tutorial” on page 155 shows you how to create reusable deployment
entities and generate a rule service deployment from this project.
 A Policy Underwriting service that:
 Obtains a risk score for the applicant
 Assigns the applicant to a value tier, representing the applicant’s potential worth to
the company
 Determines the policy pricing based on the risk, the potential value, and the
requested coverages
Each of these projects has been used to generate a deployment. The generated deployment
files and the instructions are under
<ADVISOR_HOME>\tutorials\deploymentsAutoPolicy\dataValidation.

Data Validation
The Data Validation service evaluates the initial data provided by the customer who is
applying for the auto insurance policy. A set of knockout rules identifies policy applications
that are obviously unacceptable, and flags them as disqualified. The rules that result in
disqualification also provide message text indicating the reason for the disqualification.
Disqualified applications are sent to a function that archives the application and prepares the
message to send to the applicant. All other applications are sent to a function that prepares
the policy for further processing, and submits it for pricing.
By performing this initial validation of incoming policy applications the applicant can be
informed immediately if there is a problem with the application, and the company is spared
the cost of further processing.

Policy Underwriting
The Policy Underwriting service performs an in-depth evaluation of the policy application
data and determines the premium to offer the applicant. A Score Model evaluates the risk the
company would assume by underwriting the policy and provides an overall risk score, along
with ranked reasons for how the score was obtained. Policies that carry an unacceptable risk
are disqualified without further processing. Other policies are evaluated to determine the

Fair Isaac Corporation Confidential and Proprietary Information 9


:

overall value of the applicant to the company, and then passed to a ruleset that determines
the premium, based on the requested coverage, the risk, and the customer value.

Repository Structure
The rule services consist of a variety of component entities and are the result of the activity
of a range of users, including the business users who are responsible for the rules, the
service architects who are responsible for defining the service interfaces and flow control,
and the Information Technology (IT) developers who are responsible for deploying the
services into the company’s IT infrastructure. The repository is structured to provide users in
different roles with appropriate access to the entities they are interested in while shielding
them from other entities.
The service component entities are stored in two libraries:
 The Business Library stores the rules that are authored by the business users.
 The Technical Library stores the ruleflows, templates, functions, and business object
models that are produced by the rule service architects and control how the services are
structured and invoked.
The individual service components and the defined services need to be developed and tested
before the services can be released and deployed into the production environment. The
Testing folder contains all the various test bed functions for unit testing the component
entities as well as the ruleflows that define the execution of the services.
Released versions of the services are stored in the Rule Services folder. IT developers
access these service projects for use in their deployments.
When the projects are ready to be deployed, IT developers can use the deployment entities in
the Deployment Library to set the configurations necessary to deploy the projects.

This structure facilitates a clear separation of responsibilities for the various roles. While this
tutorial repository does not implement an authorization scheme, it would be relatively simple
to provide appropriate levels of access control at the folder level for different user roles.

See Also: For more information about authorization, see the Authentication and
Authorization Manager Example in the Examples section of the Blaze Advisor
documentation.

Business Object Model


Blaze Advisor Business Object Models (BOM) define the classes used by the project entities.
The Auto Policy XML BOM used by these tutorials maps the elements in an XML schema to a
set of Blaze Advisor classes. If you would like to review the schema it can be found in your

Fair Isaac Corporation Confidential and Proprietary Information 10


:

Blaze Advisor installation at


<ADVISOR_HOME>\tutorials\businessObjectModels\xml\AutoPolicyApp.xsd.

Note: For more information about using XML classes in Blaze Advisor, see “Integrating XML
Structures with Blaze Advisor” in Developing Rule Projects.pdf.

Projects
Blaze Advisor projects contain references to the folders in the repository. You create a
project for some specific purpose, and then include references to any folders or subfolders
that contain entities you want to use. You can also create new folders, and create new
entities, which you can store in any of the referenced folders.

Note: For simplicity, this tutorial repository does not provide any access controls. If it did, the
folders you could reference from a project and the access you would have to the entities in
the folders would depend on your assigned privileges.
Multiple projects can reference the same folder. In the Auto Policy scenario, this is used to
separate the development and testing of individual rulesets from the development of the
ruleflows that define the services. For example, the Business Library contains a folder called
Knockout Rules, which contains a single ruleset called KnockoutRuleset. The business
experts who are responsible for the knockout rules access the ruleset through a project
called Knockout Rules Development, which is in the Testing > Unit Testing folder. The service
architects who are responsible for incorporating the knockout rules into the data validation
service access the ruleset from a project called Data Validation Ruleflow Testing, which is in
the Testing > Rule Service Testing folder. Each project references the Knockout Rules folder.

Fair Isaac Corporation Confidential and Proprietary Information 11


:

Note: If access privileges were being assigned, the business experts would have read/write
access to the Knockout Rules, while the service architects would have read-only access.
Each project has its own testing requirements, and each references its own folder for storing
test functions. The development and unit testing of the ruleset is completely independent of
the development and testing of the ruleflow. As long as the data context for the ruleset, such
as the parameters and return type, are agreed upon and in place, the business experts and
the ruleflow architects can go about their business simultaneously.
Many of the feature tutorials recreate a project in Auto Policy Rules. The Ruleset Tutorial
recreates the Knockout Rules Development project described above, while the Ruleflow
Tutorial recreates the Data Validation Ruleflow Testing project. In addition to creating new
entities, the tutorials show you how to reference existing folders and use the contents in a
new project. Each tutorial includes a discussion about how the project relates to the overall
business scenario and provides instructions for completing the project.

Fair Isaac Corporation Confidential and Proprietary Information 12


CHAPTER 1
Introductory Tutorial

The introductory tutorial for the FICO® Blaze Advisor® decision rules management system
guides you through the process of developing a rule service, importing an external object
model, generating a rule maintenance application, and creating a rule server deployment.
The tutorial is divided into four modules. You can complete all of the modules or just the
ones that interest you. If you complete the first module, you can use that project for the other
three modules. If you would prefer to skip the first module, you can use the project under the
Completed Tutorial folder in the repository to do the other modules.
It takes about two hours to complete all of the modules; however, you can complete one
module and continue where you left off at any time.

Module 1 - Developing a Rule Service


For this tutorial, the business scenario is that a hypothetical credit card issuer wants to use a
rule service to analyze data provided by customers and, if applicable, offer the customer a
credit card and a promotional gift.
In this first module, you create a rule project in the Blaze Advisor Integrated Development
Environment (IDE). Working in the project, you develop and test the entities that make up the
rule service, including the object model, rulesets, a decision table, a function, and a ruleflow.
You also build and run the service from within the project.
Time Estimate: 1 1/4 hours to complete

Tip: If you need more information about the layout of the Blaze Advisor IDE, see “Tour of the
Blaze Advisor IDE” in DevelopingRuleProjects.pdf.

Opening the Blaze Advisor Perspective


To begin the tutorial, you must start Eclipse, and open the Blaze Advisor perspective.

To open the Blaze Advisor perspective


 In the Eclipse IDE, select Window > Open Perspective > Other > Blaze Advisor and click
OK.

Creating a Project
The first step is to create a project. A project is a managed repository entity that contains one
or more references to folders and other projects. All of the project items that you create in

Fair Isaac Corporation Confidential and Proprietary Information 13


Chapter 1: Introductory Tutorial

this tutorial, such as the rulesets, the decision table, and the object model will be stored in a
folder referenced by the project.

To create a project
1 Create a new project using one of these options:
 Select File > New > Project.
 Click the New icon on the File toolbar and select Project.
The New Project Wizard opens:

2 Expand the Blaze Advisor folder, select Rule Project, and click Next.
3 Select Introductory Tutorial Repository and click Next.
4 In the Project Name field, enter Credit Card and in the Select folder panel, select _My
Work. Keep the Create project directory check box selected and click Finish.
To open the Project editor, right-click the project name, Credit Card [Introductory Tutorial
Repository], and select Open Project Editor. The Project editor is displayed in the Editor
pane on the right, as shown in this figure:

The project references the Credit Card folder, which is why you see it in the Editor pane.
All of the project items that you create will be stored in this folder.

Fair Isaac Corporation Confidential and Proprietary Information 14


Chapter 1: Introductory Tutorial

Developing the Object Model


In this section, you develop the object model that will be used to write the rules.
Blaze Advisor follows the object-oriented programming paradigm where the fundamental
unit of data is the object. An object is an instance of a class.
You can obtain the classes that define the object model for your rule service by importing
Javaclasses, XML schemas, or by mapping database tables. If you want to prototype one or
more classes before you import the object model, you can create one or more Blaze Advisor
classes in the Blaze Advisor IDE. Using a Blaze Advisor class lets you test your object model
and rules before the external object model is fully defined. In this section, you create a
Blaze Advisor class called CardApplicant and define its properties.
In a later section, you will create an instance of the CardApplicant class, and initialize the
properties to test the rules in the Blaze Advisor IDE. In a real-world application, data objects
are passed into a rule service from an external source, such as another application or a
database.

To create a Blaze Advisor class


1 Click the Project Explorer tab. Create a new class using one of these options:
 Select File > New > Object Model Entities > Class.
 Click the New Class icon on the Blaze Advisor Object Model Entities toolbar.
The New class dialog box opens.
2 In the Entity name field, enter CardApplicant and click Finish to open the Class editor.
3 In the Parent Class field in the Class editor, retain object.
4 Click the New Property icon on the Class editor toolbar.
5 Erase property1, and enter:
annualAirlineTrips
6 From the Type drop-down list, select integer.
7 Add the rest of the class properties required for the object model. Repeat the previous
steps using the class property names and property types listed in this table.

Class Property Name Property Type


annualAirlineTrips integer
creditHistory string
gift string
income real
isMarried boolean
mosInCurrentJob integer
recommendedCard string
rollingOverBalances boolean
spousalIncome real
totalIncome real

Fair Isaac Corporation Confidential and Proprietary Information 15


Chapter 1: Introductory Tutorial

Caution: Be sure to enter the class properties correctly, as it is easy to forget to define
the type of a class property.
8 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Writing Rules in Rulesets


In Blaze Advisor, rules are written in rulesets. A ruleset is a logical group of rules that are
considered as a single set when the rule service is invoked. Each rule in a ruleset uses this
structure:
if condition(s) is true
then perform action(s)

In this section, you create two rulesets:


 AdjustIncomeRuleset, which adjusts the applicant’s income based on the length of time
in their current job. Also, if the applicant has a spouse, the income of the spouse is added
to the income of the applicant.
 SpecifyGiftRuleset, which determines the promotional gift for those applicants eligible to
receive a credit card.
When you write rules, you write them using the properties of an object, variable, parameter, or
pattern of type <class>. For this tutorial, rules are written against a parameter of type
CardApplicant.
Rules are written using Blaze Advisor’s Structured Rule Language (SRL), which is an object-
oriented programming language designed to make writing and reading business rules easily
understandable by people with little or no programming background.

Note: Blaze Advisor is case-sensitive, so when you write the rules in SRL make sure that the
capitalization matches the text shown.

Creating the AdjustIncomeRuleset


The AdjustIncomeRuleset will have four rules. Three of the rules evaluate how long the
applicant has worked for their current employer and then adjusts the income property. The
fourth rule evaluates whether or not the isMarried property is true. If so, any spousal
income is added to the income of the applicant and that value is assigned to the
totalIncome property. If the applicant is not married, the totalIncome property becomes
equal to the income property.

To create the AdjustIncomeRuleset


1 Create a new ruleset using one of these options:
 Select File > New > SRL Decision Entities > Ruleset.
 Click the New Ruleset icon on the Blaze Advisor Object Model Entities toolbar.

Fair Isaac Corporation Confidential and Proprietary Information 16


Chapter 1: Introductory Tutorial

2 In the Entity name field, enter AdjustIncomeRuleset and click Finish to open the
Ruleset editor.

3 Retain void in the Return Type field, and retain <Default> in the Execution Mode field.
4 Click the New Parameter icon .
5 Name the parameter:
newApplicant
6 From the Type drop-down list, select CardApplicant.
7 Click the New Rule icon on the Ruleset editor toolbar or in the Content section.
8 Replace rule1 and enter this text for the rule name:
Six_mos_or_less_on_the_job
You cannot use spaces in the names of rules or other SRL entities, such as rulesets,
classes, variables, and objects to name a few examples. Spaces are allowed in non-SRL
entities, such as ruleflows and templates.
9 Expand the rule name field in order to display the SRL rule body area. Enter this SRL in
the rule body:
if newApplicant's mosInCurrentJob is less than or equal to 6
then decrement newApplicant's income by 5600.
This is how the new rule appears:

10 Repeat the previous three steps to add these rules to the ruleset, using the names and
content listed as follows:
Name:
About_1year
Content:
if newApplicant's mosInCurrentJob is greater than 6
and newApplicant's mosInCurrentJob is less than or equal to 12
then increment newApplicant's income by 1000.
Name:
Greater_than_1year
Content:

Fair Isaac Corporation Confidential and Proprietary Information 17


Chapter 1: Introductory Tutorial

if newApplicant's mosInCurrentJob is greater than 12


then increment newApplicant's income by 2500.
Name:
Second_income
Content:
if newApplicant's isMarried is true
and newApplicant's spousalIncome is greater than 0
then newApplicant's totalIncome is equal to newApplicant's income plus
newApplicant's spousalIncome.
else newApplicant's totalIncome is equal to newApplicant's income.

Note: The line that begins with then newApplicant's totalIncome wraps to the next
line due to space limitations in this document. This next line begins with
newApplicant’s. Enter these two lines on the same line in the rule body.
11 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Creating the SpecifyFreeGiftRuleset


In this section, you create the SpecifyFreeGiftRuleset. The ruleset has one rule that
determines the type of promotional gift based on the credit card type and how frequently the
customer travels by air.

To create the SpecifyFreeGiftRuleset


1 Create a new ruleset using one of these options:
 Select File > New > SRL Decision Entities > Ruleset.
 Click the New Ruleset icon on the Blaze Advisor Object Model Entities toolbar.
2 In the Entity name field, enter SpecifyFreeGiftRuleset and click Finish.
3 Retain void in the Return Type field, and retain <Default> in the Execution Mode field.
4 Click the New Parameter icon .
5 Name the parameter:
newApplicant
6 From the Type drop-down list, select CardApplicant.
7 Click the New Rule icon on the Ruleset editor toolbar or in the Content section.
8 Erase rule1 and enter this text for the rule name:
Specify_gift
9 Enter this SRL in the rule body:
if newApplicant's recommendedCard is "Platinum"
and newApplicant's annualAirlineTrips is greater than 5
then newApplicant's gift is "Leather Briefcase".
else newApplicant's gift is "Gift Certificate".
10 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Fair Isaac Corporation Confidential and Proprietary Information 18


Chapter 1: Introductory Tutorial

Generating the Decision Table


In this section, you create a Double-axis decision table that determines the credit card type
for the applicant, as shown in this figure:

A decision table is a tabular representation of a ruleset. At runtime, the rules in the decision
table resolve to a ruleset, which you know from the previous section is a group of rules. Each
rule in a decision table is a complete rule, and all of the rules in the decision table form the
ruleset.
When you created the two rulesets in the previous section, you wrote each rule using SRL.
When you create a decision table, you can use the Decision Table Wizard which
automatically generates the rule SRL for you. All you do is edit the values.
This is the SRL for the first two rules in the table:

if ((newApplicant.creditHistory = "Fair") and


(newApplicant.totalIncome >= 40000 and newApplicant.totalIncome < 60000) and
(newApplicant.rollingOverBalances = true))
then {
newApplicant.recommendedCard = "Standard".
}
if ((newApplicant.creditHistory = "Good") and
(newApplicant.totalIncome >= 40000 and newApplicant.totalIncome < 60000) and
(newApplicant.rollingOverBalances = true))
then {
newApplicant.recommendedCard = "Standard".
}

The only difference between these two rules is the value of the creditHistory property. If
you are writing a large number of rules with a similar construction, a decision table is usually
the most expedient way to write rules.

Invoking the Decision Table Wizard and Selecting


the Layout
When the wizard is invoked, the first page allows you to select the layout style for the
decision table. Blaze Advisor provides three layout styles: Single-axis (Columns), Single-axis
(Rows), and Double-axis. In this tutorial, you will create a Double-axis decision table. For
information about the other layout types, see “Choosing a Decision Table Layout” in
DevelopingRuleProjects.pdf.

Fair Isaac Corporation Confidential and Proprietary Information 19


Chapter 1: Introductory Tutorial

To invoke the Decision Table Wizard


1 Select the Credit Card folder.
2 Click the New Item icon on the Blaze Advisor Entities toolbar and select Template
from the drop-down menu.
In the New Template window, select Decision Table, and enter this text in the Name field:
Determine Card Decision Table
3 Click OK. This opens the Decision Table Wizard that you will use to create the structure
for the template.
4 Click Double-axis table.
5 Click Next.

Defining the Decision Table Ruleset


A parameter will be used to pass values into the decision table ruleset.

To define the decision table ruleset


1 In Return type, retain void.
2 Click the New Parameter icon .
3 Name the parameter:
newApplicant
4 From the Type drop-down list, select CardApplicant.
5 Click Next.

Creating Condition Cell Groups


A condition cell group represents a row or column of table cells that operate on the same
binding. A binding can be a class type parameter, variable, object or pattern or a primitive
type parameter, variable or enumeration.
Each condition expression is an “if” statement such as theParameter.property
<operator> {value}. However, the format of the condition expression can vary from cell
to cell within the same group. For example, some cells can use this format:
theParameter.property <= {value} and other cells may use a different format such as
theParameter.property >= {value} and parameter.property < {value}. Blaze
Advisor provides several types of expression formats. The variations that can be used
depend upon the property type.
In this tutorial, a local parameter will be used to pass in the values for evaluation. It will be
used to create static and dynamic condition cell groups. A static cell group is used when you
know that this condition will always be used in the decision table. A dynamic cell group is
used when the object model is incomplete or you are unsure as to which properties you want
to use as conditions. By creating a dynamic cell group, you can select a class property to use
as a condition in the Decision Table editor.

Fair Isaac Corporation Confidential and Proprietary Information 20


Chapter 1: Introductory Tutorial

To specify the condition columns


1 In the Available Conditions panel, expand newApplicant to display the parameter prop-
erties.
2 Select totalIncome, and click the arrow to add it to the Condition Columns panel. This
will be a static condition cell group because it is based on a class property.
3 In the Condition Columns panel, double-click in the Display Name field, change the name
to Total Income, and press Enter.

Note: The name you are entering is for display purposes only in the decision table. The
display name will be used for the header in the decision table column. The underlying
rules will use the class property name and not the display name.
4 Leave the check box in the Optional column cleared.
5 Select newApplicant, and click the arrow to add it to the Condition Columns panel.
6 In the Condition Columns panel, double-click in the Display Name field, change the name
to Dynamic Condition, and press Enter. The display name is only used in the Property
Picker dialog in the decision table that allows the selection of a specific class property.
The Optional check box is selected and disabled because this will be a dynamic
condition cell group.
7 Retain 2 in the Depth field because the CardApplicant class does not have any
subclasses or class-type properties. If it did, you would select the depth of the properties
that you wanted to be able to access in the decision table.
8 Click Next.

To define the condition row


1 In the Available Conditions panel, expand newApplicant to display the parameter prop-
erties.
2 Select creditHistory, and click the arrow to add it to the Condition Rows panel. This
will also be a static condition cell group because it is based on a class property.
3 In the Condition Rows panel, double-click in the Display Name field, change the name to
Credit History, and press Enter.
4 Click Next.

Creating the Action Cell Group


A Double-axis decision table contains only one action cell group and it must be based on a
property of a primitive type or an enumeration. Dynamic action cell groups are applicable
only to Single-axis decision tables.
For this tutorial, each expression in the Action cell group will set the recommended card to a
particular string value that is entered in the decision table.

To select the action


1 In the Available Actions panel, expand newApplicant to display the parameter proper-
ties.
2 Select recommendedCard, and click the arrow to add it to the Action Cell Groups panel.

Fair Isaac Corporation Confidential and Proprietary Information 21


Chapter 1: Introductory Tutorial

3 In the Action Cell Groups panel, double-click in the Display Name field, change the name
to Card Type, and press Enter.
4 Click Finish.

Editing the Values in the Decision Table


Decision table values are edited in the Decision Table editor in the Blaze Advisor IDE or in a
web-based, rule maintenance application (RMA). Regardless of how the values are edited,
the values are always saved to an instance file.
This section contains these topics:
 “Generating an Instance File”
 “Inserting a Dynamic Cell Group”
 “Adding Rules to the Decision Table”

Generating an Instance File


You will generate an instance file from the Decision Table Template.

To generate an instance file


1 Select the Decision Table Template in the Project Explorer.
2 Click the New Item icon on the Blaze Advisor Entities toolbar and select Instance
from the drop-down menu.
3 In the Instance window, select Determine Card Decision Table.
4 Enter this text in the Name field:
Determine Card Decision Table Instance
5 Click OK.
This is how the Decision Table Template instance appears initially:

Inserting a Dynamic Cell Group


By default, a dynamic condition or action cell group is optional, which means that you must
specifically add it as a row or column using the context menu in the Decision Table editor.
This is how the decision table will appear after you insert the dynamic cell group:

Fair Isaac Corporation Confidential and Proprietary Information 22


Chapter 1: Introductory Tutorial

To add a dynamic cell group


1 Click in the margin above the Credit History column.
2 Right-click to open the context menu and select Insert Dynamic Condition Column Right.
3 Expand Dynamic Condition and select rollingOverBalances.
4 In the Display Name field, enter Rolling Over Balances and click OK.
Now you are ready to add rules to the decision table.

Adding Rules to the Decision Table


You add rules to the table by creating additional columns and rows using the icons on the
Decision Table editor toolbar and the context menu commands. You then edit the rules
values.
To edit a value, click in a cell to enable it for editing, then enter or select the value. Press the
Tab key on your keyboard or click in another part of the table to register the value in the cell.

To add rows and columns in the table


1 Click in the left margin next to the first row in the decision table, and then add five rows
using one of these options:
 Click the Add Row icon on the toolbar.
 Right-click, and select Insert New Row Below or Insert New Row Above.
The Add Row icon always adds a row to the bottom of the table, and the insert command
always inserts a row above or below where the cursor is placed. For this tutorial, it does
not matter which command you use.
2 Click in the margin above the blank cell above Card Type, and then add two columns
using one of these options:
 Click the Add Column icon on the toolbar.
 Right-click, and select Insert New Column to the Left or Insert New Column to the
Right.
The Add Column icon always adds a column to the right, and the insert command always
inserts a column to the left or to the right of where the cursor is placed. It does not
matter which command you use.

To enter the condition values


1 Double-click in the first cell in the Credit History row, and enter:
Fair
When editing decision table rules, you do not need to use quotation marks with string
values because Blaze Advisor automatically inserts them in the SRL.
2 In the other two Credit History condition cells, enter:
Good
Excellent

Fair Isaac Corporation Confidential and Proprietary Information 23


Chapter 1: Introductory Tutorial

3 Double-click in the first cell in the Total Income column, replace 0 and 0 with these
values:
40000
60000
4 Double-click in the second cell in the Total Income column, replace 0 and 0 with these
values:
60000
80000
5 Single-click in the third cell in the Total Income column, right-click and select Format Cell
> >='real'
6 Click in the cell and replace 0 with this value:
80000
7 For the fourth cell in the Total Income column, replace 0 and 0 with these values:
40000
60000
8 For the fifth cell in the Total Income column, replace 0 and 0 with these values:
60000
80000
9 For the last cell in the Total Income column, single-click in the cell, right-click and select
Format Cell > >='real'
10 Click in the cell and replace 0 with this value:
80000
11 Because the Rolling Over Balances cell group is based on a boolean property, the default
value in each cell is true. For the bottom three cells, click in the cell and type F to change
the value to false.

To enter the action values


1 Double-click in the first action cell under Card Type, and enter Standard and press
Enter.
2 Double-click in the first action cell again, right-click, and select Copy.
3 Click to select the second cell (in the first row), right-click, and select Paste.

Note: You can also copy and paste values using the following methods:
 Keyboard shortcuts: Ctrl+C and Ctrl+V.
 Menu commands: Edit > Copy and Edit > Paste.
 Single-click the cell you want to copy, right-click the selected cell, and select Copy.
Then single-click the cell where you want to paste it, right-click the selected cell, and
select Paste.
4 Fill in the rest of the action values, so that the table looks like this:

Fair Isaac Corporation Confidential and Proprietary Information 24


Chapter 1: Introductory Tutorial

5 Save the changes using one of these options:


 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Assembling the Ruleflow


A ruleflow is a graphical presentation of all or a portion of the flow of control of a project. You
can use a ruleflow to start the execution of a project whenever an object of a specified type is
posted as an event or when the project is run. In this tutorial, the ruleflow executes when an
object of type CardApplicant is posted as a start event. A start event, as the name implies,
starts ruleflow processing.
Start events can be posted to a rule service from:
 An SRL statement by calling the events().postEvent(eventObject) built-in
function, which you will write in a function later in this module.
 A client application that calls an event poster entry point for the service.
In this section, you create the ruleflow, a start event, a ruleflow variable, and ruleflow tasks.
The ruleflow variable stores data while the ruleflow is processing each of the ruleflow tasks.
A ruleflow task can be a function, ruleset, or a decision metaphor, such as a decision table,
decision tree or score model. Your ruleflow tasks are the two rulesets and the decision table
you created in previous sections. This is how the ruleflow appears after you complete the
procedures in this section and the next one:

According to the ruleflow diagram, when the project is run the following tasks are
implemented:
 AdjustIncome, which adjusts the income of the applicant based on how long they have
worked for their current employer. Also, if the applicant has a spouse, the income of the
spouse is added to the income of the applicant.
 DetermineCardType, which determines a card type for the applicant. If the total income
of the applicant is below $40,000, the applicant is not eligible for a card.

Fair Isaac Corporation Confidential and Proprietary Information 25


Chapter 1: Introductory Tutorial

 SpecifyGift, which determines the promotional gift for those applicants eligible to receive
a credit card.

To create the ruleflow


1 In the Project Explorer, select the Credit Card Folder. Create a ruleflow using one of
these options:
 Select File > New > SRL Decision Entities > Ruleflow.
 Click the New Ruleflow icon on the Blaze Advisor Entities toolbar.
2 In the Entity name field, enter Credit Card Ruleflow and click Finish.
You can use spaces in a ruleflow name.
3 Click the Settings tab at the bottom of the editor.
4 Click the New Flow Variable icon to add the ruleflow variable.
a Replace FlowVariable1 with newApplicant.
b In the Type field, select CardApplicant.
5 Next to Ruleflow Starts, click the New Start Event icon .
6 Click in the Whenever a/an field, and select CardApplicant.
7 Select the entire Whenever a/an statement to enable the New Assignment icon , and
click the icon.

Tip: When you select the Whenever a/an statement, a blue outline of the statement
should display, as shown in the following figure:

8 Click the arrow twice to expand the field. Enter it in the Assign field, and in the To field,
select newApplicant.
You perform this step so that whenever an instance of the CardApplicant class is
posted to the ruleflow, it is assigned to the newApplicant ruleflow variable. The variable
is local to the ruleflow, and is only available during ruleflow processing.
This is how the fields in the Settings tab appear:

Fair Isaac Corporation Confidential and Proprietary Information 26


Chapter 1: Introductory Tutorial

To create the ruleflow diagram


1 Click the Content tab. This is how the ruleflow diagram appears:

2 Click the Insert Task icon in the ruleflow toolbar. The cursor changes to a set of
crosshairs.
3 Place the crosshairs on the line between the two nodes in the ruleflow.
You know that you are placing the task in a valid location when a shadow box appears
between the nodes.
4 Click once to insert the task. A box labeled Task1 appears.
5 Click the Insert Task icon and click to the right of Task 1.
6 Click the Insert Task icon and click to the right of Task 2.
The ruleflow should now look like this:

Defining the Ruleflow Tasks


Now that you have created your ruleflow, you need to associate the tasks with the rulesets
and the decision table you created earlier.

Fair Isaac Corporation Confidential and Proprietary Information 27


Chapter 1: Introductory Tutorial

To define the tasks


1 In the ruleflow diagram, double-click on the first task in the sequence to open the Task
editor.
a In the Task field, enter:
AdjustIncome
b From the Implementation drop-down list, select
AdjustIncomeRuleset(CardApplicant).
c In the Implementation Arguments field, enter:
newApplicant
The return type of the ruleset is void, so leave the Assign value returned from
Implementation to field set to <none>. The Task editor should look like this:

d Close the Task editor and when prompted, save your changes.
2 Double-click on Task 2 to open the Task editor.
a In the Task field, enter:
DetermineCardType
b From the Implementation drop-down list, select Determine Card Decision Table
Instance.
c In the Implementation Arguments field, enter:
newApplicant
The decision table return type is void, so leave the Assign value returned from
Implementation to field set to <none>.
d Close the Task editor and when prompted, save your changes.
3 Double-click on Task3 to open the Task editor.
a In the Task field, enter:
SpecifyGift
b From the Implementation drop-down list, select
SpecifyFreeGiftRuleset(CardApplicant).
c In the Implementation Arguments field, enter:
newApplicant
The ruleset return type is void, so leave the Assign value returned from
Implementation to field set to <none>.

Fair Isaac Corporation Confidential and Proprietary Information 28


Chapter 1: Introductory Tutorial

d Close the Task editor and when prompted, save your changes.
The ruleflow should look like this:

Creating a main() Function to Test the Project


In this section, you create a main() function to test the project in the Blaze Advisor IDE.
When a rule project contains a main() function, that function is executed first, which makes
it useful for setting up test data.
In the function, you will write SRL that does the following:
 Creates an instance of the CardApplicant class.
 Initializes the object properties.
 Passes the instance as an event to the ruleflow.
 Invokes the ruleflow.
 Prints the recommended card plus the promotional gift or a rejection message.
When you deploy a rule service, objects are passed in from an external application, so
creating test data in the Blaze Advisor IDE is not relevant for deployment. To ensure that you
can include or remove the main() function from the project, the function must be created in
a folder. To test the project, you include the folder. To deploy the project, you remove it.

To create the main() function


1 Select Window > Show View > Repository Explorer, expand the Introductory Tutorial
Repository folder, and select the _My Work folder.
2 Click the New Folder icon on the Blaze Advisor Global Items toolbar.
3 Name the folder Test, and click OK.
4 Click the Project Explorer tab to return to the Credit Card [Introductory Tutorial
Repository] project.
5 Right-click the Credit Card [Introductory Tutorial Repository] project and
select Open Project Editor.
6 Click the Include Folder or Project icon as shown in this figure:

Fair Isaac Corporation Confidential and Proprietary Information 29


Chapter 1: Introductory Tutorial

7 In the Include Folder or Project dialog box, expand _My Work, select Test, and click
Include.
8 In the Project Explorer, select the Test folder, and create a new function in the folder
using one of these options:
 Select File > New > SRL Decision Entities > Function.
 Click the New Function icon on the Blaze Advisor Entities toolbar.
9 In the Entity name field, enter main and click Finish.
10 Retain void in the Return type field, and retain <Default> in the Execution Mode field.
11 Enter this text into the Function body, or copy and paste it from this document or the
completed tutorial project:
newApp is a CardApplicant initially{
annualAirlineTrips = 6.
creditHistory = "Good".
income = 38000.
isMarried = true.
mosInCurrentJob = 12.
recommendedCard = null.
rollingOverBalances = true.
spousalIncome = 41000.
}
events().postEvent(newApp).
executeAgent().
if newApp.recommendedCard is not null
then print("You are eligible for a " newApp's recommendedCard " card and you will
receive a " newApp's gift".").
else print("You are not eligible for a card at this time. Please contact one of
our representatives.").

Tip: In the two print statements above, the text is wrapped due to space limitations in
this document. When typing the SRL into the Function body field, expand the Editor so
you can type the SRL on one line.
12 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Fair Isaac Corporation Confidential and Proprietary Information 30


Chapter 1: Introductory Tutorial

Building and Running the Project


You can now build and run the project, and view the outcome of the rules.

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 You need to create a run configuration before running the project. Select Run > Run
Configurations to open the Run Configurations dialog box.
3 Scroll to the left and select Blaze Advisor Project in the leftmost list of launch
configuration types, and click the New launch configuration icon on the toolbar.
4 Enter Credit Card Run Configuration in the Name field.
5 If the Credit Card project does not appear in the Project to Run field, perform the
following steps to complete the run configuration for this project:
a Click Select Project to open the Rule Project dialog box.
b Select Credit Card [Introductory Tutorial Repository] and click OK.
6 Click Apply to save your edits.
7 Click Run from the Run Configurations dialog box.

Tip: For subsequent runs, you can click the Run icon on the Launch toolbar, select
Run > Run, or right-click the project in the Project Explorer and select Run As > 1 Blaze
Advisor Project. The Credit Card Run Configuration is automatically run with the Run As
command because there is a matching configuration for the currently selected project. If
you receive a message stating there are no recent launches, then select Run > Run
History > (number) Credit Card Run Configuration, where (number) represents the
numeral associated with one of the previous configuration runs.
You see this message in the Console view:
You are eligible for a Platinum card and you will receive a Leather
Briefcase.
To change the outcome of the project, you can change the initial values in the main()
function. For example, if you change the initial value of the creditHistory property to
“Excellent” , save the change, and run the project again, you see this message:
You are eligible for a Diamond card and you will receive a Gift
Certificate.
If you set the spousalIncome property to 0, save the change, and run the project again,
you see the rejection message:
You are not eligible for a card at this time. Please contact one of
our representatives.
If you want to use this project for the other modules, and you have changed the initialized
values of the object properties in the main() function, reset the values to the ones
shown below and save the changes:
annualAirlineTrips = 6.
creditHistory = “Good”.
income = 38000.
isMarried = true.
mosInCurrentJob = 12.
recommendedCard = null.
rollingOverBalances = true.

Fair Isaac Corporation Confidential and Proprietary Information 31


Chapter 1: Introductory Tutorial

spousalIncome = 41000.
If you do not want to reset the values, you can use the project under the Completed
Tutorial folder for the other modules.

Fair Isaac Corporation Confidential and Proprietary Information 32


Module 2 - Importing a Java Object Model
This module shows you how to replace the Blaze Advisor class you created in Module 1 with
an external Java class. The Java class contains the same properties as the Blaze Advisor
class you created in Module 1. See “Developing the Object Model” on page 15.
Time Estimate: 15 minutes to complete
You can either use the rule project you created under the _My Work directory or you can use
the project under the Completed Tutorial folder. To begin this module, you must start the
Blaze Advisor IDE and connect to the Introductory Tutorial Repository, if it is not
already open. See “Opening the Blaze Advisor Perspective” on page 13.

Deleting or Renaming the Blaze Advisor Class


The Java class that you will import is also called CardApplicant, so you must rename or
delete the Blaze Advisor version of the CardApplicant class. You can choose the task you
want to perform.

To rename the class


1 Open your project or the one under the Completed Tutorial folder in the Project
Explorer.
2 In the Credit Card Folder, select the CardApplicant class.
3 Make the name editable using one of these options:
 Right-click and select Rename.
 Press F2 on your keyboard.
4 Erase the current name and enter a new one.
5 Press Enter to register the change.

To delete the class


1 Open your project or the one under the Completed Tutorial folder in the Project
Explorer.
2 Select the CardApplicant class.
3 Delete it using one of these options:
 Select Edit > Delete.
 Press the Delete key on your keyboard.
 Right-click and select Delete.
A message displays asking you to confirm the deletion.
4 Click Yes.
You do not need to build the project. If you do, you will see errors that will be fixed once you
import the Java class.

Fair Isaac Corporation Confidential and Proprietary Information 33


:

Importing the External Object Model


Blaze Advisor provides a set of Business Object Models (BOM) wizards that let you map
Java classes or XML schemas, and database tables directly to Blaze Advisor classes. Then,
at runtime, you pass corresponding Java objects, XML files, or database records to the rule
engine, and the BOM automatically maps them to the correct types of business objects.
You will import a Java object model using the New Java Business Object Model Wizard in the
Blaze Advisor IDE. The Java class has already been compiled for you. All you need to do is
set the classpath, and then invoke the wizard. You can set the classpath in the
Blaze Advisor IDE using the Project Properties window.
Settings in the Project Properties window are project-specific so the classpath you set
applies only to this project. To learn more about the settings that are available for a project,
see “Setting Properties for Blaze Advisor Projects” in DevelopingRuleProjects.pdf.

To set the classpath


1 Select Project > Properties > Blaze Advisor.
2 Click Add.
3 Locate and select this path:
<ADVISOR_HOME>\tutorials\businessObjectModels\java
If you installed Blaze Advisor in the default directory, <ADVISOR_HOME> is
C:\Blaze\Advisor(version number)
4 Click Open, and then click Apply and Close to close the Project Properties window.

To open the wizard


1 Open the New Java Business Object Model Wizard using one of these options:
 Select File > New > Business Object Models > Java Business Object Model.
 Click the arrow next to the New Template icon on the Blaze Advisor Global Items
toolbar, as shown in this figure, and select Java Business Object Model:

2 In the first page of the wizard, expand the


<ADVISOR_HOME>\tutorials\businessObjectModels\java and creditCard
directories.
3 Select creditCard.CardApplicant, click Add, and then Next.
4 Expand the creditCard package, CardApplicant class and Properties category.
You see all of the properties in the imported class. You do not have to import all of the
properties in a class. However, for this tutorial, retain the check marks next to the
properties because they are all required to run the project successfully.
Optionally, you can change the name of a property for display purposes in the
Blaze Advisor IDE, but do not make this change for this tutorial because the project will
not build.
5 Click Finish.
You see the editor for the Java Business Object Model.

Fair Isaac Corporation Confidential and Proprietary Information 34


:

6 In the Java Business Object Model field, erase the default entry, and enter:
Card Applicant Java BOM
7 In the Comments field, enter:
The CardApplicant class was imported on <today’s date>.
8 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.
The Java Business Object Model (BOM) appears in the Object Model Explorer, as shown
below:

Tip: If the BOM does not display in the Object Model Explorer, build the project by
selecting Project > Build Project. The BOM should now appear.
9 Expand the CardApplicant class to see its properties.
10 Build and run the project using the steps in the next procedure.

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 Click the Run icon on the Launch toolbar or select Run > Run, or right-click the project
in the Project Explorer and select Run As > 1 Blaze Advisor Project.

Tip: The Credit Card Run Configuration is automatically run with the Run As command
because there is a matching configuration for the currently selected project. If you
receive a message stating there are no recent launches, then select Run > Run History >
(number) Credit Card Run Configuration, where (number) represents the numeral
associated with one of the previous configuration runs.
You see this message in the Console view
You are eligible for a Platinum card and you will receive a Leather
Briefcase.

Fair Isaac Corporation Confidential and Proprietary Information 35


Module 3 - Generating an RMA
This module shows you how to generate a web-based, rule maintenance application (RMA),
which you will use to edit one of the decision table values.
If you completed the first module, you edited the decision table in the Decision Table editor in
the Blaze Advisor IDE. In this module, you edit a decision table value in the RMA that changes
the outcome of the rule project. Regardless of how you edit the rule values, the values are
always stored in an instance file in a folder.
Time Estimate: 15 minutes to complete
For this module, you can either use the rule project you created under the _My Work directory
or you can use the project under the Completed Tutorial folder. To begin this module, start
the Blaze Advisor IDE and connect to the Introductory Tutorial Repository, if it is not
already open. See “Opening the Blaze Advisor Perspective” on page 13.

Note: The first time an RMA is launched, if Blaze Advisor does not detect a browser, you will
be prompted to specify the path to the .exe file for your browser.

Generating the Rule Maintenance Application


The Rule Maintenance Application Generator is used to create the structure of the RMA
application and all necessary web pages. While using the generator, a Rule Maintenance
Application Definition (RMAD) is automatically created. An RMAD is a project item that lets
you store your RMA configuration settings and reuse them with multiple RMAs. When an
RMAD is created by the Rule Maintenance Application Generator, the default configuration
settings are used.
Alternatively, you can create an RMAD first, configure the settings, and then reference the
RMAD from the Rule Maintenance Application Generator. To learn how to do this, see the
“RMA Tutorial” on page 134.

To generate the rule maintenance application


1 Open your project or the one under the Completed Tutorial folder in the Project
Explorer.
2 Select Project > Rule Maintenance Applications > Generate Rule Maintenance
Application.
3 Retain the default selections and click Finish. The rule maintenance application opens in
a web browser.

Editing Values in the RMA


The first web page that you see is the Log on page. Because this is a non-versioned
repository, you can leave the user name and password fields blank. After you access the
RMA, you will open the decision table for editing. You will notice that the interface in the RMA
has a different appearance than it does in the Blaze Advisor IDE. All of the functionality is the

Fair Isaac Corporation Confidential and Proprietary Information 36


:

same, it is just that the version in the RMA has a different look and feel in keeping with the
fact that is embedded in a web-based application.

To access the rule editing page and edit a value


1 Click Log on.
2 Click the Credit Card project under the Projects tile in the RMA Home page.
3 Expand the Credit Card Folder in the Explore pane on the left side of the RMA Project
page.
4 Click Determine Card Decision Table Instance.
5 Click the Edit icon on the Decision Table editor toolbar. The icon changes to reflect
that the decision table is editable.
6 In the decision table, double-click on the second “Platinum” value in the third row of the
table. Note the location of the cursor in this figure:

7 Change the value to PlatinumPlus, and press the Enter key.


8 Click the Save icon on the Decision Table editor toolbar to save the change to the
repository.
9 Close the web browser.

Viewing the Change in the Blaze Advisor IDE


Any values you edit in the RMA are stored in the instance file. In this section, you view the
change that you made with the Decision Table editor in the RMA, within the
Blaze Advisor IDE.

To view the change made in the RMA within the Blaze Advisor IDE
1 In the Project Explorer, right-click the Credit Card [Introductory Tutorial
Repository] project and select Refresh.
2 In the Credit Card Folder, double-click the Determine Card Decision Table Instance
to open it in the Editor pane.
3 Notice that PlatinumPlus appears in the third row starting with >= 80,000.
4 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
5 Click the Run icon on the Launch toolbar or select Run > Run, or right-click the project
in the Project Explorer and select Run As > 1 Blaze Advisor Project.

Tip: The Credit Card Run Configuration is automatically run with the Run As command
because there is a matching configuration for the currently selected project. If you
receive a message stating there are no recent launches, then select Run > Run History >

Fair Isaac Corporation Confidential and Proprietary Information 37


:

(number) Credit Card Run Configuration, where (number) represents the number
associated with one of the previous configuration runs.
This is the new result. Notice that it is different because the rule value was changed.
You are eligible for a PlatinumPlus card and you will receive a Gift
Certificate.
This time the applicant receives a PlatinumPlus card instead of a Platinum card, and a
Gift Certificate instead of a Leather Briefcase.
If for some reason, the outcome does not match what you see in the Console view,
double-check to see that the initial values in the main() function in the Test folder are
set correctly:
annualAirlineTrips = 6.
creditHistory = "Good".
income = 38000.
isMarried = true.
mosInCurrentJob = 12.
recommendedCard = null.
rollingOverBalances = true.
spousalIncome = 41000.

Customizing an RMA
In this tutorial, you used the default settings for the rule maintenance application. When you
create your rule maintenance application, you will probably want to customize the look and
feel of the application to create an editing environment that makes your analysts most
comfortable.
For example, you can add text or graphics that help guide your analysts as they update the
rules. Additionally, you can change the colors, font types, and font sizes used in the pages.

See Also: For more information, see “Generating Rule Maintenance Applications” in
DevelopingRuleMaintenanceApplications.pdf.

Fair Isaac Corporation Confidential and Proprietary Information 38


Module 4 - Deploying the Rule Service
The procedures in this module show you how to use the Generate Deployment Wizard to
generate the configuration and class files necessary to run a rule project as a rule service
outside of the Blaze Advisor IDE. A rule service can be deployed on a supported server
platform so that the business logic encapsulated in the rule service can be accessible to
multiple, concurrent, distributed clients.
Prerequisite: The rule project used for this module must contain an imported Java class. See
“Module 2 - Importing a Java Object Model” on page 33. If you completed Modules 1 and 2,
you can use the project under the _My Work directory. If you just want to generate a
deployment, use the project under the Completed Tutorial folder, complete Module 2, and
then return to this module.
Time Estimate: 15 minutes to complete
To begin this module, start the Blaze Advisor IDE and connect to the Introductory
Tutorial Repository, if it is not already open. See “Opening the Blaze Advisor
Perspective” on page 13.

Deployment Overview
When a project, such as the Credit Card project, is controlled by a ruleflow, you can use a
ruleflow invoker deployment. Business data is mapped in as arguments to the invocation
method. The Start Event handler on the ruleflow begins execution when the event is received.
In this case, the event is the presence of an instance of the CardApplicant class.
In the Blaze Advisor IDE, you tested the project using an object instance of the
CardApplicant class called newApp in the main() function. However, this object is just for
testing the rules in the Blaze Advisor IDE. When you deploy the project, you need to pass the
data to the rule service as a series of arguments.
In this module, you will complete the following actions:
 Delete the reference to the Test folder.
 Specify an entry point for the rule service.
 Use the Generate Deployment Wizard to generate the configuration and class files.
 Edit the client file to pass the data to the rule service.
 Build and run the deployment.

Deleting the Reference to the Test Folder


Since the main() function is only used for testing in the Blaze Advisor IDE, you will delete the
reference to the Test folder. Deleting a reference from a project does not remove a folder or
project from the repository.

Fair Isaac Corporation Confidential and Proprietary Information 39


:

To delete the reference to the Test folder


1 In the Project Explorer, right-click the Credit Card [Introductory Tutorial
Repository] project and select Open Project editor.
2 In the Project editor, select the Test reference.
3 Delete it using one of these options:
 Select Edit > Delete.
 Press the Delete key on your keyboard.
 Right-click and select Delete.
4 Save your changes.

Specifying the Entry Point


In order to deploy the project, you need to specify an entry point, which in this case will be the
ruleflow. An entry point defines the method signature in your generated server class. A client
calls the method to invoke the rule service. Depending upon the type of deployment, you can
define one or more entry points in a Rule Service Definition (RSD).
By specifying an entry point in a Rule Service Definition, you can save and reuse it to deploy
the project as often as necessary.

To specify the entry point


1 Select File > New > Deployment and RMA Entities > Rule Service Definition.
2 In the Entity name field, enter Credit Card Rule Service Definition and click
Finish to open the Rule Service Definition editor.
3 In the Rule Service field, enter:
Credit Card Rule Service
4 Leave the Description field empty.
5 Next to the Entry Points panel, click Add.
6 From the Functional Item drop-down list, select:
Credit_Card_Ruleflow(CardApplicant) : CardApplicant

Note: The Entry Point ID field is automatically filled in after selecting the functional item.
7 In the Entry Point ID field, add post to the beginning of the functional name so that the
name appears as: postCredit_Card_Ruleflow
8 Click Finish to close the Entry Point Wizard.
9 Save your changes.

Generating the Configuration Class Files Needed for


Deployment
Next, you will use the Generate Deployment Wizard to create the configuration class files
needed for deployment. While using the wizard, you will also create two additional reusable
deployment entities that will be saved with the project:

Fair Isaac Corporation Confidential and Proprietary Information 40


:

 Deployment Definition (DD), which is used to configure the system-independent


deployment settings, such as the target platform, server type, and whether or not a
deployment manager should be used.
 System Definition (SD), which is used to configure the system-dependent deployment
settings, such as the connection information for the deployment manager or for remote
debugging.
You will generate a simple Java deployment without any added features. For more
information on how you can use other features such as a deployment manager or remote
debugging, see “Generating Rule Services” in DeployingRuleServices.pdf.

To generate the configuration and class files


1 Select the Credit Card Folder in the Project Explorer.
2 Select Project > Generate Rule Service Deployment.
3 Retain the path in the Create in field.
4 In the Name field, enter:
Credit Card Deployment Definition
5 In the Target Platform field, retain Java.
6 In the Server Type field, retain Stateless, and click Next.
7 Retain the path in the Create in field.
8 In the Name field, enter Credit Card System Definition, and click Next.
9 Ensure that the Generate the deployment files option is selected. In the Target directory
field, erase the path and enter:
<ADVISOR_HOME>\tutorials\deployCreditCard
where <ADVISOR_HOME> is the location of your Blaze Advisor installation such as
C:\Blaze\Advisor. Note that the deployCreditCard folder will be created by the wizard.
The configuration and class files will be generated in this location.
10 Click Next to display the Generated Files wizard page. Keep the default selection of files
to generate and click Finish.
11 Click OK to dismiss the message listing the files that were generated.

Tip: In this procedure, the Deployment and System Definitions are created using the
Generate Deployment Wizard. You have the option of creating a Deployment Definition,
System Definition, or both, and then referencing them from the wizard. There is a
Deployment Tutorial, which is part of the Features Tutorials, that explains how to do this. See
“Deployment Tutorial” on page 155.

Editing the Client File to Pass Java Code to the Rule


Service
Before you use the generated client file, you need to edit it so that an instance of the
CardApplicant class is created and its properties are set before being passed to the rule
service. The instance is posted to the event queue and then control is passed to the ruleflow
by calling the executeAgent() built-in function. After the ruleflow is complete, the object,
which will have some of its properties altered by the rule service, is returned.

Fair Isaac Corporation Confidential and Proprietary Information 41


:

To edit the client file


1 Open the file Client.java in a text editor.
(The files are located under
<ADVISOR_HOME>\tutorials\deploycreditcard\qdcreditcardruleservice.)
2 Make line numbers visible in the text editor.
3 Replace the following lines 93 through 97:
//==> Set up the invocation arguments.
//==> creditCard.CardApplicant arg0 = (value for arg0);
//==> Invoke the actual method. Replace the next line with:
//==> return postCredit_Card_Ruleflow(arg0);
return null;
with the following lines of code:
creditCard.CardApplicant arg0 = new creditCard.CardApplicant();
arg0.setAnnualAirlineTrips(6);
arg0.setCreditHistory("Good");
arg0.setIncome(38000);
arg0.setIsMarried(true);
arg0.setMosInCurrentJob(12);
arg0.setRollingOverBalances(true);
arg0.setSpousalIncome(41000);
arg0.setRecommendedCard("");
arg0.setGift("");
creditCard.CardApplicant retVal = postCredit_Card_Ruleflow(arg0);
System.out.print("You are eligible for a " + arg0.getRecommendedCard());
System.out.println(" card and you will receive a " + arg0.getGift());
return retVal;
This Java code creates an instance of the CardApplicant class and then sets some of
its properties using set methods. It includes print statements for the values in the
recommendedCard and gift properties.
4 Verify that line 107 is }
If you have pasted the code correctly, this is how the code appears:

5 Save and close the file.

Fair Isaac Corporation Confidential and Proprietary Information 42


:

Running the Deployment


Now you use the generated scripts to build, package, and run the deployment. To
successfully run the deployment, you need to add the location of the CardApplicant class
to your classpath.

To run the deployment


1 Open a Command Prompt window.
2 Change the directory to <ADVISOR_HOME>\bin
3 Enter:
setenv
4 Enter:
set
classpath=%classpath%;C:\<ADVISOR_HOME>\tutorials\businessObjectMode
ls\java
where <ADVISOR_HOME> represents the actual Blaze Advisor installation location.
5 Press Enter.
6 Change the directory to <ADVISOR_HOME>\tutorials\deploycreditcard
7 Enter:
Build
8 Press Enter.
9 Enter:
Run
10 Press Enter.
If you ran the project under the Completed Tutorial folder without completing Module 3,
you see this message in the Run Output console:
You are eligible for a Platinum card and you will receive a Leather
Briefcase.
If you completed Module 3, which means you changed one of the decision table values,
you see this message:
You are eligible for a PlatinumPlus card and you will receive a Gift
Certificate.
You can change the values of the arguments in the Client.java file. Any values that
you modify may affect the outcome. For example, if you set spousalIncome to 0, and
repeat the steps again in this section, you see this message:
You are eligible for a card and you will receive a Gift Certificate.
In this case, there is an extra space between a and card because the applicant does not
qualify for a card so a single space is added to the results. To handle this type of
outcome, additional Java code needs to be written to process rejected applicants. This
task is outside of the scope of this tutorial.

Summary
After you have completed all of the Introductory Tutorial modules, or just the ones you
wanted to complete, you can learn more about Blaze Advisor using the Feature Tutorials.

Fair Isaac Corporation Confidential and Proprietary Information 43


:

See Also: For more information, see “Tutorials Overview” on page 8.

Fair Isaac Corporation Confidential and Proprietary Information 44


CHAPTER 2

COBOL Tutorial

This tutorial guides you through the process of developing a rule service, importing COBOL
data definitions, generating a rule maintenance application, and deploying the rules as
COBOL code using the FICO® Blaze Advisor® decision rules management system.
The tutorial is divided into four modules. You can complete all of the modules or just the
ones that interest you. If you complete the first module, you can use that project for the other
three modules. If you would prefer to skip the first module, you can use the project under the
Completed Tutorial folder in the repository to do the other modules.
It takes about two hours to complete all of the modules; however, you can complete one
module and continue where you left off at any time.

Note: While this tutorial is similar to the Introductory Tutorial, it demonstrates some features
that are unique to developing and deploying a rule project using a COBOL object model.

Module 1 - Developing a COBOL Rule Service


For this tutorial, the business scenario is that a hypothetical credit card issuer wants to use a
rule service to analyze data provided by customers and, if applicable, offer the customer a
credit card and a promotional gift.
In this first module, you create a rule project in the Blaze Advisor Integrated Development
Environment (IDE). Working in the project, you develop and test the entities that comprise the
rule service, including the object model, rulesets, a decision table, a function, and a ruleflow.
You also build and run the service from within the project.
Time Estimate: 1 1/4 hours to complete

Tip: If you need more information about the layout of the Blaze Advisor IDE, see “Tour of the
Blaze Advisor IDE” in DevelopingRuleProjects.pdf.

Opening the Blaze Advisor Perspective


To begin the tutorial, you must start Eclipse, and open the Blaze Advisor perspective.

Fair Isaac Corporation Confidential and Proprietary Information 45


Chapter 2: COBOL Tutorial

To open the Blaze Advisor perspective


 In the Eclipse IDE, select Window > Open Perspective > Other > Blaze Advisor and click
OK.

Creating a Project
This first step is to create a project. A project is a managed repository entity that contains
one or more references to folders and other projects, resulting in a collection of folders. All of
the project items that you create in this tutorial, such as the rulesets, the decision table, and
the object model will be stored in folders that will be referenced by the project.

To create a project
1 Create a new project using one of these options:
 Select File > New > Project.
 Click the New icon on the File toolbar and select Project.
The New Project Wizard opens:

2 Expand the Blaze Advisor folder, select Rule Project, and click Next.
3 Select COBOL Tutorial Repository and click Next.
4 In the Project Name field, enter Credit Card and in the Select folder panel, select _My
Work. Keep the Create project directory check box selected and click Finish.
To open the Project editor, right-click the project name, Credit Card [COBOL Tutorial
Repository], and select Open Project Editor. The Project editor is displayed in the Editor
pane on the right, as shown in this figure:

Fair Isaac Corporation Confidential and Proprietary Information 46


Chapter 2: COBOL Tutorial

The project references the Credit Card folder, which is why you see it in the Editor pane.
Most of the project items that you create will be stored in this folder.

Enabling the Features of Blaze Advisor for COBOL


After you have created a project, you need to enable Blaze Advisor for COBOL. By default, the
Blaze Advisor for COBOL features are only available to customers specifically licensed to use
this product.
To enable your project to use these features, you must set the Code Generation option to
COBOL in the Properties dialog box. After this option is set, these features become enabled:
 The Check SRL for COBOL icon on the Ruleset, Function, and Ruleflow editors.
 New COBOL Business Object Model Wizard, which is used to import COBOL data
definitions. If you complete Module 2 of this tutorial, you use the wizard to import a
copybook. See “Module 2 - Importing a COBOL Object Model” on page 66.
 COBOL Quick Deployer, which is the mechanism that generates COBOL from the SRL in
your project. If you complete Module 4 of this tutorial, you use the Quick Deployer to
generate COBOL code. See “Module 4 - Generating COBOL Code” on page 72.

To enable the features of Blaze Advisor for COBOL


1 Select the project and then select Project > Properties to open the Properties window.
2 Expand Blaze Advisor and click Code Generation in the left panel of the window.
3 In the Target Language field, select COBOL.
4 Click OK to register the change and close the dialog box.
For a complete list of the changes to a project once it becomes enabled for COBOL, see
“Creating and Using Blaze Advisor Rule Projects” in DevelopingRuleProjects.pdf.

Developing the Object Model


In this section, you develop the object model that will be used to write the rules.
Blaze Advisor follows the object-oriented programming paradigm where the fundamental
unit of data is the object. An object is an instance of a class.
You can obtain the classes that define the object model for your rule service by importing
COBOL data definitions in copybooks (with a .cbl or .cpy file extension). If you want to
prototype one or more classes before you import the object model, you can create one or
more Blaze Advisor classes in the Blaze Advisor IDE. Using a Blaze Advisor class lets you

Fair Isaac Corporation Confidential and Proprietary Information 47


Chapter 2: COBOL Tutorial

test your object model and rules before the external object model is fully defined. In this
section, you create a Blaze Advisor class called CardApplicant and define its properties.

To create a Blaze Advisor class


1 Create a new class using one of these options:
 Select File > New > Object Model Entities > Class.
 Click the New Class icon on the Blaze Advisor Object Model Entities toolbar.
The New class dialog box opens.
2 In the Entity name field, enter CardApplicant and click Finish to open the Class editor.
3 In the Parent Class field in the Class editor, retain object.
4 Click the New Property icon on the Class editor toolbar.
5 Erase property1, and enter:
annualAirlineTrips
6 From the Type drop-down list, select integer.
7 Add the rest of the class properties required for the object model. Repeat the previous
steps using the class property names and property types listed in this table.

Class Property Name Property Type


creditHistory string
gift string
income real
isMarried string
mosInCurrentJob integer
recommendedCard string
rollingOverBalances string
spousalIncome real
totalIncome real

Caution: Be sure to enter the class properties correctly, as it is easy to forget to define
the type of a class property.
8 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Creating an Object
In this section, you create an object of type CardApplicant which will pass data into the
rule project. In a real-world application, data is passed in from an external source such as
another COBOL application or a comma separated file.

Fair Isaac Corporation Confidential and Proprietary Information 48


Chapter 2: COBOL Tutorial

To create the object


1 Create a new object using one of these options:
 Select File > New > Object Model Entities > Object.
 Click the New Object icon on the Blaze Advisor Object Model Entities toolbar.
The New object dialog box opens.
2 In the Entity name field, enter newApplicant and click Finish to open the Object editor.
3 From the Class drop-down list, select CardApplicant.
4 In the Initially field, enter these initial values, including the punctuation:
annualAirlineTrips = 6.
creditHistory = "Good".
income = 38000.
isMarried = "true".
mosInCurrentJob = 12.
rollingOverBalances = "true".
spousalIncome = 41000.
You are not setting the gift, totalIncome, or recommendedCard properties because
these properties are set during rule evaluation.
5 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Writing Rules in Rulesets


In Blaze Advisor, rules are written in rulesets. A ruleset is a logical group of rules that are
considered as a single set when the rule service is invoked. Each rule in a ruleset uses this
structure:
if condition(s) is true
then perform action(s)

In this section, you create two rulesets:


 AdjustIncomeRuleset, which adjusts the applicant’s income based on the length of time
in their current job and adds any applicable spousal income to the applicant’s income. It
also eliminates any applicants whose total income is less than $40,000.
 SpecifyGiftRuleset, which determines the promotional gift for those applicants eligible to
receive a credit card.
When you write rules, you write them using the properties of an object, variable, parameter, or
pattern of type <class>. Note that patterns in a COBOL project are supported for collections
of type fixed array only. For this tutorial, rules are written against the object you created in the
previous section.
Rules are written using Blaze Advisor’s Structured Rule Language (SRL), which is an object-
oriented programming language designed to make writing and reading business rules easily
understandable by people with little or no programming background.
While you are creating your rules project, you can use any valid SRL to “test” your rules.
However, when you use the COBOL Quick Deployer to generate COBOL code, you see errors if
you have used any SRL syntax that is not supported for use with a COBOL object model. To

Fair Isaac Corporation Confidential and Proprietary Information 49


Chapter 2: COBOL Tutorial

understand what SRL can and cannot be used with a COBOL object model, see
“Blaze Advisor Built-in Functions Library” in Reference.pdf.
Blaze Advisor offers a way to check the SRL in your project. After you set the Target
Language to COBOL, which you did in “Enabling the Features of Blaze Advisor for COBOL”
on page 47, the Check SRL for COBOL icon appears on the Ruleset, Function, and
Ruleflow editor toolbars. The Check SRL for COBOL icon allows you to verify that the SRL in
an editor and its tree of calls is acceptable for COBOL code generation. You will use this icon
after you create the AdjustIncomeRuleset.

Note: Blaze Advisor is case-sensitive, so when you write the rules in SRL make sure that the
capitalization matches the text shown.

Creating the AdjustIncomeRuleset


The AdjustIncomeRuleset will have five rules. The first three rules evaluate how long the
applicant has been with the current employer and then adjusts the income property. The
fourth rule evaluates whether or not the isMarried property is true. If so, any spousal
income is added to the applicant’s income and that value is assigned to the totalIncome
property. If the applicant is not married, the totalIncome property becomes equal to the
income property. The final rule eliminates any applicants whose total income is less than
$40,000.

To create the AdjustIncomeRuleset


1 Create a new ruleset using one of these options:
 Select File > New > SRL Decision Entities > Ruleset.
 Click the New Ruleset icon on the Blaze Advisor Object Model Entities toolbar.
2 In the Entity name field, enter AdjustIncomeRuleset and click Finish to open the
Ruleset editor.

3 Retain void in the Return Type field, and retain <Default> in the Execution Mode field.
4 Click the New Parameter icon .
5 Name the parameter:
newApp
6 From the Type drop-down list, select CardApplicant.
7 Click the New Rule icon on the Ruleset editor toolbar or in the Content section.

Fair Isaac Corporation Confidential and Proprietary Information 50


Chapter 2: COBOL Tutorial

8 Replace rule1 and enter this text for the rule name:
Six_mos_or_less_on_the_job
You cannot use spaces in the names of rules and other SRL entities, such as rulesets,
classes, variables, and objects to name a few examples. Spaces are allowed in non-SRL
entities such as ruleflows and templates.
9 Expand the rule name field in order to display the SRL rule body area. Enter this SRL in
the rule body:
if newApp's mosInCurrentJob is less than or equal to 6
then decrement newApp's income by 5600.
This is how the new rule appears:

10 Repeat the previous three steps to add these rules to the ruleset, using the names and
content listed as follows:
Name:
About_1year
Content:
if newApp's mosInCurrentJob is between 7 and 12
then increment newApp's income by 1000.
Name:
Greater_than_1year
Content:
if newApp's mosInCurrentJob is greater than 12
then increment newApp's income by 2500.
Name:
ComputeTotal_income
Content:
if newApp's isMarried is "true"
and newApp's spousalIncome is greater than 0
then newApp's totalIncome is equal to newApp's income plus newApp's spousalIncome.
else newApp's totalIncome is equal to newApp's income.

Note: The line that begins with then newApp’s totalIncome wraps to the next line
due to space limitations in this document. This next line begins with spousalIncome.
Enter these two lines on the same line in the rule body.
Name:
Minimum_income
Content:
if newApp's totalIncome is less than 40000
then {
print("You are not eligible to receive a card at this time. Please contact our
office.").
exit().
}

Note: The line that begins with print(“You are wraps to the next line due to space
limitations in this document. This next line begins with contact our office. Enter
these two lines on the same line in the rule body.
11 Save your changes using one of these options:

Fair Isaac Corporation Confidential and Proprietary Information 51


Chapter 2: COBOL Tutorial

 Select File > Save All.


 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

To check the SRL for COBOL Code Generation


1 Click the Check SRL for COBOL icon on the Ruleset editor toolbar, as shown below:

2 In the Problems view, notice that the SRL in the About_1year rule in the ruleset contains
a comparison operator, is between, which is not supported for COBOL code generation.
This error displays:
Error: Range comparison operator "between" is not supported for
COBOL.
3 Double-click the error. The Rule editor for the About_1year rule opens.
4 Replace the SRL in the rule with this SRL:
if newApp's mosInCurrentJob is greater than 6
and newApp's mosInCurrentJob is less than or equal to 12
then increment newApp's income by 1000.
5 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.
6 Close the AdjustIncomeRuleset editor and then reopen it.
7 In the AdjustIncomeRuleset editor toolbar, click the Check SRL for COBOL icon.
All of the SRL in the ruleset is now supported for COBOL code generation.

Note: The remainder of the SRL that you write in this tutorial is supported for COBOL code
generation. While it is not necessary to double-check the SRL in each editor as you complete
this tutorial, you can click the Check SRL for COBOL icon on any Ruleset, Function, or
Ruleflow editor at any time.

Creating the SpecifyFreeGiftRuleset


In this section, you create the SpecifyFreeGiftRuleset. The ruleset has one rule which
determines the type of promotional gift based on the credit card type and how frequently the
customer travels by air.

To create the SpecifyFreeGiftRuleset


1 Create a new ruleset using one of these options:
 Select File > New > SRL Decision Entities > Ruleset.
 Click the New Ruleset icon on the Blaze Advisor Object Model Entities toolbar.
2 In the Entity name field, enter SpecifyFreeGiftRuleset and click Finish.
3 Retain void in the Return Type field, and retain <Default> in the Execution Mode field.

Fair Isaac Corporation Confidential and Proprietary Information 52


Chapter 2: COBOL Tutorial

4 Click the New Parameter icon .


5 Name the parameter:
newApp
6 From the Type drop-down list, select CardApplicant.
7 Click the New Rule icon on the Ruleset editor toolbar or in the Content section.
8 Erase rule1 and enter this text for the rule name:
Specify_gift
9 Enter this SRL in the rule body:
if newApp's recommendedCard is "Platinum"
and newApp's annualAirlineTrips is greater than 5
then newApp's gift is "Leather Briefcase".
else newApp's gift is "Gift Certificate".
10 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Generating the Decision Table


In this section, you create a double-axis decision table that determines the credit card type
for the applicant, as shown below:

A decision table is a tabular representation of a ruleset. At runtime, the rules in the decision
table resolve to a ruleset, which you know from the previous section is a group of rules. Each
rule in a decision table is a complete rule, and all of the rules in the decision table form the
ruleset.
When you created the two rulesets in the previous section, you wrote each rule using SRL.
When you create a decision table, you can use the Decision Table Wizard that automatically
generates the rule SRL for you. All you do is enter the values.
This is the SRL for the first two rules in the table:

if ((newApp's creditHistory = "Fair") and


(newApp's totalIncome >= 40000 and newApp's totalIncome < 60000) and
(newApp's rollingOverBalances = true))
then {
newApp's recommendedCard = "Standard".
}
if ((newApp's creditHistory = "Good") and
(newApp's totalIncome >= 40000 and newApp's totalIncome < 60000) and

Fair Isaac Corporation Confidential and Proprietary Information 53


Chapter 2: COBOL Tutorial

(newApp's rollingOverBalances = true))


then {
newApp's recommendedCard = "Standard".
}

The only difference between these two rules is the value of the creditHistory property. If
you are writing a large number of rules with a similar construction, a decision table is usually
the most expedient way to write rules.

Invoking the Decision Table Wizard and Selecting


the Layout
When the wizard is invoked, the first page allows you to select the layout style for the
decision table. Blaze Advisor provides three layout styles: Single-axis (Columns), Single-axis
(Rows), and Double-axis. In this tutorial, you will create a Double-axis decision table. For
information about the other layout types, see “Choosing a Decision Table Layout” in
DevelopingRuleProjects.pdf.

To invoke the Decision Table Wizard


1 Select the Credit Card folder.
2 Click the New Item icon on the Blaze Advisor Entities toolbar and select Template
from the drop-down menu.
In the New Template window, select Decision Table, and enter this text in the Name field:
Determine Card Decision Table
3 Click OK. This opens the Decision Table Wizard that you will use to create the structure
for the template.
4 Click Double-axis table.
5 Click Next.

Defining the Decision Table Ruleset


A parameter will be used to pass values into the decision table ruleset.

To define the decision table


1 In the Name field, enter:
Determine Card Decision Table
2 In Return type, retain void.
3 Click the New Parameter icon in the Decision Table editor toolbar.
4 Name the parameter:
newApp
5 From the Type drop-down list, select CardApplicant.
6 Click Next.

Fair Isaac Corporation Confidential and Proprietary Information 54


Chapter 2: COBOL Tutorial

Creating Condition Cell Groups


A condition cell group represents a row or column of table cells that operate on the same
binding. A binding can be a class type parameter, variable, object or pattern or a primitive
type parameter, variable or enumeration.
Each condition expression is an “if” statement such as theParameter.property
<operator> {value}. However, the format of the condition expression can vary from cell
to cell within the same group. For example, some cells can use this format:
theParameter.property <= {value} and other cells may use a different format such as
theParameter.property >= {value} and parameter.property < {value}. Blaze
Advisor provides several types of expression formats. The variations that can be used
depend upon the property type.
In this tutorial, a local parameter will be used to pass in the values for evaluation. It will be
used to create static and dynamic condition cell groups. A static cell group is used when you
know that this condition will always be used in the decision table. A dynamic cell group is
used when the object model is incomplete or you are unsure as to which properties you want
to use as conditions. By creating a dynamic cell group, you can select a class property to use
as a condition in the Decision Table editor.

To specify the condition columns


1 In the Available Conditions panel, expand newApplicant to display the parameter prop-
erties.
2 Select totalIncome, and click the arrow to add it to the Condition Columns panel. This
will be a static condition cell group because it is based on a class property.
3 In the Condition Columns panel, double-click in the Display Name field, change the name
to Total Income, and press Enter.

Note: The name you are entering is for display purposes only in the decision table. The
display name will be used for the header in the decision table column. The underlying
rules will use the class property name and not the display name.
4 Leave the check box in the Optional column cleared.
5 Select newApplicant, and click the arrow to add it to the Condition Columns panel.
6 In the Condition Columns panel, double-click in the Display Name field, change the name
to Dynamic Condition, and press Enter. The display name is only used in the Property
Picker dialog in the decision table that allows the selection of a specific class property.
The Optional check box is selected and disabled because this will be a dynamic
condition cell group.
7 Retain 2 in the Depth field because the CardApplicant class does not have any
subclasses or class-type properties. If it did, you would select the depth of the properties
that you wanted to be able to access in the decision table.
8 Click Next.

Fair Isaac Corporation Confidential and Proprietary Information 55


Chapter 2: COBOL Tutorial

To define the condition row


1 In the Available Conditions panel, expand newApplicant to display the parameter prop-
erties.
2 Select creditHistory, and click the arrow to add it to the Condition Rows panel. This
will also be a static condition cell group because it is based on a class property.
3 In the Condition Rows panel, double-click in the Display Name field, change the name to
Credit History, and press Enter.
4 Click Next.

Creating the Action Cell Group


A Double-axis decision table contains only one action cell group and it must be based on a
property of a primitive type or an enumeration. Dynamic action cell groups are applicable
only to Single-axis decision tables.
For this tutorial, each expression in the Action cell group will set the recommended card to a
particular string value that is entered in the decision table.

To select the action


1 In the Available Actions panel, expand newApplicant to display the parameter proper-
ties.
2 Select recommendedCard, and click the arrow to add it to the Action Cell Groups panel.
3 In the Action Cell Groups panel, double-click in the Display Name field, change the name
to Card Type, and press Enter.
4 Click Finish.

Editing the Values in the Decision Table


Decision table values are edited in the Decision Table Instance Editor in the
Blaze Advisor IDE or in a web-based, rule maintenance application (RMA). Regardless of how
the values are edited, the values are always saved to an instance file.
This section contains these topics:
 “Generating an Instance File”
 “Inserting a Dynamic Cell Group”
 “Adding Rules to the Decision Table”

Generating an Instance File


You will generate an instance file from the Decision Table Template.

To generate an instance file


1 Select the Decision Table Template in the Project Explorer.
2 Click the New Item icon on the Blaze Advisor Entities toolbar and select Instance
from the drop-down menu.

Fair Isaac Corporation Confidential and Proprietary Information 56


Chapter 2: COBOL Tutorial

3 In the Instance window, select Determine Card Decision Table.


4 Enter this text in the Name field:
Determine Card Decision Table Instance
5 Click OK.
This is how the Decision Table Template instance appears initially:

Inserting a Dynamic Cell Group


By default, a dynamic condition or action cell group is optional, which means that you must
specifically add it as a row or column using the context menu in the Decision Table editor.
This is how the decision table will appear after you insert the dynamic cell group:

To add a dynamic cell group


1 Click in the margin above the Credit History column.
2 Right-click to open the context menu and select Insert Dynamic Condition Column Right.
3 Expand Dynamic Condition and select rollingOverBalances.
4 In the Display Name field, enter Rolling Over Balances and click OK.
Now you are ready to add rules to the decision table.

Adding Rules to the Decision Table


You add rules to the table by creating additional columns and rows using the icons on the
Decision Table editor toolbar and the context menu commands. You then edit the rules
values.
To edit a value, click in a cell to enable it for editing, then enter or select the value. Press the
Tab key on your keyboard or click in another part of the table to register the value in the cell.

To add rows and columns in the table


1 Click in the left margin next to the first row in the decision table, and then add five rows
using one of these options:
 Click the Add Row icon on the toolbar.
 Right-click, and select Insert New Row Below or Insert New Row Above.
The Add Row icon always adds a row to the bottom of the table, and the insert command
always inserts a row above or below where the cursor is placed. For this tutorial, it does
not matter which command you use.

Fair Isaac Corporation Confidential and Proprietary Information 57


Chapter 2: COBOL Tutorial

2 Click in the margin above the blank cell above Card Type, and then add two columns
using one of these options:
 Click the Add Column icon on the toolbar.
 Right-click, and select Insert New Column to the Left or Insert New Column to the
Right.
The Add Column icon always adds a column to the right, and the insert command always
inserts a column to the left or to the right of where the cursor is placed. It does not
matter which command you use.

To enter the condition values


1 Double-click in the first cell in the Credit History row, and enter:
Fair
When editing decision table rules, you do not need to use quotation marks with string
values because Blaze Advisor automatically inserts them in the SRL.
2 In the other two Credit History condition cells, enter:
Good
Excellent
3 Double-click in the first cell in the Total Income column, replace 0 and 0 with these
values:
40000
60000
4 Double-click in the second cell in the Total Income column, replace 0 and 0 with these
values:
60000
80000
5 Single-click in the third cell in the Total Income column, right-click and select Format Cell
> >='real'
6 Click in the cell and replace 0 with this value:
80000
7 For the fourth cell in the Total Income column, replace 0 and 0 with these values:
40000
60000
8 For the fifth cell in the Total Income column, replace 0 and 0 with these values:
60000
80000
9 For the last cell in the Total Income column, single-click in the cell, right-click and select
Format Cell > >='real'
10 Click in the cell and replace 0 with this value:
80000
11 Because the Rolling Over Balances cell group is based on a boolean property, the default
value in each cell is true. For the bottom three cells, click in the cell and type F to change
the value to false.

Fair Isaac Corporation Confidential and Proprietary Information 58


Chapter 2: COBOL Tutorial

To enter the action values


1 Double-click in the first action cell under Card Type, and enter Standard and press
Enter.
2 Double-click in the first action cell again, right-click, and select Copy.
3 Click to select the second cell (in the first row), right-click, and select Paste.

Note: You can also copy and paste values using the following methods:
 Keyboard shortcuts: Ctrl+C and Ctrl+V.
 Menu commands: Edit > Copy and Edit > Paste.
 Single-click the cell you want to copy, right-click the selected cell, and select Copy.
Then single-click the cell where you want to paste it, right-click the selected cell, and
select Paste.
4 Fill in the rest of the action values, so that the table looks like this:

5 Save the changes using one of these options:


 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Creating a Function to Print the Results


In this section, you create a function that prints the recommended card type from the
decision table and the gift determined by the SpecifyFreeGiftRuleset. The SRL you use to
write the function shows the use of a COBOL built-in function called ConcatByContent()
from the Built-in Functions Library. The library is a collection of built-in functions that provide
frequently used logic that can be used to perform operations on a COBOL object model. See
“Blaze Advisor Built-in Functions Library” in Reference.pdf.
The only practical purpose of the print statement is to provide feedback on rule processing
within the Blaze Advisor IDE. Because the print statement cannot be used in a real-world
COBOL application, you will create the function in a Test folder in the repository to ensure
that you can include or remove it from the project.
To test the project, you include the folder that contains the function. When you deploy the
project to generate COBOL code, you remove the folder. (If you complete Module 4, you can
deploy the project. See “Module 4 - Generating COBOL Code” on page 72.)

Fair Isaac Corporation Confidential and Proprietary Information 59


Chapter 2: COBOL Tutorial

To create the Test folder


1 Select Window > Show View > Repository Explorer, expand the COBOL Tutorial Reposi-
tory folder, and select the _My Work folder.
2 Click the New Folder icon on the Blaze Advisor Global Items toolbar.
3 Name the folder Test, and click OK.
4 Click the Project Explorer tab to return to the Credit Card [COBOL Tutorial
Repository] project.
5 Right-click the Credit Card [COBOL Tutorial Repository] project and select
Open Project Editor.
6 Click the Include Folder or Project icon in this figure:

7 In the Include Folder or Project dialog box, expand _My Work, select Test, and click
Include.

To create the function


1 In the Project Explorer, select the Test folder, and create a new function in the folder
using one of these options:
 Select File > New > Decision Entities > Function.
 Click the New Function icon on the Blaze Advisor Entities toolbar.
2 In the Entity name field, enter printResults and click Finish.
3 Retain void in the Return type field, and retain <Default> in the Execution Mode field.
4 Click the New Parameter icon .
5 Name the parameter:
newApp
6 From the Type drop-down list, select CardApplicant.

Fair Isaac Corporation Confidential and Proprietary Information 60


Chapter 2: COBOL Tutorial

7 Enter this text into the Function body:


tempString1 is a string.
tempString2 is a string.
tempString1=ConcatByContent("You are eligible for a", newApp's
recommendedCard, 1).
tempString2=ConcatByContent("card and you will receive a", newApp's
gift, 1).
print(ConcatByContent(tempString1, tempString2, 1)).

Note: The lines that begin with then tempString1=ConcatByContent and


tempString2=ConcatByContent wrap to the next line due to space limitations in this
document. Make sure that each line does not wrap in the Function body.
8 Save your changes using one of these options:
 Select File > Save All.
 Use the keyboard shortcut: Ctrl + S.
 Click the Save icon on the File toolbar.

Assembling the Ruleflow


A ruleflow is a graphical presentation of all or a portion of a project’s flow of control. You can
use a ruleflow to start the execution of a project whenever an object of a specified type is
posted as an event or when the project is run. In this tutorial, the ruleflow executes when the
project is run.
In this section, you create the ruleflow and ruleflow tasks. A ruleflow task can be a function,
ruleset, or a decision metaphor, such as a decision table, decision tree or score model. Your
ruleflow tasks are the two rulesets and the decision table you created in previous sections.
This is how the ruleflow appears after you complete the procedures in this section and the
next one:

According to the ruleflow diagram, when the project is run the following tasks are
implemented:
 AdjustIncomeRuleset, which adjusts the applicant’s income based on the length of time
in their current job and adds any applicable spousal income to the applicant’s income. It
also eliminates any applicants whose total income is less than $40,000.
 DetermineCardType, which determines a card type for the applicant.
 SpecifyGift, which determines the promotional gift for those applicants eligible to receive
a credit card.
 PrintTestResults, which prints the results of rule processing.

To create the ruleflow


1 In the Project Explorer, select the Credit Card Folder. Create a ruleflow using one of
these options:
 Select File > New > SRL Decision Entities > Ruleflow.

Fair Isaac Corporation Confidential and Proprietary Information 61


Chapter 2: COBOL Tutorial

 Click the New Ruleflow icon on the Blaze Advisor Entities toolbar.
2 In the Entity name field, enter Credit Card Ruleflow and click Finish.
You can use spaces in a ruleflow name.
3 Click the Settings tab at the bottom of the editor.
4 Under Ruleflow starts, select the Automatically check box.
This sets the ruleflow to start when the project is run.

To create the ruleflow diagram


1 Click the Content tab. This is how the ruleflow diagram appears:

2 Click the Insert Task icon . The cursor changes to a set of crosshairs.
3 Place the crosshairs on the line between the two nodes in the ruleflow. You know that
you are placing the task in a valid location when a shadow box appears between the
nodes.
4 Click once to position the task. A box labeled Task1 appears.
5 Click the Insert Task icon and place it after Task 1.
6 Click the Insert Task icon and place it after Task 2.
7 Click the Insert Task icon and place it after Task 3.
The ruleflow should now look like this:

Defining the Ruleflow Tasks


Now that you have created your ruleflow, you need to associate the tasks with the rulesets
and the decision table you created earlier.

Fair Isaac Corporation Confidential and Proprietary Information 62


Chapter 2: COBOL Tutorial

To define the tasks


1 In the ruleflow diagram, double-click on the first task in the sequence to open the Task
editor.
a In the Task field, enter:
AdjustIncome
b From the Implementation drop-down list, select
AdjustIncomeRuleset(CardApplicant).
c In the Implementation Arguments field, enter:
newApplicant
The return type of the ruleset is void, so leave the Assign value returned from
Implementation to field set to <none>. The Task editor should look like this:

d Close the Task editor and when prompted, save your changes.
2 Double-click on Task 2 to open the Task editor.
a In the Task field, enter:
DetermineCardType
b From the Implementation drop-down list, select Determine Card Decision Table
Instance.
c In the Implementation Arguments field, enter:
newApplicant
The decision table return type is void, so leave the Assign value returned from
Implementation to field set to <none>.
d Close the Task editor and when prompted, save the changes.
3 Double-click on Task 3 to open the Task editor.
a In the Task field, enter:
SpecifyGift
b From the Implementation drop-down list, select
SpecifyFreeGiftRuleset(CardApplicant).
c In the Implementation Arguments field, enter:
newApplicant
The ruleset return type is void, so leave the Assign value returned from
Implementation to field set to <none>.

Fair Isaac Corporation Confidential and Proprietary Information 63


Chapter 2: COBOL Tutorial

d Close the Task editor and when prompted, save your changes.
4 Double-click on Task 4 to open the Task editor.
a In the Task field, enter:
PrintTestResults
b From the Implementation drop-down list, select printResults(CardApplicant).
c In the Implementation Arguments field, enter:
newApplicant
The ruleset return type is void, so leave the Assign value returned from
Implementation to field set to <none>.
d Close the Task editor and when prompted, save your changes.
This is how the ruleflow appears:

5 (Optional) Click the Settings tab.


When you are in the Settings tab, the Check SRL for COBOL icon is visible on the toolbar.
You do not see the icon when you are in the other tabs.
6 (Optional) Click the Check SRL for COBOL icon. The SRL in the ruleflow tasks are
supported for COBOL code generation so no error messages are generated.

Building and Running the Project


You can now build and run the project, and view the outcome of the rules.

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 You need to create a run configuration before running the project. Select Run > Run
Configurations... to open the Run Configurations dialog box.
3 Select Blaze Advisor Project in the leftmost list of launch configuration types, and click
the New launch configuration icon on the toolbar.
4 Enter Credit Card Run Configuration in the Name field.
5 If the Credit Card project does not appear in the Project to Run field, perform the
following steps to complete the run configuration for this project:
a Click Select Project to open the Rule Project dialog box.
b Select Credit Card [COBOL Tutorial Repository] and click OK.
6 Click Apply to save your edits.
7 Click Run from the Run Configurations dialog box.

Tip: For subsequent runs, you can click the Run icon on the Launch toolbar, select
Run > Run, or right-click the project in the Project Explorer and select Run As > 1 Blaze
Advisor Project. The Credit Card Run Configuration is automatically run with the Run As

Fair Isaac Corporation Confidential and Proprietary Information 64


Chapter 2: COBOL Tutorial

command because there is a matching configuration for the currently selected project. If
you receive a message stating there are no recent launches, then select Run > Run
History > (number) Credit Card Run Configuration, where (number) represents the
number associated with one of the previous configuration runs.

The Results of Building and Running the Project


You see this message in the Console view:
You are eligible for a Platinum card and you will receive a Leather
Briefcase
To change the outcome of the project, you can change the initial values in the
newApplicant Object editor. For example, if you change the initial value of the
creditHistory property to "Excellent", save the change, and run the project again, you
see this message:
You are eligible for a Diamond card and you will receive a Gift
Certificate
If you set the spousalIncome property to 0, save the change, and run the project again, you
see the rejection message:
You are not eligible to receive a card at this time. Please contact our
office.
If you want to use this project for the other modules, and you have changed the initialized
values of the properties in the Object editor, reset the values to the ones shown below and
save the changes:
annualAirlineTrips = 6.
creditHistory = "Good".
income = 38000.
isMarried = "true".
mosInCurrentJob = 12.
rollingOverBalances = "true".
spousalIncome = 41000.

If you do not want to reset the values, you can use the project under the Completed
Tutorial folder for the other modules.

Fair Isaac Corporation Confidential and Proprietary Information 65


Module 2 - Importing a COBOL Object Model
This module shows you how to replace the Blaze Advisor class you created in Module 1 with
an imported COBOL copybook. The COBOL copybook contains the same properties as the
Blaze Advisor class you created in Module 1. See “Developing the Object Model” on page 47.
Time Estimate: 15 minutes to complete
You can either use the rule project you created under the _My Work directory or you can use
the project under the Completed Tutorial folder. To begin this module, you must start the
Blaze Advisor IDE and connect to the COBOL Tutorial Repository, if it is not already
open. See “Opening the Blaze Advisor Perspective” on page 45.

Deleting the Blaze Advisor Class


The COBOL copybook that you will import is also called CardApplicant, so you must delete
the Blaze Advisor version of the CardApplicant class.

To delete the class


1 Open your project or the one under the Completed Tutorial folder in the Project
Explorer.
2 In the Credit Card Folder, select the CardApplicant class.
3 Delete it using one of these options:
 Select Edit > Delete.
 Press the Delete key on your keyboard.
 Right-click and select Delete.
A message appears asking you to confirm the deletion.
4 Click Yes.
You do not need to build the project. If you do, you will see errors that will be fixed once
you import the Java class.

Importing the COBOL Definitions


As you saw in the previous module, the rules in this tutorial are written against object
properties. In Module 1, you created a Blaze Advisor class and an object to test the rules. In a
real world application, data is passed to the rule engine whenever an evaluation is required.
The data that comprises the business objects comes from your application environment.
However, while you are creating your rule project, you can use your imported copybook and
create objects in Blaze Advisor for testing.
In this module, you import a COBOL object model using the COBOL Business Object Model
Wizard in the Blaze Advisor IDE. During the import operation, two things happen:
 An XML schema is created from the copybook. The classes in the XML schema are
imported into Blaze Advisor.

Fair Isaac Corporation Confidential and Proprietary Information 66


:

 Blaze Advisor internally stores the content of the original copybook. Blaze Advisor also
retains the original COBOL fields, and any initialized values that were set in the
copybook. The original copybook definitions are used during the conversion from SRL to
COBOL output. This process is called COBOL code generation. For more information, see
“Importing COBOL Structures in Blaze Advisor” in COBOLReference.pdf.

To invoke the wizard


1 Invoke the COBOL Business Object Model Wizard using one of these options:
 Select File > New > Business Object Models > COBOL Business Object Model.
 Click the arrow next to the New Template icon on the Blaze Advisor Global Items
toolbar, as shown in this figure, and select COBOL Business Object Model:

2 In the first page of the wizard, click Select File to open the Select File dialog box.
3 Locate this path:
<ADVISOR_HOME>\tutorials\businessObjectModels\cobol
4 Select CardApplicant.cpy, and click Open.
You see the name of the copybook to be imported.
5 Click Next twice.
6 Expand the Classes, CardApplicant, and Properties categories.
You see all of the properties in the imported class. You do not have to import all of the
properties in a class. However, for this tutorial, retain the check marks next to the
properties because they are all required to run the project successfully.
Optionally, you can change the name of a property for display purposes in the
Blaze Advisor IDE, but do not do that for this tutorial or the project will not build.
7 Click Finish.
You see the editor for the COBOL Business Object Model.
8 In the COBOL Business Object Model field, erase the default entry, and enter:
Card Applicant COBOL BOM
9 In the Comments field, enter:
The CardApplicant class was imported on <today’s date>.
10 Save your changes.
The COBOL Business Object Model (BOM) appears in the Object Model Explorer, as
shown below:

Tip: If the BOM does not display in the Object Model Explorer, build the project by
selecting Project > Build Project. The BOM should now appear.
11 Expand CardApplicant to see the class properties.

Fair Isaac Corporation Confidential and Proprietary Information 67


:

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 Click the Run icon on the Launch toolbar, o select Run > Run, or right-click the project
in the Project Explorer and select Run As > 1 Blaze Advisor Project.

Tip: The Credit Card Run Configuration is automatically run with the Run As command
because there is a matching configuration for the currently selected project. If you
receive a message stating there are no recent launches, then select Run > Run History >
(number) Credit Card Run Configuration, where (number) represents the number
associated with one of the previous configuration runs.
You see this message in the Console view
You are eligible for a Platinum card and you will receive a Leather
Briefcase.

Fair Isaac Corporation Confidential and Proprietary Information 68


Module 3 - Generating an RMA for a COBOL
Rule Service
This module shows you how to generate a web-based, rule maintenance application (RMA),
which you will use to edit one of the decision table values.
If you completed the first module, you edited the decision table in the Decision Table editor in
the Blaze Advisor IDE. In this module, you edit a decision table value in the RMA that changes
the outcome of the rule project. Regardless of how you edit the rule values, the values are
always stored in an instance file in a folder.
Time Estimate: 15 minutes to complete
For this module, you can either use the rule project you created under the _My Work directory
or you can use the project under the Completed Tutorial folder. To begin this module,
start the Blaze Advisor IDE and connect to the COBOL Tutorial Repository, if it is not
already open. See “Opening the Blaze Advisor Perspective” on page 45.

Generating the Rule Maintenance Application


The Rule Maintenance Application Generator is used to create the structure of the RMA
application and all necessary web pages. While using the generator, a Rule Maintenance
Application Definition (RMAD) is created automatically. An RMAD is a project item that lets
you store your RMA configuration settings and reuse them with multiple RMAs. When an
RMAD is created by the Rule Maintenance Application Generator, the default configuration
settings are used.
Alternatively, you can create an RMAD first, configure the settings, and then reference the
RMAD from the Rule Maintenance Application Generator. To learn how to do this, see the
“RMA Tutorial” on page 134.

To generate the rule maintenance application


1 Open your project or the one under the Completed Tutorial folder in the Project
Explorer.
2 Select Project > Rule Maintenance Applications > Generate Rule Maintenance
Application.
3 Retain the default selections and click Finish. The rule maintenance application opens in
a web browser.

Editing Values in the RMA


The first web page that you see is the Log on page. Because this is a non-versioned
repository, you can leave the user name and password fields blank. After you access the
RMA, you will open the decision table for editing. You will notice that the interface in the RMA
has a different appearance than it does in the Blaze Advisor IDE. All of the functionality is the
same, it is just that the version in the RMA has a different look and feel in keeping with the
fact that is embedded in a web-based application.

Fair Isaac Corporation Confidential and Proprietary Information 69


:

To access the rule editing page and edit a value


1 Click Log on.
2 Click the Credit Card project under the Projects tile in the RMA Home page.
3 Expand the Credit Card Folder in the Explore pane on the left side of the RMA Project
page.
4 Click on Determine Card Decision Table Instance.
5 Click the Edit icon on the Decision Table editor toolbar. The icon changes to reflect
that the instance is editable.
6 In the decision table, double-click on the second “Platinum” value in the third row of the
table. Note the location of the cursor in this figure:

7 Change the value to PlatinumPlus, and press the Enter key.


8 Click the Save icon on the Decision Table editor toolbar to save the change to the
repository.
9 Close the web browser.

Viewing the Change in the Blaze Advisor IDE


Any values you edit in the RMA are stored in the instance file. In this section, you view the
change that you made with the Decision Table editor in the RMA, within the
Blaze Advisor IDE.

To view the change made in the RMA within the Blaze Advisor IDE
1 In the Project Explorer, right-click the Credit Card [COBOL Tutorial Repository]
project and select Refresh.
2 In the Credit Card Folder, double-click the Determine Card Decision Table Instance
to open it in the Editor pane.
3 Notice that PlatinumPlus appears in the third row starting with >= 80,000.
4 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
5 Click the Run icon on the Launch toolbar, or select Run > Run, or right-click the
project in the Project Explorer and select Run As > 1 Blaze Advisor Project.

Tip: The Credit Card Run Configuration is automatically run with the Run As command
because there is a matching configuration for the currently selected project. If you
receive a message stating there are no recent launches, then select Run > Run History >

Fair Isaac Corporation Confidential and Proprietary Information 70


:

(number) Credit Card Run Configuration, where (number) represents the number
associated with one of the previous configuration runs.
This is the new result. Notice that it is different because the rule value was changed.
You are eligible for a PlatinumPlus card and you will receive a Gift
Certificate.
This time, the applicant receives a PlatinumPlus card instead of a Platinum card, and a
Gift Certificate instead of a Leather Briefcase.
If for some reason, the outcome does not match what you see in the Console view,
double-check to see that the initial values in the newApplicant object in the Credit Card
Folder are set correctly:
annualAirlineTrips = 6.
creditHistory = "Good".
income = 38000.
isMarried = "true".
mosInCurrentJob = 12.
rollingOverBalances = "true".
spousalIncome = 41000.

Customizing an RMA
In this tutorial, you used the default settings for the rule maintenance application. When you
create your rule maintenance application, you will probably want to customize the look and
feel of the application to create an editing environment that makes your analysts most
comfortable.
For example, you can add text or graphics that help guide your analysts as they update the
rules. Additionally, you can change the colors, font types, and font sizes used in the pages.

See Also: For more information, see ““Generating Rule Maintenance Applications” in
DevelopingRuleMaintenanceApplications.pdf”.

Fair Isaac Corporation Confidential and Proprietary Information 71


Module 4 - Generating COBOL Code
The procedures in this module show you how to use the Generate Deployment Wizard to
generate a COBOL subprogram, that is designed to be called from another COBOL program.
For more information about how to use the COBOL subprogram, see “Generating and
Deploying the Blaze Advisor COBOL Code” in COBOLReference.pdf.
Prerequisite: The rule project used for this module must contain an imported COBOL
copybook. See “Module 2 - Importing a COBOL Object Model” on page 66. If you completed
Modules 1 and 2, you can use the project under the _My Work directory. If you just want to
generate a deployment, use the project under the Completed Tutorial folder, complete
Module 2, and then return to this module.
Time Estimate: 15 minutes to complete
To begin this module, you must start the Blaze Advisor IDE and connect to the COBOL
Tutorial Repository, if it is not already open. See “Opening the Blaze Advisor
Perspective” on page 45.

Deleting the Reference to the Test Folder


The Credit Card project is constructed for testing the rules in the Blaze Advisor IDE. To
prepare for COBOL code generation, you will delete the reference to the Test folder that
contains the printResults() function. In the next section, you will replace that function
with an entry point function.
Deleting a reference to a folder does not remove an item from the repository. It just removes
the reference from the project so that the item is not evaluated at runtime.
Because the printResults() function is also used as a ruleflow task, you will delete the
task.

To delete the reference to the Test Folder


1 In the Project Explorer, right-click the Credit Card [COBOL Tutorial Repository]
project and select Open Project editor.
2 In the Project editor, select the Test reference.
3 Delete it using one of these options:
 Select Edit > Delete.
 Press the Delete key on your keyboard.
 Right-click and select Delete.
4 In the Project Explorer, double-click on Credit Card Ruleflow to open the Ruleflow
editor.
5 In the Ruleflow editor, select the task, PrintTestResults, and delete it using one of the
previously listed options.
6 Save your changes.

Fair Isaac Corporation Confidential and Proprietary Information 72


:

Creating an Entry Point for Deployment


To generate COBOL code, your rule project needs to have an entry point for passing data. In
this section, you create a function for the entry point that will invoke the Blaze Advisor built-in
function, executeAgent(). This function starts the ruleflow.

See Also: For more information about which Blaze Advisor built-ins are supported for
projects with a COBOL object model, see “Supported and Unsupported Blaze Advisor Built-in
Functions” in Reference.pdf.

To create an entry point


1 Create a new function using one of these options:
 Select File > New > Decision Entities > Function.
 Click the New Function icon on the Blaze Advisor Entities toolbar.
2 In the Entity name field, enter mainForCOBOL and click Finish.
3 Retain void in the Return type field, and retain <Default> in the Execution Mode field.
4 In the Function body, enter this SRL:
executeAgent().
5 (Optional) Build and run the project. You no longer see the printed output. This is
because the printed statements used in the printResults() function in the Test folder
were removed from the project.
6 Save your changes.

Configuring the Deployment Settings


Blaze Advisor allows you to configure and store deployment settings in deployment entities
that can be used with multiple COBOL deployments. For example, if you know that most of
your COBOL deployments will use the same settings, you can configure the deployment
entities once, save them to a repository folder, and reuse them as needed.
When you use the Generate Deployment Wizard, you reference the deployment entities with
the configuration settings to generate the COBOL code.
In this section, you will configure the following deployment entities:
 Rule Service Definition (RSD), which is used to configure the entry point for the rule
service.
 Deployment Definition (DD), which is used to configure the system-independent
deployment settings, such as the COBOL code generation options.

To create the Rule Service Definition


1 Select File > New > Deployment and RMA Entities > Rule Service Definition.
2 In the Entity name field, enter Credit Card Rule Service Definition and click
Finish to open the Rule Service Definition editor.
3 In the Rule Service field, enter:
Credit Card Rule Service

Fair Isaac Corporation Confidential and Proprietary Information 73


:

4 In the Description field, enter:


COBOL code for rule service
5 Select the COBOL compatible check box.

Note: When the COBOL compatible option is selected and the Code Generation project
property is set to COBOL, Optimized mode for all metaphors is ignored.
6 Next to the Entry Points field, click Add.
7 From the Functional Item drop-down list, select mainForCOBOL().

Note: The Entry Point ID field is automatically filled in after selecting the functional item.
8 Click Finish to close the Entry Point Wizard.
9 Save your changes.

To create the Deployment Definition


1 Select File > New > Deployment and RMA Entities > Deployment Definition.
2 In the Entity name field, enter Credit Card COBOL Deployment Definition and
click Finish to open the Deployment Definition editor.
3 Perform the following actions in this editor:
a In the Environment Settings section, select COBOL from the Target Platform drop-
down list.
b In the Rule Server Settings section, retain Stateless in the Server Type field.
4 Click the Code Generation tab to view the default values. Do not change the values.
5 Save your changes.

Using the Wizard to Generate COBOL Code


You use the Generate Deployment Wizard to generate COBOL code from a rule project. The
output is a COBOL subprogram, which you can call from your COBOL application. See
“Generating and Deploying the Blaze Advisor COBOL Code” in COBOLReference.pdf.

To use the wizard to generate COBOL code


1 Select Project > Generate Rule Service Deployment.
2 Retain the default values in the first page of the wizard. Notice that the wizard is
referencing the Rule Service and Deployment Definitions you created earlier. Click Next.
3 Select a Target Directory for the output files using one of these options:
 Retain the default path, which is .\<RuleServiceName>, where
<RuleServiceName> represents the name of the Rule Service that is defined in the
selected Rule Service Definition.

Note: .\<RuleServiceName> results in a folder of that name getting created in


<Eclipse Home>/eclipse/. If the rule service name is Credit Card Rule Service, then
the following folder is created—<Eclipse Home>/eclipse/Credit Card Rule
Service.
 Erase the default path and enter a new one.

Fair Isaac Corporation Confidential and Proprietary Information 74


:

 Click Browse to open the Select Folder dialog box and locate the desired directory.
4 Click Finish.
The generated COBOL files are in the folder you specified in the Target Directory field in the
Generate Deployment Wizard. The CBLPGM.cbl file contains the rules. For a description of
each generated file, see “Files That Comprise the Generated COBOL Subprogram” in
COBOLReference.pdf.

Note: In this tutorial, the input data is contained in the Initially section of the newApplicant
object and the entry point, mainForCOBOL(), does not contain any parameters or return type.
In real-world COBOL applications, input data is usually passed into the entry point through
parameters from some external data source.

Fair Isaac Corporation Confidential and Proprietary Information 75


CHAPTER 3
Ruleset Tutorial

This FICO® Blaze Advisor® decision rules management system feature tutorial shows you
how to create a set of rules, also known as a ruleset. You will also learn how to write a
function that allows you to test the ruleset using the provided test data.
A ruleset is a grouping of rules. It is recommended to group your rules into a ruleset because
it:
 Permits the Blaze Advisor project to model a work-flow process
 Improves the readability and maintainability of the rulebase
 Can significantly improve the performance of the rule engine by limiting the scope of the
rule engine to the current group of rules
This is a figure of the ruleset you will create in this tutorial:

Using the figure above, you can see that the ruleset contains several rules. You can also see
other Structured Rule Language (SRL) entities that are used to write the rules. You will create
these entities as part of this tutorial.
In this tutorial, the rules will eliminate insurance applicants who do not qualify for an
insurance policy. The rules evaluate each application and determine whether or not the

Fair Isaac Corporation Confidential and Proprietary Information 76


Chapter 3: Ruleset Tutorial

applicant meets the minimum requirements for processing. For example, the applicant must
be 16 and a resident of the United States.
Prerequisites for this tutorial: You should have a basic understanding of how to use. If you
are new to the Blaze Advisor IDE, complete the “Introductory Tutorial” on page 13 or review
the Blaze Advisor documentation.
Time estimate: 60 minutes
Role of the ruleset in the completed tutorial: In a real-world situation, a ruleset is just one
component of a rule service. While you are completing this tutorial, assume that you are part
of a project team assigned to create the ruleset that will evaluate applicant data and
disqualify applicants who do not meet the requirements of the insurer.
The ruleset will be created in a separate folder and tested. After the ruleset is completed, it
becomes integrated into the project. In this tutorial, you will just create the ruleset and then
view how the ruleset is used in the completed project.
To view the completed version: In the IDE, you can view a completed version of the ruleset at
any time. The completed version is located in the Knockout Rules Development project under
this directory: Auto Policy Rules\Testing\Unit Testing\Knockout Rules
Development Folder. See “Opening the Project and Including Folders” on page 77.
In the Repository Explorer, expand the Knockout Rules Development Folder and you will see
the main function and the Knockout Rules Development project. Expand the Knockout Rules
Development project and you will see four referenced folders:
 Auto Policy XML BOM
 Knockout Rules
 Knockout Rules Development Folder
 Utilities

Opening the Project and Including Folders


To begin this module, you must open the Blaze Advisor perspective.See “Opening the
Blaze Advisor Perspective” on page 13. After you have connected to the Feature Tutorials
repository, you need to open the project where you will complete the tutorial steps.
Then, you will include (or reference) the AutoPolicy XML BOM folder that will be used to
write the rules. When you include a folder, the contents become part of the project. In
addition, you need to include the function, numberOfYearsSince, that is in the Utilities
subfolder, also located in the Technical Library folder. This function is used to calculate the
age of the applicant in the Knockout Ruleset. Finally, you will also use the NdProductInfo
class, in the Utilities folder, which is used to obtain the Blaze Advisor installation directory.

To open the project and include the AutoPolicy BOM and Utilities
folders
1 Select File > Import, expand the Blaze Advisor folder, select Rule Project, and click Next.
2 In the Select Repository wizard page, select Feature Tutorials Repository and click Next.
3 In the Select a Blaze Advisor Project wizard page, expand the Ruleset Tutorial folder,
select the Ruleset Tutorial Project, and click Finish to open the project.

Fair Isaac Corporation Confidential and Proprietary Information 77


Chapter 3: Ruleset Tutorial

4 In the Project Explorer, right-click the Ruleset Tutorial Project [Feature


Tutorials Repository] project and select Open Project Editor.
5 Use one of these options to invoke the Include Folder or Project dialog box.
 Click the Include Folder or Project icon in the Project Editor.
 Select Project > Include Folder or Project....
6 Expand Auto Policy Rules\Technical Library\Business Object Models and
select the Auto Policy XML BOM folder. Click Include to include this item in the project.
7 Open the Include Folder or Project dialog box again and this time expand Auto Policy
Rules\Technical Library and select the Utilities folder. Click Include to include
this item in the project.
8 If the File > Save command or the Save icon is enabled, save your changes.

Tip: In the Blaze Advisor Perspective, project changes are automatically saved when you
make them from the Project Explorer. For example, including a folder from the Project
Editor requires you to save changes, but including a folder from the Project Explorer,
using the Project > Include Folder or Project... command, does not.

See Also: For more information, see “Saving Changes to Projects and Project Items” in
DevelopingRuleProjects.pdf.
9 Select File > Refresh to update the contents of the repository.
The AutoPolicy XML BOM and Utilities folders are now included in the Ruleset Tutorial
Project.

Creating the Knockout Ruleset


You must create the ruleset before you can create the rules and the ruleset’s related SRL
entities. The ruleset serves as a container for all these items.

Note: Blaze Advisor is case-sensitive, so when you create entities, as well as when you write
the knockout rules, ensure that the capitalization matches the text shown.

To create the ruleset


1 Create a new ruleset using one of these options:
 Select File > New > Decision Entities > Ruleset.
 Click the New Ruleset icon on the Blaze Advisor Entities toolbar.
2 In the Entity name field, enter KnockoutRuleset and click Finish to open the Ruleset
Editor.
3 Retain void in the Return Type field, and retain <Default> in the Execution Mode field.
4 Click the New Parameter icon next to the Parameters (none) title.
a For the parameter name, erase parameter1 and enter:
thePolicy
b From the Type drop-down list, select AutoPolicy.

Fair Isaac Corporation Confidential and Proprietary Information 78


Chapter 3: Ruleset Tutorial

Creating the Variable, Event Rule, and Pattern


Now you will create the following three entities:
 A local ruleset variable is a placeholder for storing values and used only in the context of
the ruleset where it is defined. You can change these values during rule processing
through an assignment statement in a rule or function. In this tutorial, you will create a
variable, named decision, that contains the status (accepted, disqualified or pending)
and reason text (if disqualified) of the application evaluation.
 An Is-needed property event rule is triggered by the rule engine when the property value is
needed in a rule condition, rule action, or function. In this tutorial, the value of the
property, Age, is needed in the rule condition of the checkAge rule. At this point,
Blaze Advisor calls the event rule, findAge, which invokes the function,
numberOfYearsSince, from the referenced Utilities folder. This function calculates the
age of the applicant and returns this value to the property, Age.
 A pattern is a simple way to refer to multiple instances of a specific class or interface.
When you want to write rules that are evaluated for all of the available objects of a
particular type you can use a pattern for the type. You declare a pattern for the class or
interface, and then use it in rules to instruct the rule engine to evaluate each object that
matches the pattern. In this tutorial, the pattern, anyVehicle, is declared for the class,
VehicleInfo, and evaluates all the vehicles in the application without having to write
specific SRL to loop over the array of vehicles.

Tip: You can copy the SRL from this document and paste it into the Initially field or open the
completed tutorial in another instance of Blaze Advisor. Be sure to use straight quotes for
any quotation marks in the Blaze Advisor IDE. You can follow this copy/paste procedure each
time the tutorial asks you to enter SRL into an entity.

To create the variable


1 Click the New Variable icon in the Content section of the Rule Editor.
2 Click the arrow to display the fields.
3 For the variable name, erase variable1 and enter:
decision
4 In the Type field, select the DecisionInfo class.
5 Expand the decision variable and in the Initially field, enter the following three lines of
SRL:
a DecisionInfo initially {
status = "pending".
}

To create the event rule


1 Click the New Event Rule icon in the Content section of the Rule Editor.
2 Click the arrow to display the fields.
3 For the event rule name, erase eventrule1 and enter:
findAge
4 In the Whenever a field, select the PersInfo class.

Fair Isaac Corporation Confidential and Proprietary Information 79


Chapter 3: Ruleset Tutorial

5 In the next field, select the Age property.


A dot separates these two fields to signify the dot notation of the Age property within the
PersInfo class, which is shown as PersInfo.Age.
6 In the next field, select is needed.
7 In the blank field below the condition Whenever a PersInfo.Age is needed, enter:
Age = numberOfYearsSince(thePolicy.Customer.PersInfo.DOB)
This event rule only executes when a value for the property Age is required. You will see
how this is used in the checkAge rule you will write in the next section. Note that even
though there is an Age property in the PersInfo class, the test data does not contain an
Age value, so Age must be calculated by the numberOfYearsSince function that is
invoked in the findAge event rule.

Tip: To view the properties of the PersInfo class, expand the Auto Policy XML BOM
folder, Auto Policy BOM, and the PersInfo class, in the Object Model Explorer. If the
folder does not display in the Object Model Explorer, build the project by selecting
Project > Build Project. The folder should now appear.

To create the pattern


1 Click the New Pattern icon in the Ruleset Editor.
2 Click the arrow to display the fields.
3 For the pattern name, erase pattern1 and enter:
anyVehicle
4 Select the VehicleInfo class from the Is any drop-down list.
5 Expand the anyVehicle pattern and in the In collection field enter:
thePolicy.VehicleInfo
The Such that field is left blank.
Because applicants can have more than one vehicle, a pattern is used to evaluate all of
the vehicles, which are stored in an array. If you did not use a pattern, you would have to
write specific SRL to loop over the array. Remember that applicants can have more than
one vehicle for which they are applying for auto insurance.
6 Save the changes.

Writing the Knockout Rules


Now you will create the following six rules:
 checkAge - Determines if the applicant is at least 16 years of age.
 checkAnnualMileage - Verifies if the applicant has driven more than 50,000 miles in
the past year.
 checkCountry - Confirms that the applicant lives in the United States.
 checkNumAccidents - Validates if the applicant has been in fewer than 7 accidents in
the past 3 years.
 checkNumMovingViolations - Ascertains if the applicant has been in fewer than 5
moving violations in the past 3 years.
 finalRule - Acts as a catchall if none of the Knockout Rules have been fired and
assigns decision.status = "qualified".

Fair Isaac Corporation Confidential and Proprietary Information 80


Chapter 3: Ruleset Tutorial

Each rule that begins with check determines if the applicant passes certain eligibility
requirements such as being at least 16 years of age. If the applicant does not pass the
criteria, then the rule assigns the status of disqualified and associates a reason with the
disqualification.
The reason is represented by the property, ReasonText, and is located in the body of the
rule. It describes why the applicant has been disqualified and can be written in many ways.
For example, in the following checkAge rule, the reason text describes that the applicant is
under the age of 16.
Also note that at the end of each check rule, you are assigning the values (status and
ReasonText) from the decision variable to the ruleset’s parameter, thePolicy, and then
returning it to the Data Validation Ruleflow.

Writing the First Rules


The first rules you will write are checkAge, checkAnnualMileage, and checkCountry.

To create the checkAge rule


1 Click the New Rule icon in the Ruleset Editor.
2 Click the arrow to display the fields.
3 For the rule name, erase rule1 and enter:
checkAge
4 In the body of the rule, enter:
if thePolicy.Customer.PersInfo.Age < 16
then {
decision.status = "disqualified".
decision.ReasonText.append("You are under the age of 16 and are too young to
drive.").
thePolicy.DecisionInfo = decision.
}
The line that begins with decision.ReasonText.append wraps to the next line due to
space limitations in this document. This next line begins with young to drive. Type
these two lines on the same line in the rule body so it looks like this:
decision.ReasonText.append("You are under the age of 16 and are too young to drive.").
5 (Optional) Add this text in the Comment field to document its purpose:
Applicant must be at least 16 yrs of age.
To enter a comment for a specific rule, click on the Comments icon to display the
Comments field.

Tip: The Comments icon is located in the upper right-hand corner in the rule editor:

Fair Isaac Corporation Confidential and Proprietary Information 81


Chapter 3: Ruleset Tutorial

To create the checkAnnualMileage rule


1 Click the New Rule icon in the Ruleset Editor.
2 Click the arrow to display the fields.
3 For the rule name, erase rule1 and enter:
checkAnnualMileage
4 In the body of the rule, enter:
if anyVehicle.AnnualMileage > 50000
then {
ignore (anyVehicle).
decision.status = "disqualified".
decision.ReasonText.append("You drive your "anyVehicle.Make"
"anyVehicle.Model" too many miles each year.").
thePolicy.DecisionInfo = decision.
}
The line that begins decision.ReasonText.append wraps to the next line due to space
limitations. Enter that line and the one below it on the same line in the rule body. There
should be a space between "anyVehicle.Make" and "anyVehicle.Model.
5 Optionally, you can add the following comment to this rule:
Applicant must drive less than 50,001 miles annually.
The ReasonText in the body of this rule contains the values of the make and model of the
vehicle using dot notation (anyVehicle.Make and anyVehicle.Model). This
information is necessary to display if the applicant has more than one vehicle and is
disqualified because of the mileage driven.

To create the checkCountry rule


1 Click the New Rule icon in the Ruleset Editor.
2 Click the arrow to display the fields.
3 For the rule name, erase rule1 and enter:
checkCountry
4 In the body of the rule, enter:
if thePolicy.Address.Country <> "United States"
then {
decision.status = "disqualified".
decision.ReasonText.append("You live outside the United States").
thePolicy.DecisionInfo = decision.
}
5 (Optional) Add this text in the Comment field:
Applicant must have a US address.

Writing Rules Using the Count Property of an Array


Arrays have a count property that is a read-only integer indicating the number of elements in
that array. In the following two rules, AccidentInfo and MovingViolations are arrays
because the applicant can have more than one accident or moving violation. The total
number of accidents and moving violations are calculated using this count property.

To create the checkNumAccidents rule


1 Click the New Rule icon in the Ruleset Editor.
2 Click the arrow to display the fields.

Fair Isaac Corporation Confidential and Proprietary Information 82


Chapter 3: Ruleset Tutorial

3 For the rule name, erase rule1 and enter:


checkNumAccidents
4 In the body of the rule, enter:
if thePolicy.Customer.DrivingRecord.AccidentInfo.count > 6
then {
decision.status = "disqualified".
decision.ReasonText.append("You have been involved with too many accidents").
thePolicy.DecisionInfo = decision.
}
The line that begins decision.ReasonText.append wraps to the next line due to
space limitations. Enter that line and the one below it on the same line in the rule body.
5 (Optional) Add this text in the Comment field:
Applicant must have been involved with less than 7 accidents in the
last 3 years.

To create the checkNumMovingViolations rule


1 Click the New Rule icon in the Ruleset Editor.
2 Click the arrow to display the fields.
3 For the rule name, erase rule1 and enter:
checkNumMovingViolations
4 In the body of the rule, enter:
if thePolicy.Customer.DrivingRecord.MovingViolations.count > 4
then {
decision.status = "disqualified".
decision.ReasonText.append("You have "
thePolicy.Customer.DrivingRecord.MovingViolations.count " moving violations
and only 4 are allowed.").
thePolicy.DecisionInfo = decision.
}
The line that begins decision.ReasonText.append wraps to the next two lines due to space
limitations in this document. Type that line and the two lines below it on the same line in
the rule body.
5 (Optional) Add this text in the Comment field:
Applicant must have less than 5 moving violations in the last 3
years.

Writing the Final Rule


You write a final rule that can be run if no reason for disqualification is found.

To create the finalRule rule


1 Click the New Rule icon in the Ruleset Editor.
2 Click the arrow to display the fields.
3 For the rule name, erase rule1 and enter:
finalRule
4 In the body of the rule, enter:
// Only run this rule if no reason for disqualification has been found.
if decision.status = "pending" then {
decision.status = "qualified".
thePolicy.DecisionInfo = decision.

Fair Isaac Corporation Confidential and Proprietary Information 83


Chapter 3: Ruleset Tutorial

return.
}
5 (Optional) Add this text in the Comment field:
This rule is only fired if none of the previous Knockout Rules have
been triggered. If this rule is fired, the decision.status is changed
from "pending" (the variable’s default value) to "qualified".
6 Save your changes and close the Ruleset Editor.

Writing a Function to Test the Ruleset


In this section, you will write a main function to test the ruleset and print the status of the
application. If the applicant is disqualified, then the reason for disqualification is also
displayed. This function is only used to test the ruleset and is not used in the deployed rule
service.

Tip: You can copy the SRL from this document and paste it into the Function body field. Be
sure to use straight quotes for any quotation marks in the Blaze Advisor IDE.

To create a main function


1 In the Project Editor, select the Ruleset Tutorial folder.
2 Click the New Function icon on the Blaze Advisor Entities toolbar.
3 In the Entity name field, enter main and click Finish.
4 Retain void in the Return type field, and retain <Default> in the Execution Mode field.
Do not create any parameters.
5 In the Function body field, enter this SRL:
// Test case # 1 - a valid policy
thePolicy is some AutoPolicy initially
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT
_ADVISOR_TUTORIALS)"/tutorials/testData/valid1.xml").

// Test case # 2 - an invalid policy from an underage applicant


//thePolicy is some AutoPolicy initially
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT
_ADVISOR_TUTORIALS)"/tutorials/testData/rs_invalid_age.xml").

// Test case # 3 - an invalid policy from an applicant with too many annual miles
//thePolicy is some AutoPolicy initially
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT
_ADVISOR_TUTORIALS)"/tutorials/testData/rs_invalid_miles.xml").

// Test case # 4 - an invalid policy from an applicant with too many moving
violations
//thePolicy is some AutoPolicy initially
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT
_ADVISOR_TUTORIALS)"/tutorials/testData/rs_invalid_violations.xml").

apply KnockoutRuleset(thePolicy).
print("Status is: "thePolicy.DecisionInfo.status).
if thePolicy.DecisionInfo.ReasonText.count > 0 then {
for each string in thePolicy.DecisionInfo.ReasonText do {
print("Reason for disqualification: "it).
}
}

Fair Isaac Corporation Confidential and Proprietary Information 84


Chapter 3: Ruleset Tutorial

Note: Each test case block contains a line that begins with thePolicy or //
thePolicy. Each of these lines wraps to the next two or three lines due to space
limitations in this document. For each test case, enter all the lines on the same line in the
function body. It is important that there are no line breaks in each of the test cases. In
addition, the inital comment for Test case # 3 and Test case # 4 also wraps and needs to
be entered on one line. Finally, Test cases # 2 - # 4 are intentionally commented out.
6 Save your changes and close the Function Editor.
Each test case is using the readAutoPolicy method to read in test data. In addition, the
getInstallDirectory method of the NdProductInfo class is used to obtain the
Blaze Advisor installation directory to create the correct path for the location of the test
data.
A local parameter, called thePolicy of AutoPolicy type, references the test data. The
apply keyword is used to invoke the Knockout Ruleset you created and uses thePolicy
as the argument.

Testing the Knockout Ruleset


The main() function in the Knockout Rules Development folder is used as the entry point to
send data from the test file to the Knockout Ruleset for evaluation.
The SRL syntax in the body of the main() function contains directions on where to find the
test data and invokes the Knockout Ruleset to process the data. There are four test files
provided for you and in the comments, they are labeled Test case # 1 - # 4. One test file
contains valid applicant information while the other three contain invalid data that results in
an applicant disqualification.
When the evaluation is completed, the Status and Reason for disqualification, if applicable,
are displayed in the Console view.

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 You need to create a run configuration before running the project. Select Run > Run
Configurations... to open the Run Configurations dialog box.
3 Select Blaze Advisor Project in the leftmost list of launch configuration types, and click
the New launch configuration icon on the toolbar.
4 Enter Ruleset Tutorial Run Configuration in the Name field.
5 If the Ruleset Tutorial Project does not appear in the Project to Run field, perform the
following steps to complete the run configuration for this project:
a Click Select Project to open the Rule Project dialog box.
b Select Ruleset Tutorial Project [Features Tutorial Repository] and click OK.
6 Click Apply to save your edits.
7 Click Run from the Run Configurations dialog box.
Compare your results in the Console view to the Output Results column in the table in the
next section.

Fair Isaac Corporation Confidential and Proprietary Information 85


Chapter 3: Ruleset Tutorial

Tip: For subsequent runs, you can click the Run icon on the Launch toolbar, select
Run > Run, or right-click the project in the Project Explorer and select Run As > 1 Blaze
Advisor Project. The Ruleset Tutorial Run Configuration is automatically run with the Run
As command because there is a matching configuration for the currently selected
project. If you receive a message stating there are no recent launches, then select Run >
Run History > (number) Ruleset Tutorial Run Configuration, where (number) represents
the numeral associated with one of the previous configuration runs.
8 Double-click on the main() function in the Project Explorer. In the Function body, place a
comment (double forward slashes—//) in front of the line that begins with thePolicy
is some AutoPolicy.
In the next test case block, remove the comment from the line that begins with
//thePolicy is some AutoPolicy. It is important that only one occurrence of this
line is enabled; otherwise an error will occur.

Note: The line in each test case that begins with thePolicy is some AutoPolicy
may wrap to the next line or two, depending on the width of your function editor. If the
line wraps, you only need to add and remove comments from the first line.

Tip: To view fresh results from the new run, click the Clear Console icon on the
Console toolbar to clear the results from the previous run.
9 Save the changes, and then run the project to observe the new output results.
10 Repeat the previous two steps until you have run all four test cases.

Note: The test files are located in <ADVISOR_HOME>\tutorials\testData. If you choose


to edit these files, you may not get the results you expect.

Examining the Results


When you run the test data provided for you, you can verify that you received the correct
results by comparing what you see in the Console view with the following table:

Test File Name Output Results


valid1.xml Status is: qualified

Execution complete.
rs_invalid_age.xml Status is: disqualified
Reason for disqualification: You are under the age of 16
and are too young to drive.

Execution complete.

Fair Isaac Corporation Confidential and Proprietary Information 86


Chapter 3: Ruleset Tutorial

Test File Name Output Results


rs_invalid_miles.xml Status is: disqualified
Reason for disqualification: You drive your De Soto
Dynamite too many miles each year.

Execution complete.
rs_invalid_violations.xml Status is: disqualified
Reason for disqualification: You have 5 moving
violations and only 4 are allowed.

Execution complete.

Summary
In this tutorial, you performed these tasks:
 Used the Ruleset Editor to create the Knockout Ruleset.
 Used the Function Editor to create a main() function.
 Built and ran the project using test data.
 Evaluated the generated output with expected output data.
For testing purposes, the ruleset was invoked by the main() function. However, in the
completed tutorial, the ruleset is invoked from a ruleflow.
The ruleset you created replicates the one in the completed tutorial. To see how the ruleset
works in relationship to the other entities in the completed tutorial, use the Repository
Explorer to open the Data Validation Ruleflow Testing project under this directory:
Auto Policy Rules\Testing\Rule Service Testing\Data Validation Ruleflow
Testing Folder.
In the project, expand the Data Validation Ruleflow folder, and double-click on Data
Validation Ruleflow. You see the ruleflow, which is the execution flow, for the part of the
project where the Knockout Rules are used as the first task in the ruleflow. The results of the
Knockout Rules are sent to the decision block. The decision block determines the next step
in the ruleflow which needs to process the information on whether the status is disqualified
or not.

See Also: For more information, see “Rulesets and Rules” in DevelopingRuleProjects.pdf.

Fair Isaac Corporation Confidential and Proprietary Information 87


CHAPTER 4

Decision Table Tutorial

This FICO® Blaze Advisor® decision rules management system tutorial shows you how to
use the Decision Table Wizard to create a decision table.
A decision table is a graphical representation of a ruleset that allows your business users to
easily create and maintain rules using a tablular format. A decision table represents several
rules, all using the if-then construction. Data validation is provided for each cell, which
reduces the likelihood of errors at runtime.
This figure shows a partial view of the decision table you will create:

Suppose that you are a member of a development team that has been assigned the task of
creating a decision table to evaluate applicant data and assign a value tier. Value tiers are
used to calculate insurance premiums based on the driving record of an applicant and other
related data. Value tier 1 is considered the best tier, and this tier is only assigned to good
drivers.
By the time the data passes to the decision table in the ruleflow, a set of rules has been
applied to eliminate insurance applicants who do not qualify for insurance, and a score
model has calculated a score for the degree of risk an applicant represents. The risk score is
then passed to the next entity in the ruleflow, which is the decision table you are going to
create. The decision table evaluates the incoming data and assigns a value tier based on the
risk score and the driving record of the applicant. The value tier is a rating that is assigned to
insurance applicants and is used to calculate the insurance premium. In this scenario, the
value tier is passed to a set of rules that applies any discounts and determines the insurance
premium that the applicant will pay.
Imagine that after the risk score is determined by the score model, the risk score is passed to
the decision table. Customers with a good risk score, who have had no accidents, are

Fair Isaac Corporation Confidential and Proprietary Information 88


Chapter 4: Decision Table Tutorial

immediately assigned a value tier. The data for customers who have had one or more
accidents are evaluated further using conditions that relate to the accident information.
In all cases, the cell at the end of each row contains an action expression. For this project, the
action is to assign a value tier. Note that a Single-axis decision table can have more than one
action. For this project only one action is required.
Prerequisites for this tutorial: You should have a basic understanding of how to use the
Blaze Advisor IDE. If you are new to Blaze Advisor, complete the “Introductory Tutorial” or
review the Blaze Advisor documentation.
Estimated time to complete: 60 minutes
Role of the decision table in the AutoPolicy scenario: In a real-world situation, a decision
table is just one component of a rule service. While you are completing this tutorial, assume
that you are part of a project team assigned to create the decision table that will evaluate
applicant data and assign a value tier.
The decision table will be created in a separate folder and tested. After the decision table is
completed, it becomes integrated into the project. In this tutorial, you will just create the
decision table and then view how it is used in the completed project.
To view the completed version: At any time, you can import and view a completed version of
the decision table. The completed version is the Tier Placement Decision Table
Template Development project. See “Working in the Decision Table Tutorial Project” on
page 89.

Working in the Decision Table Tutorial Project


The Decision Table Tutorial Project is provided for you as a starting point. It includes the
Decision Table Tutorial folder, which is where you will store most of the entities that you will
create.
The first step in the tutorial is to include other folders that contain the business object model
(BOM) used to write the decision table rules and the NdProductInfo class used to access
the Blaze Advisor installation directory. When you include a folder using the Project Editor,
the entities contained in the folder become part of the project. After you complete the
procedure in this section, your project will contain references to the Auto Policy XML (BOM)
and Utilities folders.

See Also: For more information, see “Creating and Deleting References to Folders or
Subprojects” in DevelopingRuleProjects.pdf.

To open the project and include the AutoPolicy BOM and Utilities
folders
1 Select File > Import, expand the Blaze Advisor folder, select Rule Project, and click Next.
2 In the Select Repository wizard page, select Feature Tutorials Repository and click Next.
3 In the Select a Blaze Advisor Project wizard page, expand the Decision Table Tutorial
folder, select the Decision Table Tutorial Project, and click Finish to open the
project.
4 In the Project Explorer, right-click the Decision Table Tutorial Project [Feature
Tutorials Repository] project and select Open Project Editor.

Fair Isaac Corporation Confidential and Proprietary Information 89


Chapter 4: Decision Table Tutorial

5 Use one of these options to open the Include Folder or Project dialog.
 Click the Include Folder or Project icon in the Project Editor.
 Select Project > Include Folder or Project....
6 Expand Auto Policy Rules\Technical Library\Business Object Models and
select the Auto Policy XML BOM folder. Click Include to include this item in the project.
7 Open the Include Folder or Project dialog again and this time expand Auto Policy
Rules\Technical Library and select the Utilities folder. Click Include to include
this item in the project.
8 If the File > Save command or the Save icon is enabled, save your changes.

Tip: In the Blaze Advisor Perspective, project changes are automatically saved when you
make them from the Project Explorer. For example, including a folder from the Project
Editor requires you to save changes, but including a folder from the Project Explorer,
using the Project > Include Folder or Project... command does not.

See Also: For more information, see “Saving Changes to Projects and Project Items” in
DevelopingRuleProjects.pdf.
9 Select File > Refresh to update the contents of the repository.
The AutoPolicy XML BOM and Utilities folders are now included in the Decision Table
Tutorial Project. The full path to these folders appears in the Project Editor. In the Object
Model Explorer, you can expand the AutoPolicy XML BOM and Utilities folders to see the
classes contained in them.

Tip: If the folders do not display in the Object Model Explorer, build the project by
selecting Project > Build Project.

Creating the Decision Table


Use the Decision Table Wizard to create a Decision Table Template. In the wizard, you can
specify the class properties for the data that your rules will evaluate. You can also specify the
conditions and actions needed to build your if...then rules.

To open the Decision Table Wizard


1 In the Decision Table Tutorial Project, expand the Decision Table Tutorial folder in
the Project Explorer.
2 Select the Decision Table Tutorial folder.
3 Click the New Item icon on the Blaze Advisor Entities toolbar and select Template
from the drop-down menu.
4 In the New Template window, select Decision Table, and enter this text in the Name field:
Tier Placement Decision Table Template
5 Click OK. This opens the Decision Table Wizard that you will use to create the structure
for the template.
6 Retain Single-axis (Columns) table and click Next.

Fair Isaac Corporation Confidential and Proprietary Information 90


Chapter 4: Decision Table Tutorial

Setting the Decision Table Features


On the first page of the wizard you will specify how data will be passed into the decision table
and what will be returned from the table.
In this project, the parameter will be of type AutoPolicy. It will be used to pass in a
customer’s application for an automobile policy.
The pattern will be used to access the properties of the AccidentInfo array in the
DrivingRecord of the Customer class.
The return type will be void because the action expression in each rule will set the value of
the ValueTier property of the DecisionInfo class.

To set the decision table features


1 In the Name field, retain the current entry.
2 Retain void as the Return type.
3 Click the New Parameter icon on the toolbar to create a new parameter.
a Replace the default entry by highlighting it and entering:
thePolicy
b Select AutoPolicy from the Type drop-down list.
4 Click the New Pattern icon on the toolbar to create a new pattern.
This pattern is used to evaluate data from an array.
a Replace the default entry, by highlighting it and entering:
anyAccidents
b Select AccidentInfo from the Type drop-down list.
5 Click Next.

Creating Condition Cell Groups


You will create five condition cell groups (Risk Score, Any Accidents in Last 3 Years, Accident
Type, Bodily Injuries, and At Fault).
A condition cell group represents a column of table cells that operate on the same class
property, parameter, pattern, or variable of a primitive or enumeration type. The expression in
each decision table cell is an “if” statement such as theParameter.property
<operator> {value}. However, the format of the condition expression can vary from cell
to cell within the same group. For example in this tutorial, you will use two variations of the
Risk Score expression in the decision table:
 thePolicy.DecisionInfo.RiskScore >= {real 1} and
thePolicy.DecisionInfo.RiskScore < {real 2}
 thePolicy.DecisionInfo.RiskScore >= {real}
There are two types of condition and action cell groups: dynamic and static.
 A dynamic cell group is based on a class type parameter, variable, object, or pattern. It
allows the selection of a class property in the Decision Table Editor. The condition
expressions are generated when a class property is selected in the editor. Additionally,
there is an All Entities option that allows the selection of a class property from any class

Fair Isaac Corporation Confidential and Proprietary Information 91


Chapter 4: Decision Table Tutorial

type parameter, variable, object or pattern created in the wizard or available in the
project.
 A static cell group is one that is based on a specific property, parameter, or variable of a
primitive or enumeration type. You can select the expression formats for the cell group in
the wizard. The condition expressions are generated at the time the Decision Table
Template is generated.
You will use the wizard to create both dynamic and static cell groups.

To create the cell groups


1 Select All Entities and click the arrow to add it to the Conditions panel. This allows you to
create dynamic cell groups in the Decision Table Editor. This will be used for the Risk
Score and Any Accidents in Last 3 Years conditions.
2 Expand Local and then expand anyAccidents.
3 Select AccidentTypeCd and click the arrow to add it to the Conditions panel.

Tip: You can widen the Available Conditions panel to read the contents more easily.
4 In the Display Name field, double-click in the field and change the name to: Accident
Type
5 Repeat Steps 3 and 4 to add two other properties from anyAccidents.
 BodilyInjuriesInd - Use Bodily Injuries for the display name.
 AtFaultInd - Use At Fault for the display name.
6 Click Next.

Creating the Action Cell Group


You will now create the action node group which represents the then part of a rule. While a
Single-axis (Columns) decision table can have more than one action cell group, there is only
one used in this tutorial. The action expression for each rule will set the ValueTier string
property of the DecisionInfo class.

To create the Value Tier action cell group


1 In the Available Actions panel, expand Local, expand thePolicy and then expand
DecisionInfo.
2 Select ValueTier.
3 Click the arrow to add it to the Action Cell Group panel.
4 Change the display name to: Value Tier and press Enter.
5 Click Edit to open the Cell Group Properties dialog.
You will see that this expression is selected by default:
ValueTier = ‘string’
thePolicy.DecisionInfo.ValueTier = {string}
6 Clear the check box next to the Not Applicable expression because it will not will be
used for any of the action cells. Click OK.
7 Click Finish to close the wizard.

Fair Isaac Corporation Confidential and Proprietary Information 92


Chapter 4: Decision Table Tutorial

Editing the Decision Table Template


In this section, you will make edits to the Decision Table Template. Editing the template
allows you to make further customizations or to change settings that you selected in the
wizard.
Customizations
First you will enable rule tracing so that the rules will have a customized prefix. Each rule will
be named Tier_Placement_n. You will be able to see the rule names in the underlying
decision table ruleset in the Blaze Advisor IDE.
Next, you will add Structured Rule Language (SRL) to the pattern so it can obtain data from
the AccidentInfo array at runtime. The array contains details about any accidents an
applicant has had in the last three years.
Changing Settings
The values in the fields in the Condition and Action Bindings sections are usually set in the
Decision Table Wizard. You will change the Depth field in one of the condition bindings. The
Depth field controls how deep the properties are displayed in the Property Picker in the
Decision Table Editor. The default value is 2, but for this tutorial, you will change it to 3
because you need to be able to select a property at a deeper level. For example
binding.property1.property2.property3.
This figure shows the edits that you will make to the Decision Table Template:

Fair Isaac Corporation Confidential and Proprietary Information 93


Chapter 4: Decision Table Tutorial

To edit the Decision Table Template


1 Select the Enable rule tracing check box. This enables the other fields in this section.
2 (Optional) In the Rule Id prefix field, enter: Tier_Placement_. In this case each rule name
will be Tier_Placement_n. Blaze Advisor automatically increments any new rules used
with this prefix to n + 1.
3 Expand anyAccidents pattern, and enter the following SRL in the In collection field:
thePolicy.Customer.DrivingRecord.AccidentInfo
4 Expand the Binding that says <none>. This is the binding that will allow you to create
dynamic conditions in the Decision Table Editor.
5 In the Depth field select 3. This depth will enable you to select a property that is three
levels deep in the AutoPolicy class using the thePolicy parameter.
6 Save the changes.

Modifying an Expression Template


In this section you will modify the SRL content of an expression template. While the Decision
Table Template is stored in the project, the condition and action expression templates are
stored in the system repository. The expression templates are Code Templates and these
templates are referenced by the Decision Table Template.
It is recommended that you do not change the Code Templates in the system repository
because changes to those templates affect all instances of those templates in the same
repository. In this case, you will copy one of the Code Templates into the Decision Table
Template and make the changes. This way the Code Template will be local to the Decision
Table Template and the changes will not affect the original one in the system repository.
The reason you will modify one of the expression templates is that some of the decision
table condition expressions operate on a pattern. If the pattern is not used in the
corresponding action expression, a warning message appears in the console for each rule
where a pattern is used in the condition but not in the action. To eliminate the warning
messages, you can do one of the following:
 Modify the action expression template to use the ignore() built-in function.
 Clear the Warn about unused patterns in rule actions check box in the Compilation
Warnings panel in the Properties window. See .
You will modify the action expression template to use the ignore() built-in function. This is
easy way to learn how to modify an expression template. The ignore() built-in function
ensures that the evaluation of a rule is not terminated after the rule is fired for the first object
that matches the pattern.

To modify an expression template


1 In the Tier Placement Decision Table Template, expand Binding in the Action Cell
Group.
2 Expand Cell Formats.
3 Select Assignment, which is a reference to the Assignment Code Template in the
system repository.
4 Click the Copy to Local icon on the Decision Table Template Editor toolbar.

Fair Isaac Corporation Confidential and Proprietary Information 94


Chapter 4: Decision Table Tutorial

5 The reference changes to Value_Tier1_Assignment. Scroll down to the Templates


section and you will see that the template has now been included in the Decision Table
Template.
6 Double-click on the template to open it.
7 In the SRL Content field, place your cursor in front of the first line and enter a carriage
return. There should be a blank line and the next line should have the Value Holders.
8 On the new line add this SRL:
ignore(anyAccidents).
This is how the SRL content should appear:

9 Save the changes.


10 Close the Value_Tier1_Assignment template.

To copy and modify an expression template


1 In the Templates section of the Decision Table Template, select the Value_Tier1_As-
signment template, right-click and select Copy.
2 Right-click in the same location and select Paste. The copied template appears below
the original one.
3 Open the template you just copied and pasted.
4 In the Code Template field, backspace through the 1 and append _No_Ignore() to the
text so the name should be Value_Tier1_Assignment_No_Ignore().
5 In the Template Display Name fields, append _No_Ignore() to the text.
6 In the SRL Content section, remove the line: ignore(anyAccidents).
7 Save the change and close the template.
8 In the Cell Formats section, click in the reference to <Select Template...> and
select Value_Tier1_Assignment_No_Ignore().

Because this expression will only be used for two rules, it will not be the default. The
default will be the first expression, Value_Tier1_Assignment, which contains the SRL
that includes the ignore() built-in function.
9 Save the changes.

Fair Isaac Corporation Confidential and Proprietary Information 95


Chapter 4: Decision Table Tutorial

Writing the Rules Using the Decision Table


Editor
Next, you will generate the instance file that will store the decision table values. In the
instance file, you will create the structure of the decision table. For expediency, you will
import the decision table values rather than enter them in the table cells.
This section will cover these topics:
 “Generating the Instance File”
 “Creating the Structure of the Decision Table”
 “Importing Decision Table Values” on page 97

Generating the Instance File


An instance (also known as an instance file) is a separate project item that you create from a
global template. In this case, the global template is a Decision Table Template. This template
contains references to Code Templates that contain one or more Value Holders. It’s the
instance file that is edited in the Decision Table Editor. The values edited in the editor are
saved to the instance file. The editing interface used to edit an instance depends upon the
type of template used to generate it. In this case, the editing interface will be the Decision
Table Editor.

To generate an instance file


1 Select the Tier Placement Decision Table Template in the Project Explorer.
2 Click the New Item icon on the Blaze Advisor Entities toolbar and select Instance
from the drop-down menu.
3 In the Instance window, locate the Decision Table Tutorial folder and expand the folder
until you see the Tier Placement Decision Table Template. Select the template.
4 Click OK.

Creating the Structure of the Decision Table


In the Decision Table Editor, you will see that the action column and some condition columns
are present. These are the static columns. In this section, you will add two conditions
dynamically. For more information about static and dynamic cell groups, see “Overview of
Condition Cell Groups” in DevelopingRuleProjects.pdf.

To create the structure of the decision table


1 Place your cursor in the margin above Accident Type and select Insert Dynamic Condi-
tion Column to the Left.
2 Expand All Entities, thePolicy, the DecisionInfo class and select RiskScore.
3 In the Display Name field, insert a space between the words Risk and Score and click
OK.
4 Place your cursor in the margin above Risk Score and select Insert Dynamic Condition
Column to the Right.

Fair Isaac Corporation Confidential and Proprietary Information 96


Chapter 4: Decision Table Tutorial

5 Expand All Entities, expand thePolicy parameter and select this property:
Customer.DrivingRecord.AnyAccidentsinLast3Years.
6 In the Display Name field, shorten the name to the following:
Any Accidents in 3 Years
7 Click OK.
The decision table structure should look like this:

Importing Decision Table Values


You can import decision table values in a comma separated values (.csv) file into the
decision table. This tutorial includes a .csv file that you import into the decision table. When
data is imported, the default action expression is used. This is the action expression that
uses the ignore() built-in function. You will change two of the action expressions to use the
other action expression that does not contain the ignore() built-in function because those
rules will be based on the AutoPolicy parameter instead of the anyAccidents pattern.

To import the decision table data


1 Click the Import Decision Table icon .
2 Click the ellipsis to locate this file:
<ADVISOR_HOME>\tutorials\importDataForDecisionTableTutorial\Tier_Pla
cement_Decision_Table_Template_Instance.csv
3 Click Open.
4 Retain Replace Data so that the default row is replaced by the first row in the .csv file.
5 Click Finish.
6 Click OK.
7 Right-click in the first cell in the Value Tier column and select Format Cell >
ValueTier_Assignment_No_ignore(). Enter Two in the cell.
8 Look for the first rule where the Risk Score value is >= 750. In the action cell for that rule,
repeat Step 7. Enter One in the Value Tier action cell.
9 Save the changes.

Testing the Decision Table


The main() function in the Decision Table Tutorial Folder is provided for you. It is used as
the entry point to send data from the test file to the decision table for evaluation.
The SRL syntax in the body of the main() function shows the location of the test data and
invokes the decision table to process the data. There are five test files provided for you. You

Fair Isaac Corporation Confidential and Proprietary Information 97


Chapter 4: Decision Table Tutorial

can only run one test file at a time. To run a different test file, simply comment out the active
line in the main() function and remove the comments from another line.
A local variable called thePolicy of AutoPolicy type references the test data. The apply
keyword is used to invoke the decision table you created and uses thePolicy as the
argument. When the evaluation is completed, a value tier is displayed in the Console view.

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 You need to create a run configuration before running the project. Select Run > Run
Configurations... to open the Run Configurations dialog.
3 Select Blaze Advisor Project in the leftmost list of launch configuration types, and click
the New launch configuration icon on the toolbar.
4 Enter Decision Table Tutorial Run Configuration in the Name field.
5 If the Decision Table Tutorial Project does not appear in the Project to Run field, perform
the following steps to complete the run configuration for this project:
a Click Select Project to open the Select a Project dialog.
b Select Decision Table Tutorial Project [Features Tutorial Repository] and click OK.
c Click Apply to save your edits.
6 Click Run.
Compare your results in the Console view to the Output Results column in the table in the
next section.

Tip: For subsequent runs, you can do any of the following: click the Run icon on the
Launch toolbar, select Run > Run, or right-click the project in the Project Explorer and
select Run As > 1 Blaze Advisor Project. The Decision Table Tutorial Run Configuration
is automatically run with the Run As command because there is a matching
configuration for the currently selected project. If you receive a message stating there
are no recent launches, then select Run > Run History > (number) Decision Table
Tutorial Run Configuration, where (number) represents the numeral associated with one
of the previous configuration runs.
7 Place a comment (double forward slashes—//) in front of the first line in the main()
function and remove the comments from the next line that references an XML data file,
such as DTable_HighValAccidents.xml.

Note: The first line in each test case begins with thePolicy is some AutoPolicy
initially and may wrap to the next line or two, depending on the width of your
Function Editor. If the test case wraps, you only need to add and remove comments from
the first line of the test case.
8 Run the project to observe and compare the new output results.
9 Repeat the previous two steps until you have run all the test cases.

Caution: The test files are located in <ADVISOR_HOME>\tutorials\testData. If you edit


these files, you may not get the expected results

Fair Isaac Corporation Confidential and Proprietary Information 98


Chapter 4: Decision Table Tutorial

Examining the Results


When you run the test data, you can verify that results are correct by comparing what you see
in the Console view with the following table:

Test File Name Output Results


DTable_HighValNoAccidents.xml Value Tier is One.
DTable_HighValAccidents.xml Value Tier is Two.
DTable_HighValFatality.xml Value Tier is Six.
DTable_YngDriverNoAccidents.xml Value Tier is One.
DTable_LowValMvgViol.xml Value Tier is Two.

Note: Customers with different Risk Scores may be assigned similar Value Tiers depending
on the number and the types of their accidents.

Examining the Generated Rules


1 In the Decision Table Tutorial project, locate the Tier Placement Decision Table
instance in the Project Explorer.
2 Expand the node under the instance file.
3 Expand the ruleset node and open a rule.Notice that each rule uses the prefix:
Tier_Placement_n

Reusing the Decision Table Template and Instance


Blaze Advisor templates are designed to be reused. You can generate multiple instance files
using the same template, and edit each one for a different purpose or audience. In the
Completed Tutorial, a version of the instance file was used for unit testing similar to the role
you performed in this tutorial:
<ADVISOR_HOME>\tutorials\featureTutorialsRepository\Auto Policy
Rules\Testing\Unit Testing\Tier Placement Decision Table Template
Development Folder
The instance file was then copied and pasted into the Business Library where it can be
accessed via an RMA generated using the AutoPolicy project. This instance is under
<ADVISOR_HOME>\tutorials\featureTutorialsRepository\Auto Policy
Rules\Business Library\Tier Placement Decision Table

See Also: For more information, see the “RMA Tutorial” on page 134.

Summary
In this tutorial, you created a decision table that replicates the one in the completed tutorial.
To see how the decision table works in relationship to the other entities in the completed
tutorial, import this project:
/Auto Policy Rules/Testing/Rule Service Testing/Policy Underwriting.

Fair Isaac Corporation Confidential and Proprietary Information 99


Chapter 4: Decision Table Tutorial

You see the Policy Underwriting Ruleflow, which controls the execution of the rules. You see
that the Tier Placement task appears after the decision block. The results of the Tier
Placement task are sent to the next task for further evaluation.
In this tutorial, you performed these tasks:
 Used the Decision Table Wizard to create a Decision Table Template
 Modified the Decision Table Template
 Generated an instance of the template
 Imported data into the condition and action cells in a Decision Table Template Instance
(also known as a decision table)
 Built and ran the project using test data.
 Viewed the generated output.
In this tutorial, the decision table is invoked by the main() function for testing purposes. In
the completed tutorial, the decision table is invoked from a ruleflow. You can also invoke a
decision table from a function, ruleset, or another decision table.

See Also: For more information about decision tables, see “Decision Tables” in
DevelopingRuleProjects.pdf.

Fair Isaac Corporation Confidential and Proprietary Information 100


CHAPTER 5
Score Model Tutorial

This FICO® Blaze Advisor® decision rules management system feature tutorial shows you
how to generate a score model using the Score Model Wizard and how to write rules using
the Score Model Instance Editor. You will also learn how to test the score model using test
data and how to print the generated score and score reasons.
A score model is a graphical representation of a mathematical formula used to predict the
likelihood of future behavior about a business customer or prospect, based on facts known
about them in the present. In this tutorial, the score model generates a score based on the
age of the applicants, the length of time they have held a license, and the number of
accidents and moving violations they have had in the past three years. In the completed
version of the project, the score evaluates the applicant data before it is passed on to the
next task in the ruleflow, which is the decision table. See the “Decision Table Tutorial” on
page 88 and the “Ruleflow Tutorial” on page 141.
The following figure shows a partial view of the score model you will create in this tutorial:

Fair Isaac Corporation Confidential and Proprietary Information 101


Chapter 5: Score Model Tutorial

You can see that various data points (called Characteristics) are considered in the score
model. In this tutorial, Age, Years Licensed, Num of Accidents, and Num of Moving Violations
are the characteristics. These characteristics are based on properties in the AutoPolicy
object model, which is a series of XML classes.
Each characteristic is divided into bins, which represent the possible values of the
characteristic. For example, Age is divided into Young Adult, Adult, and Senior age ranges.
These bins are rule conditions that must be mutually exclusive and collectively exhaustive,
so that the value for each characteristic can only fall into one bin. Blaze Advisor provides the
All Other bin for each characteristic to ensure all possible values are covered.
When you enter data into the score model, Blaze Advisor generates rules. Incoming data is
tested against the rule conditions (bins) and a partial score is assigned to each
characteristic. The score model returns a score that is simply the sum of the partial scores.
At runtime, the rules in the bins resolve to a ruleset representing the score model.
Prerequisites for this tutorial: You should have a basic understanding of how to use the
Blaze Advisor IDE. If you are new to Blaze Advisor, complete the “Introductory Tutorial” on
page 13 or review the Blaze Advisor documentation.
Time estimate: 60 minutes

Fair Isaac Corporation Confidential and Proprietary Information 102


Chapter 5: Score Model Tutorial

Role of the score model in the AutoPolicy scenario: In a real-world situation, a score model
will be just one component of a rule service. While you are completing this tutorial, assume
that you are part of a project team assigned to create the score model that will evaluate
applicant data and assign a risk score.
The score model will be created in a separate folder and tested. After the score model is
completed, it becomes integrated into the project. In this tutorial, you just create the score
model and then view how the score model is used in the completed project.
To view the completed version: In the IDE, you can view a completed version of the score
model at any time. The completed version is located in the Risk Score Template
Development project under this directory: Auto Policy Rules\Testing\Unit
Testing\Risk Score Template Development Folder. See “Opening the Score Model
Project and Including the XML BOM and Utilities Folders” on page 103.
Open the project file and you will see the AutoPolicy Object Model,
Risk_Scores_Reason_Codes reason code list, Risk Score Model Template, an instance of the
Score Model Template, and a main function. The template instance is the actual score model
that contains the rule values.

Opening the Score Model Project and Including


the XML BOM and Utilities Folders
To begin this module, you must open the Blaze Advisor perspective. See “Opening the
Blaze Advisor Perspective” on page 13. Once you have connected to the Feature Tutorials
repository, you need to open the project where you will complete the tutorial steps.
You will include the folder containing the AutoPolicy object model that will be used to write
the rules, and the Utilities folder containing the NdProductInfo class used to obtain the
Blaze Advisor installation directory. When you include a folder, the contents become part of
the project.

To open the project and include the AutoPolicy BOM and Utilities
folders
1 Select File > Import, expand the Blaze Advisor folder, select Rule Project, and click Next.
2 In the Select Repository wizard page, select Feature Tutorials Repository and click Next.
3 In the Select a Blaze Advisor Project wizard page, expand the Score Model Tutorial
folder, select the Score Model Tutorial Project, and click Finish to open the project.
4 In the Project Explorer, right-click the Score Model Tutorial Project [Feature
Tutorials Repository] project and select Open Project Editor.
5 Use one of these options to invoke the Include Folder or Project dialog box.
 Click the Include Folder or Project icon in the Project Editor.
 Select Project > Include Folder or Project....
6 Expand Auto Policy Rules\Technical Library\Business Object Models and
select the Auto Policy XML BOM folder. Click Include to include this item in the project.
7 Open the Include Folder or Project dialog box again and this time expand Auto Policy
Rules\Technical Library and select the Utilities folder. Click Include to include
this item in the project.

Fair Isaac Corporation Confidential and Proprietary Information 103


Chapter 5: Score Model Tutorial

8 If the File > Save command or the Save icon is enabled, save your changes.

Tip: In the Blaze Advisor Perspective, project changes are automatically saved when you
make them from the Project Explorer. For example, including a folder from the Project
Editor requires you to save changes, but including a folder from the Project Explorer,
using the Project > Include Folder or Project... command, does not.

See Also: For more information, see “Saving Changes to Projects and Project Items” in
DevelopingRuleProjects.pdf.
9 Select File > Refresh to update the contents of the repository.
The AutoPolicy XML BOM and Utilities folders are now included in the Score Model
Tutorial Project. The full path to these folders appears in the Project Editor. In the Object
Model Explorer, you can expand the AutoPolicy XML BOM and Utilities folders to see the
classes contained in them.

Tip: If the folders do not display in the Object Model Explorer, build the project by
selecting Project > Build Project. The folders should now appear.

Editing a Reason Code List


You can add reason codes to a score model to track or report the factors that affected the
score. In Blaze Advisor, a reason code, rank, and message can be returned with the score. To
create a score model that returns reason codes, you must have a reason code list to hold
your reason codes and messages.
There are two methods of computing which reason codes are returned: by rank or by distance
calculations from a baseline score. In this tutorial, you will use the default method to compute
reason codes, which is by rank. Reason code ranks are defined in the Reason Code List
Editor. For more information on reason codes, see “Creating a Reason Code List” in
DevelopingRuleProjects.pdf.
To save time, a reason code list has already been created for you in the project using the New
Reason Code List icon . You will add some reason codes to become familiar with the
Reason Code List Editor.

To edit the reason code list


1 Expand the Risk Score Model Template folder.
2 Double-click on Risk_Score_Reason_Codes to open the Reason Code Editor.
3 Click the New Reason Code icon on the editor toolbar. An empty reason code is
added to the list.
4 In the Name field, enter:
No_violations
5 In the Code field, enter:
mv01
6 In the Message field, enter:
No moving violations in 3 years

Fair Isaac Corporation Confidential and Proprietary Information 104


Chapter 5: Score Model Tutorial

7 Repeat the previous steps to add two more reason codes using the following values:

Name Code Message


Some_violations mv02 1 or 2 moving violations in 3
years
Many_violations mv03 3 or 4 moving violations in 3
years

8 Use the Move Up and Move Down arrows on the Reason Code List Editor to move the
three new reason codes above Unexpected. The codes should follow this sequence:
No_violations, Some_violations, Many_violations.
9 Save your changes and close the editor.

Using the Score Model Wizard to Create the


Score Model
A score model is generated using the Score Model Wizard. You will use the first page of the
Score Model Wizard to name the score model and create three parameters. A parameter is a
graphical way of declaring the types and names of any argument values or objects to be
passed to a ruleset. In this case, the parameters will be passed to a score model ruleset.
The result of the score model processing is stored in an instance of
NdScoreModelReturnInfo, which is a built-in support class. This class contains the score,
any reason codes, the characteristic count, and other data about the calculations performed
by the score model for each transaction. Later in this tutorial, you will see how to access the
stored information in the NdScoreModelReturnInfo class.

To select the score model features


1 Select the Risk Score Model Template folder.
2 Click the New Item icon on the Blaze Advisor Entities toolbar and select Template
from the drop-down menu.
3 In the New Template window, select Score Model, and enter this text in the Name field:
Risk Score Model Template
4 Click OK. This opens the Score Model Wizard that you will use to create the structure for
the template.
5 In Return type, retain NdScoreModelReturnInfo.
6 Click the New Parameter icon three times to add three parameters.
7 In the first parameter, replace parameter1 with this name:
thePolicy
8 In the Type field, select AutoPolicy.
9 In the parameter underneath thePolicy, replace parameter2 with this name:
accidents
10 In the Type field, select integer.

Fair Isaac Corporation Confidential and Proprietary Information 105


Chapter 5: Score Model Tutorial

11 In the parameter underneath accidents, replace parameter3 with this name:


violations
12 In Type field, select integer.
13 Click Next.

Creating Characteristics
In this section, you will create four characteristics for your score model (Age, Year Licensed,
Num of Accidents, and Num of Moving Violations).
Each characteristic can contain more than one version of the expression used to evaluate the
class property. For example, every rule coming from the Age characteristic represents one
condition expression. However, the actual construction of the condition expression may vary.
In this tutorial, you will use two variations of Age expressions:
 thePolicy.Customer.PersInfo.Age > {integer1} and
thePolicy.Customer.PersInfo.Age <= {integer2}
 thePolicy.Customer.PersInfo.Age > {integer}

To create the Age characteristic


1 Expand thePolicy.
2 Locate this path:
thePolicy\Customer\PersInfo\Age
3 Select Age and click the arrow to add it to the Characteristics panel.
4 Select the Age label and click the Edit button to open the Characteristic Properties
dialog box.
5 Clear all of the check boxes in the Selected column except these two:
 Age > ‘integer’
thePolicy.Customer.PersInfo.Age > {integer}
which translates to this in SRL:
thePolicy.Customer.PersInfo.Age > {integer}
 Age ‘integer1’ < .. <= ‘integer2’
which translates to this in SRL:
thePolicy.Customer.PersInfo.Age > {integer1} and
thePolicy.Customer.PersInfo.Age <= {integer2}

Tip: You can widen the Expression column to read the contents more easily.

Fair Isaac Corporation Confidential and Proprietary Information 106


Chapter 5: Score Model Tutorial

6 Click OK to close the dialog box.

To create the Years Licensed characteristic


1 Expand thePolicy.
2 Locate this path:
thePolicy\Customer\DrivingRecord\NumYearsLicensed
3 Select NumYearsLicensed and click the arrow to add it to the Characteristics panel.
4 Double-click this new entry in the Label column.
a Change NumYearsLicensed to:
Years Licensed
b Press Enter.
The name you are entering is for display purposes only. The underlying rules will use the
class property name of NumYearsLicensed and not the display name of Years
Licensed.
5 Select the Years Licensed label and click Edit to open the Characteristic Properties
dialog box.
6 Clear all of the check boxes in the Selected column except these two:
 Years Licensed < ‘integer’
 Years Licensed >= ‘integer’
7 Click OK.
The two integer parameters, accidents and violations, will be used to write rules
against the number of accidents or moving violations an applicant may have incurred
during the last three years. Once the score model is finished, the value for the
accidents parameter will be assigned to the count property of the
AutoPolicy.Customer.DrivingRecord.AccidentInfo array, and the violations
parameter will be assigned to the count property of the
AutoPolicy.Customer.DrivingRecord.MovingViolations array. Every array has a
built-in count property, which is a read-only integer that indicates the number of
elements in the array. While you cannot see this property in the Blaze Advisor IDE, you
can set the count property by mapping values.

Fair Isaac Corporation Confidential and Proprietary Information 107


Chapter 5: Score Model Tutorial

To create the Num of Accidents characteristic


1 Collapse the AutoPolicy parameter, so you can see the other parameters in the Available
Characteristics panel.
2 Select the accidents parameter and click the arrow to add it to the Characteristics
panel.
3 Double-click this new entry in the Label column.
a Change accidents to:
Num of Accidents
b Press Enter.
4 Select the Num of accidents label and click Edit to open the Characteristic Properties
dialog box.
5 Clear all of the check boxes in the Selected column except these two:
 Num of accidents = ‘integer’
 Num of accidents ‘integer1’ <= .. <= ‘integer2’
6 In the Expression column, select Num of accidents ‘integer1’ <= .. <= ‘integer2’ and
move it above Num of accidents = ‘integer’ using the Up arrow.
You are doing this so that this expression will be the default expression in the Num of
Accidents bin in the Score Model Instance Editor.
7 Click OK.

To create the Num of Violations characteristic


1 Select the violations parameter and click the arrow to add it to the Characteristics panel.
2 Double-click this new entry in the Label column.
a Change violations to:
Num of Moving Violations
b Press Enter.
3 Select the Num of violations label and click Edit to open the Characteristic Properties
dialog. box
4 Clear all of the check boxes in the Selected column except these two:
 Num of violations = ‘integer’
 Num of violations ‘integer1’ <= .. <= ‘integer2’
5 In the Expression column, select Num of accidents ‘integer1’ <= .. <= ‘integer2’ and
move it above Num of accidents = ‘integer’’ using the Up arrow:
6 Click OK.
7 Click Next.

Setting Reason Codes


In this page, you will set your model to use the score reasons, select a reason code list, and a
method of returning reason codes.

Fair Isaac Corporation Confidential and Proprietary Information 108


Chapter 5: Score Model Tutorial

By selecting a reason code list, you are asking Blaze Advisor to return reason codes along
with the score. Returning reason codes is a useful way to track or report reasons that most
affect a score either positively or negatively. Reason codes are returned based on either their
order (rank) in the reason code list or by computing distances from a baseline or maximum
score. For this tutorial, you will use the default behavior that is to return score reasons based
on their rank.

To set reason codes


1 Select the Return score reasons check box.
2 Select Risk_Score_Reason_Codes from the Reason Code List drop-down list.
3 Retain 4 in Maximum number to return field.
4 Select Use score reason ranks as the method to compute reason codes. Blaze Advisor
will select the reasons for the characteristics that were used in scoring in the order they
appear in the reason code list.
5 Click Finish to complete the score model.
After you click Finish, the Risk Score Model Template appears in the Editor pane.

Writing Rules in the Score Model


An instance of a Score Model Template is edited in the Score Model Instance Editor in the
Blaze Advisor IDE or in a web-based, rule maintenance application. Whether you edit the
score model in the Blaze Advisor IDE or a rule maintenance application, the values are saved
to an instance file.
In this next section, you will generate an instance file and write rules in the Score Model
Instance Editor in the Blaze Advisor IDE.
This section will cover these topics:
 “Generating the Instance File”
 “Creating Bins for the Characteristics”

Generating the Instance File


An instance (also known as an instance file) is a separate project item that you create from a
global template. In this case, the global template is a Score Model Template. This template
contains references to Code Templates that contain one or more Value Holders. It’s the
instance file that is edited in an RMA. The values edited in the RMA are saved to the instance
file. The editing interface of an instance depends upon the template used to generate it. In
this case, the editing interface will be the Score Model Instance Editor.

To generate an instance file


1 Select the Risk Score Model Template in the Project Explorer.
2 Click the New Item icon on the Blaze Advisor Entities toolbar and select Instance
from the drop-down menu.
3 In the Instance window, select the Risk Score Model Template.

Fair Isaac Corporation Confidential and Proprietary Information 109


Chapter 5: Score Model Tutorial

4 Enter this text in the Name field:


Risk Score Model
5 Click OK.

Creating Bins for the Characteristics


Next, you will create the bins that represent the possible ranges of a value of a characteristic.
These bins will result in conditions that test into which range the value for each
characteristic falls.
The values of a characteristic must provide mutually exclusive, collectively exhaustive
coverage of all possible values. As you enter values in the Score Model Instance Editor,
Blaze Advisor checks the bin ranges for overlapping values and validates data in the model,
reducing errors at runtime. It also automatically provides the All Other bin for each
characteristic as a catch-all for all non-explicitly specified bin ranges and values.
Blaze Advisor also provides the Unexpected check box so that you can track values that are
unlikely to occur, such as those falling into the All Other bin. An example of an unexpected
value is a blank or unavailable data item, or one outside the specified ranges. Tracking their
occurrence over time may help identify an invalid score or the need to redevelop the score
model if unexpected values occur frequently.
In this section, you will also set the score (also called score weight) in each bin and add an
optional characteristic to the model.
For each characteristic, a partial score is calculated based on the value of the characteristic.
The score weight value or expression associated with a bin is assigned to the partial score,
and then the partial scores are added together to determine the final score.
In this tutorial, you are not entering a baseline score for each characteristic because reason
codes are being computed by rank. Baseline scores are only used when you set the score
model to calculate score reason distances as part of the score reason calculation method.

To create the bins for the Age characteristic


1 In the Score Model Instance Editor, expand the Age characteristic.
2 Click the Add Bin button at the top of the editor.

Tip: If the Add Bin button is not enabled, click on the first cell in a bin row.
3 Click in the Bins column and enter:
Young adult
This will be the name of the first bin in the characteristic.
4 Click in the Range column to enable the Select a format icon .
5 Click the Select a format icon and select Age ‘integer1’ < .. <= ‘integer2’.
6 Enter the following numbers in the Range column:
a Click the first field and change it to 16
b Click in the second field and change it to 24

Note: The data validation checking may temporarily change the font color to red.

Fair Isaac Corporation Confidential and Proprietary Information 110


Chapter 5: Score Model Tutorial

7 (Optional) In the Description field, enter descriptive text such as Young driver. Any text
in the Description field is only visible in the Score Model Instance Editor and cannot be
printed like the reason messages.
8 Retain Young in the Reason Code column. The associated message is filled in
automatically.
9 Click in the Score column and enter 125 for the score weight.
10 Complete the other two bins for the Age characteristic and enter the following values:

Bin Range Score Reason Code


Adult 24 <..<= 70 250 Adult
Senior > 70 125 Senior

You do not need to add text into the Description field for each bin. It is an optional task in
this tutorial.
11 Verify that the Unexpected check box is selected in the All Other bin. This indicates that
no values are expected to fall into that category.
12 Select Unexpected as the Reason Code for the All Other bin. Notice that Unexpected
data automatically displays in the Reason Message column.

To create the bins for the Years Licensed characteristic


1 Add the values for these bins in the Years Licensed characteristic:

Bin Range Score Reason Code


New driver <5 125 New_driver
Experienced driver >= 5 250 Experienced_driver

2 Verify that the Unexpected check box in the All Other bin is checked.
3 Select Unexpected as the Reason Code for All Other.

To create the bins for the Num of Accidents characteristic


1 Add the values for these bins in the Num of Accidents characteristic:

Bin Range Score Reason Code


0 accidents 0 250 No_accidents
1 to 2 accidents 1<=..<= 2 125 Few_accidents
3 to 4 accidents 3<=..<= 4 -125 More_accidents
5 to 6 accidents 5<=..<= 6 -250 Many_accidents

2 Verify that the Unexpected check box in the All Other bin is checked.
3 Select Unexpected as the Reason Code for All Other.

Fair Isaac Corporation Confidential and Proprietary Information 111


Chapter 5: Score Model Tutorial

To create the bins for the Num of Moving Violations


characteristic
1 Add the values for these bins in the Num of Moving Violations characteristic:

Bin Range Score Reason Code


0 violations 0 250 No_violations
1 to 2 violations 1<=..<= 2 -125 Some_violations
3 to 4 violations 3<=..<= 4 -250 Many_violations

2 Verify that the Unexpected check box in the All Other bin is checked.
3 Select Unexpected as the Reason Code for All Other.
4 Save the changes to the Score Model Instance Editor.

Testing the Score Model


For testing purposes, the main() function is used as the entry point to send data from a test
file to the score model for evaluation.
In the body of the main() function, you see that the first several lines reference XML data
files stored under \tutorials\testData. You can run each file and see the generated
score and the score reasons. Five test files are provided, but only one file can be run at a
time.
After you build and run the project, comment the line containing the name of the file you just
ran, and remove the comment from another line containing a file reference. Then re-run the
project and see how the output has changed.
You can also open the source files under \tutorials\testData to see how they were
constructed.
Also, in the main() function, a local variable of type NdScoreModelReturnInfo is created
to hold the result of score processing. The SRL keyword apply is used to invoke the score
model. In the completed version of the tutorial, the score model is invoked from the ruleflow.
For this tutorial, a main() function is used to invoke the score model and test the values.
Finally, a variable of type NdReasonCode is created and used to print the score values.
NdReasonCode is a built-in support class. For more information about the support classes
used with score models, see “Support Class Reference” in Reference.pdf.

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 You need to create a run configuration before running the project. Select Run > Run
Configurations... to open the Run Configurations dialog box.
3 Select Blaze Advisor Project in the leftmost list of launch configuration types, and click
the New launch configuration icon on the toolbar.
4 Enter Score Model Tutorial Run Configuration in the Name field.

Fair Isaac Corporation Confidential and Proprietary Information 112


Chapter 5: Score Model Tutorial

5 If the Score Model Tutorial Project does not appear in the Project to Run field, perform
the following steps to complete the run configuration for this project:
a Click Select Project... to open the Blaze Advisor Project dialog box.
b Select Score Model Tutorial Project [Features Tutorial Repository] and click OK.
6 Click Apply to save your edits.
7 Click Run from the Run Configurations dialog box.
Compare your results in the Console view to the Output Results column in the table in the
next section.

Tip: For subsequent runs, you can click the Run icon on the Launch toolbar, select
Run > Run, or right-click the project in the Project Explorer and select Run As > 1 Blaze
Advisor Project. The Score Model Tutorial Run Configuration is automatically run with
the Run As command because there is a matching configuration for the currently
selected project. If you receive a message stating there are no recent launches, then
select Run > Run History > (number) Score Model Tutorial Run Configuration, where
(number) represents the numeral associated with one of the previous configuration runs.
8 Place a comment (double forward slashes—//) in front of the first line in the main()
function and remove the comments from the next line that references an XML data file,
such as SM_AdultAccidnt-NoMV.xml.

Note: The first line in each test case begins with thePolicy is some AutoPolicy
initially and may wrap to the next line or two, depending on the width of your
function editor. If the test case wraps, you only need to add and remove comments from
the first line of the test case.
9 Run the project to observe the new output results.
10 Repeat the previous two steps until you have run all the test cases.

Caution: The test files are located in <ADVISOR_HOME>\tutorials\testData. If you


choose to edit these files, you may not get the results you expect.

Examining the Results


As noted in the last section, the output changes depending upon the test file that is being
used. This table shows the results you can expect to see in the Console view.

Fair Isaac Corporation Confidential and Proprietary Information 113


Chapter 5: Score Model Tutorial

Test File Name Output Results


SM_AdultAccidnt-MV.xml This is the applicant's score: 250.0
Rank is 2 Code is [ age02 ] Message is 24 to 70 years old
Rank is 5 Code is [ lic02 ] Message is Licensed for 5 years
or more
Rank is 8 Code is [ acc03 ] Message is 3 or 4 accidents in 3
years
Rank is 11 Code is [ mv02 ] Message is 1 or 2 moving
violations in 3 years
SM_AdultAccidnt-NoMV.xml This is the applicant's score: 875.0
Rank is 2 Code is [ age02 ] Message is 24 to 70 years old
Rank is 5 Code is [ lic02 ] Message is Licensed for 5 years
or more
Rank is 7 Code is [ acc02 ] Message is 1 or 2 accidents in 3
years
Rank is 10 Code is [ mv01 ] Message is No moving
violations in 3 years
SM_SeniorNoAccidntsOrMV.xml This is the applicant's score: 875.0
Rank is 3 Code is [ age03 ] Message is Over 70 years old
Rank is 5 Code is [ lic02 ] Message is Licensed for 5 years
or more
Rank is 6 Code is [ acc01 ] Message is No accidents in 3
years
Rank is 10 Code is [ mv01 ] Message is No moving
violations in 3 years
SM_YoungAccidnts-NoMV.xml This is the applicant's score: 375.0
Rank is 1 Code is [ age01 ] Message is 16 to 24 years old
Rank is 4 Code is [ lic01 ] Message is Licensed less than 5
years
Rank is 8 Code is [ acc03 ] Message is 3 or 4 accidents in 3
years
Rank is 10 Code is [ mv01 ] Message is No moving
violations in 3 years
SM_YoungNoAccidnts-MVxml This is the applicant's score: 250.0
Rank is 1 Code is [ age01 ] Message is 16 to 24 years old
Rank is 4 Code is [ lic01 ] Message is Licensed less than 5
years
Rank is 6 Code is [ acc01 ] Message is No accidents in 3
years
Rank is 12 Code is [ mv03 ] Message is 3 or 4 moving
violations in 3 years

Notice that an applicant can receive the same total score even when their ranks and reason
codes for each characteristic differ.

Fair Isaac Corporation Confidential and Proprietary Information 114


Chapter 5: Score Model Tutorial

Viewing the Rules


You can view the score model rules using the Score Model Ruleset Editor or in the SRL Code
window. The score model rules are read-only because the SRL used in the rules is contained
in the condition templates that were generated when you created the score model using the
Score Model Wizard.

To view the rules in the Score Model Ruleset Editor


1 In the Project Explorer, expand the Risk Score Model Template Instance. Note that you
see a ruleset icon next to Risk Score Model Template Instance.

2 Double-click the Risk Score Model Template Instance ruleset to open the rules created
for the model, including initial characteristic values, return information, and the rules for
each bin.
3 In the Contents section, expand a rule to view the SRL.
You will see that by entering values in the score model you have created several new
rules.

To view the rules in the SRL Code view


1 Select Window > View > Preview SRL Code.
2 Scroll down until you see this line: ruleset Risk_Score_Model_Template_Instance
You can change the score model rules by modifying the values in the Score Model
Instance Editor.

See Also: For more information about modifying the code templates, see “Modifying Score
Model Attributes” in DevelopingRuleProjects.pdf.

Reusing the Score Model Template and


Instance
Blaze Advisor templates are designed to be reused. You can generate multiple instance files
using the same template, and edit each one for a different purpose or audience. In the
Completed Tutorial, a version of the instance file was used for unit testing similar to the role
you performed in this tutorial:
<ADVISOR_HOME>\tutorials\featureTutorialsRepository\Auto Policy
Rules\Testing\Unit Testing\Risk Score Template Development Folder
The instance file was then copied and pasted into the Business Library where it can be
accessed via an RMA generated using the AutoPolicy project. See the “RMA Tutorial” on
page 134. This instance is under
<ADVISOR_HOME>\tutorials\featureTutorialsRepository\Auto Policy
Rules\Business Library\Risk Score Model.

Fair Isaac Corporation Confidential and Proprietary Information 115


Chapter 5: Score Model Tutorial

Summary
In this tutorial, you created a score model that replicates the one in the completed tutorial. To
see how the score model works in relationship to the other entities in the completed tutorial,
use the Repository Explorer to open the Policy Underwriting project under this directory:
Auto Policy Rules\Testing\Rule Service Testing\Policy Underwriting Folder.
In the Project Explorer, expand the Policy Underwriting Ruleflow folder, and double-
click on Policy Underwriting Ruleflow. This ruleflow is the execution flow for the part of
the project where the score model values are used. You see that the score model is the first
task in the ruleflow. The score is then passed to the next ruleflow task, the SetScore
function.

See Also: For more information about:


 Score models, see “Score Models” in DevelopingRuleProjects.pdf in the online Help
system.
 Other examples of score models, connect to the Examples Repository and locate the
Metaphors and Templates\Score Models folder.

Fair Isaac Corporation Confidential and Proprietary Information 116


CHAPTER 6

Templates Tutorial

This FICO® Blaze Advisor® decision rules management system tutorial shows you how to
convert a ruleset, which is a fixed SRL entity, to a Ruleset Template with editable rule values.
The rule values can be edited in the Instance Editor in the Blaze Advisor IDE or in a rule
maintenance application (RMA).
You will learn how to do the following:
 Convert the ruleset to a Ruleset Template in the Blaze Advisor IDE.
 Create a Rule Template that can be used to create multiple versions of the same rule.
 Replace SRL with editable rule values and specify how the values will be displayed.
 Generate an instance file to store the values.
 Edit the rule values in the Instance Editor. For information on editing values in an RMA,
see the “RMA Tutorial” on page 134.
At the end of this tutorial, you will have created a template, and an instance that contains a
rule table to organize and edit the rules, as shown below:

Prerequisites for this tutorial: You should have a basic understanding of how to use the
Blaze Advisor IDE. If you are new to Blaze Advisor, complete the “Introductory Tutorial” on
page 13, the “Ruleset Tutorial” on page 76, or review the Blaze Advisor documentation.
Time estimate: 40 minutes
Role of the instance in the completed tutorial: In this tutorial, assume that you are part of a
project team that has been asked to make some of the rules in a particular ruleset editable in
the Instance Editor or in an RMA.
To view the completed tutorial: In the IDE, you can view a completed version of the project at
any time. The completed version is located in the Auto Policy RMA project under this
directory: Auto Policy Rules/Testing/Unit Testing/Pricing Rules Development
Folder. See “Opening the Templates Tutorial Project” on page 118.

Fair Isaac Corporation Confidential and Proprietary Information 117


Chapter 6: Templates Tutorial

Opening the Templates Tutorial Project


To begin this module, you must open the Blaze Advisor perspective. See “Opening the
Blaze Advisor Perspective” on page 13. Once you have connected to the Feature Tutorials
repository, you need to open the project where you will complete the tutorial steps.

To open the project


1 Select File > Import, expand the Blaze Advisor folder, select Rule Project, and click Next.
2 In the Select Repository wizard page, select Feature Tutorials Repository and click Next.
3 In the Select a Blaze Advisor Project wizard page, expand the Templates Tutorial folder,
select the Templates Tutorial Project, and click Finish to open the project.
All components necessary to complete the tutorial are already included in the project.

Converting the Ruleset to a Global Ruleset


Template
Currently, the Pricing Ruleset is a fixed SRL entity, which means that the rules can only be
edited in the Ruleset Editor in the Blaze Advisor IDE. For rule values to be editable in an RMA,
the rule values must be exposed in a template. In this section, you will convert the Pricing
Ruleset to a Ruleset Template. You will make some of the values editable in a subsequent
section of this tutorial.

To convert the ruleset to a Ruleset Template


1 Expand the Templates Tutorial folder and then expand the Pricing Ruleset to view its
content.
2 Highlight the Pricing Ruleset(AutoPolicy), and select File > New > Template Entities >
Derive Template.
The ruleset opens in a new Ruleset Template Editor.
3 In the Ruleset Template field, delete the default name and enter:
PricingRulesetTemplate. This creates a new Ruleset named
PricingRulesetTemplate.
4 In the Project Explorer, select PricingRuleset and delete it, using one of these options:
 Select Edit > Delete.
 Press the Delete key on your keyboard.
 Right-click and select Delete.
A message displays asking you to confirm the deletion.

Important: You must delete the original Pricing Ruleset so the project can build. When
you instantiated the Pricing Ruleset Template with the Derive Template command, this
new instance contained the same content as the original Pricing Ruleset. This resulted in
two Pricing Rulesets in the project and the duplication prevents the project from
compiling.
5 Save your changes.

Fair Isaac Corporation Confidential and Proprietary Information 118


Chapter 6: Templates Tutorial

Consolidating Similar Rules in a Rule Template


In the original PricingRuleset(AutoPolicy) ruleset, there were three very similar rules. After
you created the PricingRuleset Template, you can consolidate the setPremium_ rules by
creating a Rule Template:

Each rule contains SRL code specific to its function:


if thePolicy.Coverage.CoverageCd = CoverageTypeCode.Bodily_Injury
then premium = 50.00.

if thePolicy.Coverage.CoverageCd = CoverageTypeCode.Comprehensive
then premium = 75.00.

if thePolicy.Coverage.CoverageCd = CoverageTypeCode.Loss_of_Use
then premium = 100.00.

A Rule Template allows you to create multiple versions of the same rule with different rule
values. Because the construction of these rules is similar, you will create one rule with
editable values in a Rule Template.

To create a Rule Template


1 Open the PricingRulesetTemplate, if it is not already open.
2 Click the New Template icon in the Ruleset Template Editor toolbar.
3 In the New Template dialog box, verify that the Decision Elements tab is selected.

Fair Isaac Corporation Confidential and Proprietary Information 119


Chapter 6: Templates Tutorial

4 Select Rule, and click OK.


The new Rule Template appears under the Pricing Ruleset Template in the Project
Explorer and in the Templates section of the Ruleset Template Editor.

5 Double-click the Rule Template to open it in the Editor pane.

Note: You can open the Rule Template from the Project Explorer or from the
PricingRulesetTemplate Editor.
6 In the Rule Template field, delete the default name and enter:
setPremiumRuleTemplate
7 Under the SRL Editor section in the rule template, enter this SRL code in the Body field:
if thePolicy.Coverage.CoverageCd =
then premium = .
8 Save the changes and leave the template open.

Creating Editable Rule Values


In the next few sections, you will insert Value Holders and Placeholders into various
locations in the templates to create editable rule values. A Value Holder sets the data type for
a value and how many occurrences of that value are allowed.
A Value Holder must be referenced by a Placeholder to be used in the SRL. A Placeholder
reserves a place for the entered value in the rule SRL.
A Value Holder can refer to a template or to a Provider. A Provider sets additional constraints
for a value in a Value Holder. For example, a Value Holder referring to an Integer provider
might define upper and lower limits for an input value or display a list of integer values.
The Blaze Advisor installation includes built-in Providers that are available in the Value
Holder Editor, as well as other Providers that you can configure. For more information about
the types of providers, see “Provider Reference” in
DevelopingRuleMaintenanceApplications.pdf.
When you edit rule values in the Instance Editor in the Blaze Advisor IDE or in an RMA, you are
editing the Value Holders. The edited values are saved to an instance file, which is stored in
the repository.
You will create editable values for the following rule items:
 Rule Name

Fair Isaac Corporation Confidential and Proprietary Information 120


Chapter 6: Templates Tutorial

 Start Date of rule


 End Date of rule
 The value for the coverageType property in the rule condition
 The value for the premium property in the rule action

Creating an Editable Rule Name


First, you will create an editable rule name field by inserting a Placeholder and a Value Holder
referring to a built-in string-provider in the Rule field.
The rule name must be editable because each rule created in a ruleset must have a unique
name or the project will not build.

To create an editable rule name


1 In the Rule field, under SRL Editor, select the rule name and click the Insert Placeholder
icon in the toolbar.
2 In the Placeholder Wizard, verify that Create a new Value Holder is selected.
3 Enter ruleNameVHolder in the Name field.
4 Enter Rule Name in the Display Name field.
5 Verify that Select a built-in template or provider is selected in the drop-down list.
6 Select string-provider in the provider list, and click Next.
7 Retain Exactly 1 in the Value Holder Count drop-down list, and click Finish.
8 Save the changes.

The ruleNameVHolder allows one entry of type String because each rule can have one
name only.

Note: All Value Holders appear in the Value Holders and Arguments section at the top of
the Rule Template Editor.

Creating Editable Dates


Next, you will create editable start and end dates for the rule. To do this, you will insert a
Placeholder and a Value Holder referring to a built-in date-provider in the From and To
fields in the following Effective Dates and Times section:

Fair Isaac Corporation Confidential and Proprietary Information 121


Chapter 6: Templates Tutorial

To create editable dates


1 Under Effective Dates and Times, place your cursor in the From field, and type two single
quotes ".

Important: The Value Holders must be enclosed in single quotes or the project will not
build.
2 Place your cursor between the single quotes, and click the Insert Placeholder icon in
the Rule Template toolbar.
3 In the Placeholder Wizard, select Create a new Value Holder.
4 In the Name field, enter:
startDateVHolder
5 Enter Start Date in the Display Name field.
6 Verify that Select a built-in template or provider is selected in the drop-down list.
7 Select date-provider in the provider list, and click Next.
8 Retain Exactly 1 in the Value Holder Count drop-down list, and click Finish.
9 Repeat the previous steps for the To field, and name the second Value Holder
endDateVHolder, with a display name of End Date, as shown in the following figure:

Fair Isaac Corporation Confidential and Proprietary Information 122


Chapter 6: Templates Tutorial

10 Save the changes.


Each Value Holder allows exactly one date entry in the Start Date and End Date fields for
each new rule. These dates are known as effective dates, and they are used to manage
rules and to reflect policy changes over time.

Creating a List of Enumeration Items


When you created the previous Value Holders, you used built-in providers to constrain the
type of data entry in each. Now you will create a provider that displays a list of enumeration
values from the CoverageTypeCode enumeration in the Auto Policy BOM, as shown in the
following figure:

Fair Isaac Corporation Confidential and Proprietary Information 123


Chapter 6: Templates Tutorial

To create an Enumeration Items Provider


1 Select File > New > Template Entities > Provider.
2 In the New Provider dialog box, select the SRL tab.
3 Select Enumeration Items and click OK.
The new provider appears in the Project Explorer and opens in the Project Editor. It is a
global entity that can be referred to by any Value Holder in the project.
4 In the Provider field, rename the provider CoverageTypeProvider.
5 Select CoverageTypeCode in the Enumeration drop-down list.
6 Select Comprehensive in the Default drop-down list.
Comprehensive will be the default coverage type choice when users create new rules in
the RMA.
7 Save the changes and close the Enumeration Items Provider Editor. The Rule Template
Editor should be visible again.

Creating an Editable Condition Value


In this section, you will insert a Placeholder and Value Holder referring to the
CoverageTypeCode Enumerations Provider in the rule condition.

To create an editable coverage type


1 In the rule body, place your cursor one space after the equal sign ( = ) and click the Insert
Placeholder icon in the Rule Template toolbar, as shown in the following figure:

2 In the Placeholder Wizard, select Create a new Value Holder.


3 Enter coverageTypeVHolder in the Name field.
4 Enter Coverage Type in the Display Name field.
5 Select the Select a template or provider from the current project option in the drop-down
list.
6 Expand the folders, select the CoverageTypeProvider, and click Next.
7 Retain Exactly 1 in the Value Holder Count drop-down list and click Finish.
8 Save the changes.
This Value Holder allows the selection of one of three available coverage types for each
new rule: Comprehensive, Bodily_Injury, or Loss_of_Use.

Creating an Editable Action Value


In this section, you will insert a Placeholder and Value Holder referring to a built-in real-
provider in the rule action.

Fair Isaac Corporation Confidential and Proprietary Information 124


Chapter 6: Templates Tutorial

To create an editable premium value


1 In the rule action, place your cursor between the = sign and the period. Click the Insert
Placeholder icon in the Rule Template toolbar, as shown below:

2 In the Placeholder Wizard, select Create a new Value Holder.


3 Enter premiumVHolder in the Name field.
4 Enter Premium in the Display Name field.
5 Verify that Select a built-in template or provider is selected in the drop-down list.
6 Select real-provider in the list box and click Next.
7 Retain Exactly 1 is selected in the next window and click Finish.
8 Save the changes.
The partial view of the Rule Template should look like this figure:

Creating a Display Format for the Rule Template


In this section, you will use Display Placeholders, text, and html to create the display for each
rule created using the template. This feature allows you to customize the editing
environment for your business users.

Note: It is not required that you create a display format for your template, but it is
recommended as a best practice. If no display format is specified, the Value Holders appear

Fair Isaac Corporation Confidential and Proprietary Information 125


Chapter 6: Templates Tutorial

in the instance file in the same order in which they appear in the Value Holder and
Arguments section in the template.

To create the display format for the Rule Template


1 In the Display Format field, type the following HTML code and press Enter twice:
<font face="Arial" size="2" color="000066">
This step is optional and included to make the display more attractive.
2 Enter Rule Name: and click the Insert Placeholder icon in the toolbar.
3 Verify that the following options are selected in the Placeholder Wizard:
 Use an existing Value Holder
 Select a Value Holder in the current local template
4 Select ruleNameVHolder and click Finish.
5 Repeating Steps 2-3, insert the rest of the Display Placeholders and add the text as
shown here:

6 Save the changes and close the setPremiumRuleTemplate rule template. The
PricingRulesetTemplate Editor should be visible again.

Enabling Multiple Rule Creation


In this section, you will enable users to create multiple rules in the ruleset by inserting an
Entity Placeholder and Value Holder referring to the setPremiumRuleTemplate in the
PricingRulesetTemplate. The Value Holder count will be "1 or More" to let users create
multiple versions of the rule based on the specifications set in the
setPremiumRuleTemplate. Each rule that is created is another rule in the ruleset.
Entity Placeholders perform the same function as Text Placeholders, except that Entity
Placeholders are used with Value Holders referring to templates that contain SRL entities
such as classes, rules, and enumerations.

To enable multiple rule creation


1 Click the New Entity Placeholder icon in the Ruleset Template Editor toolbar.
2 Verify that the following options are selected in the Placeholder Wizard:
 Create a new Value Holder
 Select a local template or provider
3 Enter ruleTemplateVHolder in the Name field.

Fair Isaac Corporation Confidential and Proprietary Information 126


Chapter 6: Templates Tutorial

4 In the Display Name field, enter:


Rule
This display name appears in both the Instance Editor and in the RMA as a link for adding
more rules. The link text will display as < Add Rule >. If the field is left blank, the Value
Holder name is used by default.
5 Select setPremiumRuleTemplate in the list and click Next.

6 From the Value Holder Count drop-down list, select 1 or More, and click Finish.
7 In the Content section, delete the following rules from the PricingRulesetTemplate:
 setPremium_Bodily_Injury
 setPremium_Comprehensive
 setPremium_Loss_of_Use
These rules are no longer needed because you will be creating rules based on the Rule
Template.

Creating a Table for Rule Editing


In this section, you will create the display format for the ruleset. In this case, the display
format will be a list of rules in a rule table.
The completed table will contain three columns: Rule Name, Start Date, and End Date. To
save time in this tutorial, the table will not contain columns displaying the coverage type or
premium values.

To add HTML formatting for the title


1 Open the PricingRulesetTemplate, if it is not already open.
2 Place your cursor in the Display Format field and type the following HTML code and text:
<b><center><font face="Arial" size="4" color="000066">Welcome to the
Insurance Rules Editing Center</font></center><font face="Arial"
size="1" color="000099">

Fair Isaac Corporation Confidential and Proprietary Information 127


Chapter 6: Templates Tutorial

3 Press Enter twice to create space after the text, and save the changes.

To create the rule table


1 Place your cursor in the Display Format field, two lines below the title text.
2 Click the Insert Display Table icon in the toolbar, or right-click and choose Insert
Display Table.
3 In the Display Table Attributes dialog box, select ruleTemplateVHolder.
4 Select True in the Show Filtering Pane drop-down list, as shown in the following figure:

This option provides filters for searching on values in rule table columns.
5 Retain the other values and click OK.

Note: The Insert Column icon is now activated in the toolbar when your cursor is within
the Value Holder.

Fair Isaac Corporation Confidential and Proprietary Information 128


Chapter 6: Templates Tutorial

To add the Rule Name column


1 Leave the cursor within the yellow table tag where it appears, and click the Insert Column
icon , as shown here:

2 In the Column Header field of the Column Attributes dialog box, type Rule Name and
click OK.
3 Leave the cursor within the column header where it appears, and click the Insert
Placeholder icon in the toolbar.

4 Verify that Use an existing Value Holder is selected.


5 Expand rulesetTemplateVHolder in the list.
Recall that the rulesetTemplateVHolder refers to the Rule Template,
setPremiumRuleTemplate, that contains the Value Holders.
6 Select ruleNameVHolder and click Finish, as shown in the following figure:

Fair Isaac Corporation Confidential and Proprietary Information 129


Chapter 6: Templates Tutorial

This is a partial view of how the Display Format field should appear:

Note that the cursor is between the yellow and the blue fields. Press the right arrow key
once to move it past the blue field. This action activates the Insert Column icon in the
toolbar.

To create the Date columns


1 Repeat the steps in the previous section, using the following column header names and
existing Value Holders:
 Column header 2: Start Date
 Value Holder 2: startDateVHolder
 Column header 3: End Date
 Value Holder 3: endDateVHolder
2 Save the changes.

Generating the Instance File


Next, you will generate an instance of the PricingRulesetTemplate and add new rules. An
instance (or instance file) is a separate repository item that contains the values used to
populate the Value Holders in a global template at runtime. In this case, the values will
resolve to multiple rules in a ruleset.
As a developer, you can use the Instance Editor in the Blaze Advisor IDE to edit and test your
instance files before allowing your business users access to them in the RMA. There are two
views in the Instance Editor:

Fair Isaac Corporation Confidential and Proprietary Information 130


Chapter 6: Templates Tutorial

 The Visual Instance Editor displays the instance file as it would appear in an RMA. This is
the default view.
 The Tabular Instance Editor displays the instance file values in a tabular format.
In this tutorial, you will edit the values in the Visual Instance Editor. For more information, see
“Managing Instances” in DevelopingRuleMaintenanceApplications.pdf.

To generate the instance file


 Make sure the PricingRulesetTemplate Editor is open and select File > New > Generate
New Instance. If the command is not enabled, click in one of the template fields and
retry.
The new instance opens in the Instance editor. There is already one rule in the table
because the Value Holder count is 1 or more. This means there must always be at least
one rule instance in this table. The delete button is enabled when another rule is added.

Note: The default date in the Start and End date fields in your instance should be the
current date.

Adding New Rules in the Instance Editor


In this section, you will add three new rules to the instance file; one for each available
coverage type.

To add new rules


1 Click the < no value > link to open the rule in a rule editing page. Each of these fields is a
Value Holder in the setPremiumTemplate.
2 Enter or select the following values:
 Rule name: setPremium_Bodily_Injury
 Coverage type: Bodily_Injury
 Premium: 50
 Start date: Aug 31, 2021
 End date: Aug 31, 2024
Note that if you change just the month and/or year using the calendar tool, you still must
click on a date in the calendar to close it and record the changes. You can also manually
enter the date in the format mm/dd/yyyy or MON d, yyyy and press Enter to register
your changes.
3 Double-click on the instance in the Project Explorer to return to rule table in the Instance
File Editor.
4 Click < Add Rule > twice.
The word Rule in this < Add Rule > link is the display name you set earlier for the
rulesetTemplateVHolder Entity Placeholder in “Enabling Multiple Rule Creation” on
page 126.
5 Follow steps 1–3 for each new rule, using the following values:

Fair Isaac Corporation Confidential and Proprietary Information 131


Chapter 6: Templates Tutorial

Rule Name Coverage Type Premium Start Date End Date

setPremium_Comprehensive Comprehensive 75 Aug 31, 2021 Aug 31, 2024


setPremium_Loss_of_Use Loss_of_Use 100 Aug 31, 2021 Aug 31, 2024

6 Save the changes.


Your finished rule table should look like this:

7 Select Project > Build Project.


A message appears in the Problems view confirming a successful build.
8 In the Project Explorer, expand PricingRulesetTemplate Instance > PricingRuleset(Auto
Policy) to display the resolved ruleset that includes the rules you just created.

Testing the Ruleset Template Instance


For testing purposes, the main() function is used as the entry point to send data from a test
file to the ruleset template instance for evaluation.
In the body of the main() function, you see that the first line references an XML data file
stored under /tutorials/testData.
You can also open the source files under \tutorials\testData to see how they were
constructed.

To build and run the project


1 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
2 You need to create a run configuration before running the project. Select Run > Run
Configurations... to open the Run Configurations dialog box.
A Run configuration contains the parameters and values that are used when you want to
run or execute a project to test or debug it in the IDE.
3 Select Blaze Advisor Project in the leftmost list of launch configuration types, and click
the New launch configuration icon on the toolbar.
4 Enter Templates Tutorial Run Configuration in the Name field.
5 If the Templates Tutorial Project does not appear in the Project to Run field, perform the
following steps to complete the run configuration for this project:
a Click Select Project to open the Rule Project dialog box.
b Select Templates Tutorial Project [Features Tutorial Repository] and click OK.
6 Click Apply to save your edits.

Fair Isaac Corporation Confidential and Proprietary Information 132


Chapter 6: Templates Tutorial

7 Click Run from the Run Configurations dialog box.


Compare your results in the Console view to the Output Results column in the table in the
next section.

Tip: For subsequent runs, you can click the Run icon on the Launch toolbar, select
Run > Run, or right-click the project in the Project Explorer and select Run As > 1 Blaze
Advisor Project. The Templates Tutorial Run Configuration is automatically run with the
Run As command because there is a matching configuration for the currently selected
project. If you receive a message stating there are no recent launches, then select Run >
Run History > (number) Templates Tutorial Run Configuration, where (number)
represents the numeral associated with one of the previous configuration runs.

Caution: The test files are located in <ADVISOR_HOME>\tutorials\testData. If you


choose to edit these files you may not get the results you expect.

Examining the Results


When you run the test data, you can verify that results you see in the IDE in the Console view
are the same as the results listed here in the table:

Test File Name Output Results


DTable_HighValNoAccidents.xml Policy for: Glenn GoodDriver
Status: approved
Risk Score: 1000.0
Value Tier: One
Premium: 67.5
Discount: 0.8999999999999999

Summary
In this tutorial, you took an existing ruleset and converted it to an editable, user-friendly rule
table that can be accessed easily, both in the Blaze Advisor IDE and in an RMA.

See Also: For more information on how to generate an RMA for this project and edit values
in an RMA, see the “Ruleset Tutorial” on page 76.

Fair Isaac Corporation Confidential and Proprietary Information 133


CHAPTER 7
RMA Tutorial

This FICO® Blaze Advisor® decision rules management system feature tutorial shows you
how to generate a rule maintenance application (RMA). An RMA is a web-based, graphical
user interface (GUI) that allows business users to edit business rules in an intuitive, domain-
specific environment. The RMA that you will generate will allow you to edit values in a display
table, a score model, and a decision table using a web browser.
When you create a rule project, you can create templates that expose specific values or sets
of values that can be edited through the RMA. The actual values that are entered using the
Blaze Advisor IDE or an RMA are stored in separate repository entries called instance files.
When the project is run, or deployed as a service, the instance values are resolved according
to the template definitions to produce valid, functional decision entities. For example, a
Decision Table Template and an instance of a Decision Table Template together form a fully
resolved (decision table) ruleset at runtime.
Prerequisites for this tutorial: You should have a basic understanding of how to use the
Blaze Advisor IDE. If you are new to Blaze Advisor, complete the “Introductory Tutorial” on
page 13 or review the Blaze Advisor documentation.
Time estimate: 20 minutes
Role of the RMA in the completed tutorial: In a real-world situation, a rule maintenance
application (RMA) is just one way to edit instance values. You can choose to edit some
values in the Blaze Advisor IDE, and others you can expose to your business users via the
RMA. While you are completing this tutorial, assume that you are part of a project team
assigned to create the RMA and want to expose only the display table, score model, and
decision table values to your business users. The pages necessary for editing the display
table, the score model, and the decision table that you are working on are part of a larger
enterprise-wide application.
To view the completed version: You can view a completed version of the RMA project at any
time. The completed version is located in the AutoPolicy RMA project under this directory:
Auto Policy Rules\Business Library\AutoPolicy RMA.

Opening the RMA Project


To begin this module, you must open the Blaze Advisor perspective, if it is not already open.
See “Opening the Blaze Advisor Perspective” on page 13. Once you have connected to the
Feature Tutorials repository, you need to open the project where you will complete the
tutorial steps.
Your first step is to include the folders containing the Pricing Ruleset Template, the Score
Model Template, the Decision Table Template, the template instances for all three templates,
and the Auto Policy BOM. You are including an instance of each template so that all of the

Fair Isaac Corporation Confidential and Proprietary Information 134


Chapter 7: RMA Tutorial

project items become part of the RMA project. In this tutorial, the AutoPolicy BOM folder
must be included because the decision table has conditions that use an XML enumeration
from this BOM.

To open the project and include the folders


1 Select File > Import, expand the Blaze Advisor folder, select Rule Project, and click Next.
2 In the Select Repository wizard page, select Feature Tutorials Repository and click Next.
3 In the Select a Blaze Advisor Project wizard page, expand the RMA Tutorial folder, select
the RMA Tutorial Project, and click Finish to open the project.
4 Select the project, right-click and select Open Project Editor.
5 Use one of these options to open the Include Project or Folder dialog box.
 Click the Include Folder or Project icon in the Project Editor.
 Select Project > Include Folder or Project.
6 Expand Auto Policy Rules\Technical Library\Business Object Models and
select the Auto Policy XML BOM folder.
7 Click Include to reference the folder in the project.
8 Include these other folders:
 Auto Policy Rules\Technical Library\Pricing Ruleset Template
 Auto Policy Rules\Business Library\Pricing Rules
 Auto Policy Rules\Technical Library\Tier Placement Decision Table
Template
 Auto Policy Rules\Business Library\Tier Placement Decision Table
 Auto Policy Rules\Technical Library\Risk Score Model Template
 Auto Policy Rules\Business Library\Risk Score Model
 Auto Policy Rules\Technical Library\Utilties
9 If the Save icon is enabled, save your changes.

Tip: In the Blaze Advisor Perspective, changes are automatically saved when you make
them from the Project Explorer. For example, including a folder from the Project Editor
requires you to save changes, but including a folder from the Project Explorer, using the
Project > Include Folder or Project... command, does not.

See Also: For more information, see “Saving Changes to Projects and Project Items” in
DevelopingRuleProjects.pdf.
10 Select File > Refresh to update the contents of the project. The project should now look
like this in the Project Explorer:

Fair Isaac Corporation Confidential and Proprietary Information 135


Chapter 7: RMA Tutorial

Creating a Rule Maintenance Application


Definition
A rule maintenance application definition (RMAD) is a project item that provides a variety of
options for making changes to the RMA components and some editors in the RMA. You can
use the RMAD to store different versions of RMA settings and reuse them with multiple
projects.
For example, if you know that most of your RMAs will use the same settings, you can
configure the RMAD once, save it to a repository folder, and reference it as needed. The
RMAD entity is referenced by the Rule Maintenance Application Generator to configure the
RMA with the selected settings during generation.
You can create your own RMAD before generating an RMA, or use the default one created by
the Rule Maintenance Application Generator. For an example of how to use the default
RMAD, see “Module 3 - Generating an RMA” on page 36.
In this tutorial, you will create an RMAD and change a few options. See “Generating Rule
Maintenance Applications” in DevelopingRuleMaintenanceApplications.pdf for a more
information about the options.

To create a rule maintenance application definition


1 Select the Auto Policy XML BOM folder.
The RMAD will be created inside of it.
2 Select File > New > Rule Maintenance Application Definition.
3 In the Entity name field, enter AutoPolicyRMAD and click Finish to open the RMA
Definition Editor.
4 In the Application Title field, delete the default name, and enter Auto Policy Rules
Center.
5 Clear the check box next to “Dashboard” Page. This RMA will contain only one project so
this page is not necessary.
6 Click the Navigation tab.
7 Select and move all folders to the Excluded content pane except for these three:
 Pricing Rules
 Risk Score Model

Fair Isaac Corporation Confidential and Proprietary Information 136


Chapter 7: RMA Tutorial

 Tier Placement Decision Table


These folders contain instance files that are editable in the RMA.
The Navigation window should now look like this:

8 Click the Graphical Options tab.


9 Under Decision Table Options, click the Edit Graphical Options icon.
10 In the Decision Table Options dialog box, change the color of the cell text.
11 Click OK.
12 Save the changes and close the RMAD.

Generating the Rule Maintenance Application


Rule maintenance applications are created using the Rule Maintenance Application
Generator, a wizard that automatically creates the structure of the RMA application and all
necessary web pages. By default, once you click Finish in the wizard, the web server starts
and a web browser is launched automatically to display the RMA.

Tip: If you do not specify a web browser, Blaze Advisor uses the default browser for your
machine. To specify the web browser that you want to use with Blaze Advisor, see
“Blaze Advisor General Preferences” in DevelopingRuleProjects.pdf.

To generate the rule maintenance application


1 Select Project > Rule Maintenance Applications > Generate Rule Maintenance Applica-
tion.
2 Retain the default entries, and click Finish.
The rule maintenance application opens in a web browser.

Fair Isaac Corporation Confidential and Proprietary Information 137


Chapter 7: RMA Tutorial

Important: Do not close the Blaze Advisor IDE while you are running the RMA. Because
the RMA was opened from the Blaze Advisor IDE, the Apache Tomcat web server will
stop if the IDE is closed.

Editing Values in the RMA


The first web page that you see is the Log on page. Since this is a non-versioned repository,
you do not need to enter a user name or password. Just click Log on.

Editing the Display Table


In this section, you will learn how to edit the display table containing the rules. This how the
folders containing the instances appear when the project is opened in the RMA:

The pane on the left is the tree view of the Explore pane. The pane on the right shows the
same structure in a tabular view. You can expand a folder and open an instance file in either
view.

To edit the display table


1 Expand the Pricing Rules folder and click the PricingRulesetTemplate Instance
file.
The display table contains a search filter in each column, and three rules.
2 Click the Edit icon on the Instance Editor toolbar. The icon changes to reflect that the
instance is editable.
3 Click one of the rule names to edit the rule.
4 Click the Calendar icon for the end date in a rule, and select a new date. Remember it
because you will need it for the next section.
5 Click the Parent View icon to return to the display table.
6 Click the Save icon .

Using Filters in a Display Table


In this section, you will filter out rule instances based on the rule end date.

Fair Isaac Corporation Confidential and Proprietary Information 138


Chapter 7: RMA Tutorial

To use the search filters


1 Click the Parent View icon on the Instance Editor toolbar to return to the Pricin-
gRulesetTemplate Instance, if necessary.
2 In the End Date filter field, enter the end date you changed from the last procedure.
3 Press Tab or click outside of the End Date filter field to filter the list of rules.
Only the rule you changed in the last procedure appears in the table.
4 To clear the search criteria, place your cursor in the field and use the Backspace key to
remove the end date you entered in Step 2. Click outside of the End Date filter field to
display the original list of rules.
5 Click the Close Editor icon .

Editing the Score Model Values


In this section, you will change a value in one of the score model bins. You will notice that the
Score Model Editor has a different appearance in the RMA. Regardless of where you edit the
values, the values are always stored in the instance file.

To edit the score model values


1 In the Explore pane, click Expanded View icon to open the Project Explorer if it is not
already open.
2 Expand the Risk Score Model folder, and click the Risk Score Model Template
Instance file.
3 Click the Edit icon on the Instance Editor toolbar.
4 Click the + icon to the left of the Years Licensed characteristic to expand that row.
5 In the New driver bin, change the value in the Range field to 4, and press Enter.
6 In the Experienced driver bin, change the value in the Range field to 4, and press Enter.
You must always press Enter after your last entry to register the change.
7 Click the Save icon .
8 Click the Close Editor icon .

Editing the Decision Table Values


In this section, you will change some decision table cell values. You will notice that the
Decision Table Editor has a different appearance in the RMA. Regardless of where you edit
the values, the values are always stored in the instance file. Also, you will see that the text in
the decision table cells are the color you selected in the Graphical Options tab in the RMAD.

To edit the decision table values


1 In the Explore pane, click Expanded View to open the Project Explorer if it is not already
open.
2 Expand the Tier Placement Decision Table folder, and click the Tier Placement
Decision Table Template Instance file.
3 Click the Edit icon on the Decision Table Instance Editor toolbar.

Fair Isaac Corporation Confidential and Proprietary Information 139


Chapter 7: RMA Tutorial

4 In the first row, click in the Risk Score cell and change the range to 650-750, and click
OK. In the Value Tier cell, change the value to Five.
5 Click the Save icon .
6 Click the Log off icon on the Global Command Bar.
7 In the Blaze Advisor IDE, select Project > Rule Maintenance Applications > Stop
[FeatureTutorialsRepository.RMATutorialProject], and close the web browser.

Viewing the Changes in the Blaze Advisor IDE


Use the Instance Editor in the Blaze Advisor IDE to view the changes you made in the RMA
that have been saved to the instance files in the repository.

To view changes in the Blaze Advisor IDE


1 Select the RMA Tutorial Project, right-click and select Refresh.
2 Open each instance file to see that the changes you made in the RMA have been saved
to the instance files.
The instance files are in the Pricing Rules, Risk Score Model, and Tier Placement
Decision Table folders.

Relaunching the RMA


If you want to want to launch the RMA again, uses this procedure in the Blaze Advisor IDE.

To launch the RMA from the Blaze Advisor IDE


1 Select Project > Rule Maintenance Applications > Start [FeatureTutorialsReposi-
tory.RMATutorialProject] to start the web server.
The Select Location of Rule Maintenance Application dialog appears. You should see
RuleMaintenanceCenter in the Look in field. If you do not see it, browse until you locate
the directory.
2 Click Select Folder.
3 Select Project > Rule Maintenance Applications > Open to launch the application in your
browser.

Fair Isaac Corporation Confidential and Proprietary Information 140


CHAPTER 8
Ruleflow Tutorial

This FICO® Blaze Advisor® decision rules management system feature tutorial shows you
how to use a ruleflow to control the flow of execution between related business tasks. Each
task is implemented by a Blaze Advisor ruleset, function, or decision metaphor such as a
decision table, decision tree, or score model. The Ruleflow Editor in the Blaze Advisor IDE
provides graphical tools for constructing and visualizing ruleflows.

In this tutorial you develop and test the Data Validation Ruleflow. The ruleset and function
that implement the business tasks are already built. You:
 Define the data context.
 Add the tasks in the sequence you want.
 Add conditional branching.
 Choose the implementation for each task and make parameter and return value
assignments.
 Define a function to be used as the entry point for the service invocation when the
ruleflow has been deployed as a rule service.
 Run the project with test data to verify that the flow is working properly.
Prerequisites for this tutorial: You should have a basic understanding of Blaze Advisor
functional entities such as rulesets, decision metaphors, and functions. Other tutorials for
developing these entities are available. See:
 “Ruleset Tutorial” on page 76
 “Score Model Tutorial” on page 101
If you are new to Blaze Advisor, complete the “Introductory Tutorial” on page 13 or review
the Blaze Advisor documentation.
Time estimate: 60 minutes
Role of the ruleflows in the Auto Policy scenario: All of the feature tutorials are based on a
hypothetical automobile insurance scenario. In this scenario, each of the ruleflows controls
the execution of a single rule service. For an overview of the two services, see “Rule

Fair Isaac Corporation Confidential and Proprietary Information 141


Chapter 8: Ruleflow Tutorial

Services” on page 9. For an overview of the complete scenario, see “Overview of the
Features Tutorials Scenario” on page 8.
Each ruleflow is developed in its own project in the repository. The project refers to a folder
that contains the ruleflow itself, along with the entry-point function for the deployed rule
service. It also refers to all of the folders that contain the entities for implementing the
business tasks, and a folder that contains a main function for testing the ruleflow in the
Blaze Advisor IDE.
To view the completed version: In the IDE you can view the completed versions of each
tutorial project are included in the Auto Policy Rules folder in the Feature Tutorials
Repository. The Data Validation development project can be found under Auto Policy
Rules\Testing\Rule Service Testing\Data Validation Ruleflow Testing
Folder.

Assembling the Data Validation Ruleflow


Project
To begin this module, you must open the Blaze Advisor perspective. See “Opening the
Blaze Advisor Perspective” on page 13. Once you have connected to the repository, you
need to open the project where you will complete the tutorial steps.

To open the Ruleflow Tutorial Project


1 Select File > Import, expand the Blaze Advisor folder, select Blaze Advisor Project, and
click Next.
2 In the Select Repository wizard page, select Feature Tutorials Repository and click Next.
3 In the Select a Blaze Advisor Project wizard page, expand the Ruleflow Tutorial folder,
select the Ruleflow Tutorial Project, and click Finish to open the project.
The project already includes references to two folders:
 Ruleflow Tutorial
This folder will contain the main() function that you will use to test the ruleflow. A
separate folder is needed because the main() function will not be included with the
ruleflow when it gets deployed with the service. Having the function in a separate
folder allows you to easily remove it from the deployment without removing it from
the project.
 Data Validation Ruleflow
The Data Validation Ruleflow folder is located under the Ruleflow Tutorial folder, and
contains the deployable ruleflow. The Data Validation Ruleflow that you will build has
three business tasks. The task implementations are entities that already exist in the
Business Library and the Technical Library of the repository. The Business Object
Model (BOM) for the ruleflow also already exists in the Technical Library. Before
creating the ruleflow, add the folders containing the entities and the BOM to the
project.
Note that in the Auto Policy scenario, the Data Validation Ruleflow folder is located in
the Data Validation folder of the Technical Library.

See Also: The Knockout Ruleset that you will reference in this tutorial is the subject of
the Ruleset Tutorial. See “Ruleset Tutorial” on page 76 for details.

Fair Isaac Corporation Confidential and Proprietary Information 142


Chapter 8: Ruleflow Tutorial

To add the Knockout Rules from the Business Library


1 Use one of these options to invoke the Include Folder or Project dialog box.
 Click the Include Folder or Project icon in the Project Editor.
 Select Project > Include Folder or Project.
2 Expand Auto Policy Rules/Business Library, select Knockout Rules and click
Include to add a reference to the project.

3 If the File > Save command or the Save icon is enabled, save your changes.

Tip: In the Blaze Advisor Perspective, project changes are automatically saved when you
make them from the Project Explorer. For example, including a folder from the Project
Editor requires you to save changes, but including a folder from the Project Explorer,
using the Project > Include Folder or Project command, does not.

See Also: For more information, see “Saving Changes to Projects and Project Items” in
DevelopingRuleProjects.pdf.
The Knockout Rules folder is now included in the Ruleflow Tutorial Project. The full path
to the folders included in the project appears in the Project Editor.

To add the Auto Policy XML BOM from the Technical Library
1 Use one of these options to invoke the Include Folder or Project dialog box.
 Click the Include Folder or Project icon in the Project Editor.
 Select Project > Include Folder or Project....
2 Expand Auto Policy Rules/Technical Library/Business Object Models,
select Auto Policy XML BOM, and click Include to add a reference to the project.
The Auto Policy XML BOM folder appears in the Project Explorer. The full path to this
folder appears in the Project Editor. In the Object Model Explorer, you can expand the
AutoPolicy XML BOM folder to see the classes contained in them. If you expand a class,
you can see its properties and methods.

Fair Isaac Corporation Confidential and Proprietary Information 143


Chapter 8: Ruleflow Tutorial

Tip: If the folder does not display in the Object Model Explorer, build the project by
selecting Project > Build Project. The folder should now appear.
3 If the File > Save command or the Save icon is enabled, save your changes.

Tip: In the Blaze Advisor Perspective, project changes are automatically saved when you
make them from the Project Explorer. For example, including a folder from the Project
Editor requires you to save changes, but including a folder from the Project Explorer,
using the Project > Include Folder or Project... command, does not.

See Also: For more information, see “Saving Changes to Projects and Project Items” in
DevelopingRuleProjects.pdf.

To add the Utilities Folder from the Technical Library


1 Use one of these options to invoke the Include Folder or Project dialog box.
 Click the Include Folder or Project icon in the Project Editor.
 Select Project > Include Folder or Project....
2 Expand Auto Policy Rules/Technical Library, select Utilities, and click
Include to add a reference to the project.
The Utilities folder contains several functions, including the implementations for two of
the Data Validation Ruleflow tasks.
3 If the File > Save command or the Save icon is enabled, save your changes.

Tip: In the Blaze Advisor Perspective, project changes are automatically saved when you
make them from the Project Explorer. For example, including a folder from the Project
Editor requires you to save changes, but including a folder from the Project Explorer,
using the Project > Include Folder or Project... command, does not.

See Also: For more information, see “Saving Changes to Projects and Project Items” in
DevelopingRuleProjects.pdf.
4 Select File > Refresh to update the contents of the repository.
The project now includes all of the entities you need except for the ruleflow itself and the
main function for testing it. You create these next.

Creating the Data Validation Ruleflow


In this section you create and name the new ruleflow entity, define a ruleflow variable that
provides the data context for all of the ruleflow tasks, and define the start event that begins
the ruleflow execution. The first step is to create the ruleflow.

Fair Isaac Corporation Confidential and Proprietary Information 144


Chapter 8: Ruleflow Tutorial

To create the Data Validation Ruleflow


1 In the Project Explorer, expand the Ruleflow Tutorial folder and select the Data Valida-
tion Ruleflow.

Note: When a folder is selected in the Project Explorer, any new entities that you create
are added to it.
2 Click the New Ruleflow icon on the Blaze Advisor Entities toolbar, or select File > New
> Decision Entities > Ruleflow.
3 In the Entity name field, enter Data Validation and click Finish to open the Ruleflow
Editor. This is how the ruleflow appears:

4 Save your changes.

Defining a Ruleflow Variable and the Start Event


As you develop a ruleflow, you need to be aware of the data values that will be available to
the various task implementations. While Blaze Advisor rules can work with global data
objects, it is often advisable to define variables that are local to the ruleflow, and use them to
control the data that is passed to the various tasks.
The most common way to start the ruleflow execution is to have it listen for a start event. A
start event occurs when an object of a particular type is posted to the event channel.
Blaze Advisor has a built-in postEvent() function that you can use to post an event from a
function or rule action. When you deploy a rule service, you can define an event poster entry
point that posts the objects when the service is invoked. A typical ruleflow has a variable of a
particular type and is set to listen for a start event indicating that an object of that type has
been posted. The object is then assigned to the ruleflow variable and the ruleflow begins
executing.
The Data Validation ruleflow is intended to perform some basic evaluations on an auto
insurance policy application. It has a single ruleflow variable, called thePolicy, which holds
a reference to an instance of the AutoPolicy class. This AutoPolicy class is defined in the
BOM you imported earlier. The ruleflow is set to listen for occurrences of AutoPolicy

Fair Isaac Corporation Confidential and Proprietary Information 145


Chapter 8: Ruleflow Tutorial

objects. When an AutoPolicy object is posted, it is assigned to thePolicy and the ruleflow
starts.

To define the ruleflow variable


1 Open the Data Validation ruleflow you created earlier and click the Settings tab at the
bottom of the editor.
2 Click the New Flow Variable icon to create the variable.

3 Replace the default name, FlowVariable1, with thePolicy.


4 From the Type drop-down list, select AutoPolicy.
If AutoPolicy does not appear in the list, select File > Refresh to refresh the project.

To define the Start Event


1 Click the New Start Event icon.

2 Click in the text field next to Whenever a/an to enable the drop-down list, and select
AutoPolicy.
3 Select the entire Whenever a/an statement to enable the New Assignment icon , and
click the icon.

Tip: When you select the Whenever a/an statement, a blue outline of the statement
should display, as shown in the following figure:

4 Enter it in the Assign field.


5 Select thePolicy in the To drop-down list.

Fair Isaac Corporation Confidential and Proprietary Information 146


Chapter 8: Ruleflow Tutorial

6 Save your changes.

Adding the Knockout Rules Task


Now that your ruleflow has a way to start and some data to work with, you can add the tasks
the ruleflow needs to perform. The first Data Validation task is to apply a set of knockout
rules that identify data that is clearly invalid and set the application status to disqualified
when invalid data is found. The task implementation is the KnockoutRuleset in the
Knockout Rules folder you imported earlier.

To add the Knockout Rules task


1 With the Data Validation Ruleflow open in the editor, click the Content tab.
2 Click the Insert Task icon in the Ruleflow Editor toolbar.
3 Place your cursor on the arrow between the two ruleflow endpoints, as shown in the
following figure:

4 Click to create the new task node, as shown in the following figure:

To change the task name and specify the implementation


1 Double-click the new task to open it in the Task Editor.
2 In the Task field replace Task1 with Knockout Rules and press Enter.

Fair Isaac Corporation Confidential and Proprietary Information 147


Chapter 8: Ruleflow Tutorial

3 From the Implementation drop-down list, scroll up and select


KnockoutRuleset(AutoPolicy).
The list shows all of the functional entities in the project. The KnockoutRuleset is
available because it is contained in the Knockout Rules folder that you imported earlier.
When you select a functional entity as an implementation, the signature of the entity is
read and any arguments are added to the Implementation Arguments area.
4 In the Implementation Arguments field, enter thePolicy.
The KnockoutRuleset has a parameter called thePolicy, of type AutoPolicy. The
ruleflow variable you created earlier is also called thePolicy, of type AutoPolicy. The
Implementation Arguments setting passes the object reference from the ruleflow
variable as the argument for the ruleset parameter.

The KnockoutRuleset return type is void, so you can leave the Assign value returned
from implementation to field empty.
5 Close the Task Editor and save your changes.

Adding a Decision Branch


When the Knockout Rules finish processing, the AutoPolicy object held by thePolicy
ruleflow variable will have a status property value set. If the application is invalid, the status
is set to disqualified. At this point, you want to separate the disqualified applications
from the good ones, so you add a decision branch to the ruleflow that looks at the status
value and routes the policy accordingly. Blaze Advisor refers to this decision branch as a
split.

To add the split


1 With the Data Validation Ruleflow open in the editor, click the Insert Split icon on the
Ruleflow Editor toolbar.
2 Place your cursor on the arrow to the right of the Knockout Rules task and click.
A node with two branches appears.

Fair Isaac Corporation Confidential and Proprietary Information 148


Chapter 8: Ruleflow Tutorial

3 Double-click on the triangle to open the Split Editor.


4 In the Branches area, expand Branch 1.
5 In the Condition text field, enter this SRL statement:
thePolicy.DecisionInfo.status <> "disqualified".
6 Expand Branch 2 and enter this SRL statement in the Condition field:
thePolicy.DecisionInfo.status = "disqualified".

7 Close the Split Editor and save your changes.

Adding Tasks to the Branches


The split allows you to separate disqualified policies from valid policies. Valid policies need
to be submitted for further evaluation and pricing, while disqualified policies need to be
appropriately archived. You will add a task called Submit for Pricing to Branch 1 and a task
called Archive Rejected Applications to Branch 2.
To keep the tutorial simple, you use the same function as the implementation for both tasks.
The example would probably be more realistic if it had separate implementations that
actually connected to workflows, wrote to databases, sent notifications, or did some other
extra work. However, the writePolicy() function in the Utilities folder that you imported
takes an AutoPolicy object as an argument and writes it out as an XML file. It checks the
status value and writes disqualified applications to the <ADVISOR_HOME>/tutorials/
testData/rejectedApplications directory, and writes valid applications to the
<ADVISOR_HOME>/tutorials/testData/pendingApplications directory.
The procedure for adding the tasks and setting the implementations is basically the same as
for adding the first task.

To add the tasks to the branches


1 Click the Insert Task icon .
2 Position the cursor on the top branch of the split and click.
3 Click Insert Task again.

Fair Isaac Corporation Confidential and Proprietary Information 149


Chapter 8: Ruleflow Tutorial

4 Position the cursor on the lower branch of the split and click.

To set the task implementations


1 Double-click on the top Task1 to open the Task Editor.
2 Change the Task name to Submit for Pricing.
3 For the Implementation, select writePolicy(AutoPolicy).
4 For the Implementation Arguments assignment, enter thePolicy.
5 Close the editor and double click on the bottom Task1.
6 Change the Task name to Archive Rejected Application.
7 Set the Implementation to writePolicy(AutoPolicy).
8 Set the argument value to thePolicy.
9 Close the Task Editor and save your changes.
The ruleflow is now complete, as shown in the following figure:

The next step is to test its functionality.

Defining the Entry Point Function


In the Auto Policy scenario, the Data Validation ruleflow defines the functionality for the
deployed Data Validation rule service. Data from the external application is passed to the rule
service as an XML Element. However, the ruleflow is set to listen for AutoPolicy objects.
You need to cast the incoming Element to an AutoPolicy, and then post the AutoPolicy to the
ruleflow event channel. To do this you write a function called postApplication() that
takes an Element as an argument. When the service is deployed, postApplication() is
used as the entry point. You can learn more about this function in the Deployment tutorial. To
test the ruleflow in the Blaze Advisor IDE, you write a main() function that reads in xml files
as Elements and passes them to postApplication().

See Also: “Deployment Tutorial” on page 155.

Fair Isaac Corporation Confidential and Proprietary Information 150


Chapter 8: Ruleflow Tutorial

To create the postApplication() function


1 With the Ruleflow Tutorial Project open in the Project Explorer, expand the Ruleflow Tuto-
rial folder and select the Data Validation Ruleflow folder.
This step is important because it means the function will be created in the selected
folder. The function is an integral part of the service deployment, and so should reside in
the same folder as the ruleflow. In contrast, the main() function you create in the next
section is only for testing the ruleflow locally, and is not part of the deployment.
Therefore it needs to be in a different folder.

2 Click the New Function icon on the Blaze Advisor Entities toolbar, or select File > New
> Decision Entities > Function.
3 In the Entity name field, enter postApplication and click Finish to open the Function
Editor.
4 Click the New Parameter icon .
5 Replace parameter1 with policyElement.
6 In the Type field, replace object by entering Element.
Element is not available from the drop-down list since it is not an explicitly imported
class.
7 In the Function Body, enter these SRL statements:
events().postEvent(policyElement as an AutoPolicy).
executeAgent().

Note: The events() built-in function returns the internal event manager. The argument
to the postEvent() call performs the cast from Element to AutoPolicy. The cast is
valid as long as the top node of the Element is <AutoPolicy>. The executeAgent() built-
in tells the ruleflow to start monitoring the event channel.
8 Build the project to make sure the syntax is correct and then save your changes. The
postApplication() function should look like this:

Fair Isaac Corporation Confidential and Proprietary Information 151


Chapter 8: Ruleflow Tutorial

Testing the Ruleflow


Blaze Advisor provides tools for compiling, running, and debugging projects in the
Blaze Advisor IDE so that you can test them before deploying your rule services. In this
section, you create a main() function that reads in xml files from your Blaze Advisor
installation and passes the resulting Element objects to the postApplication() function
you created earlier. After the ruleflow has executed, the status of the objects is printed to the
Console view and the resulting xml files are written to the appropriate folders.
The main() function is only for testing in the Blaze Advisor IDE and not part of the deployed
service. Therefore, it is not stored in the folder with the ruleflow. It is stored in a separate
folder than can be removed from the project when you are ready to release and deploy the
service.

To create the main() function


1 With the Ruleflow Tutorial Project open in the Project Explorer, select the Ruleflow Tuto-
rial folder.
This ensures that the new function is stored in this folder.
2 Click the New Function icon on the Blaze Advisor Entities toolbar, or select File > New
> Decision Entities > Function.
3 In the Entity name field, enter main and click Finish to open the Function Editor.
4 In the Function Body field, enter or paste these SRL statements:
policies is a fixed array of 9 AutoPolicy initially {
it[0] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/rs_invalid_age.xml").
it[1] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/rs_invalid_miles.xml").
it[2] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/rs_invalid_violations.xml").
it[3] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/valid1.xml").
it[4] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/valid2.xml").
it[5] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/valid3.xml").
it[6] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/valid4.xml").
it[7] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/valid5.xml").
it[8] =
AutoPolicy.readAutoPolicy(NdProductInfo.getInstallDirectory(NdProductInfo.PRODUCT_ADVISOR_TUTORIA
LS)"/tutorials/testData/valid6.xml").
}

for each AutoPolicy in policies do {


postApplication(it as an Element).
print("The status is: "it.DecisionInfo.status).
}

Important: The first line in each test case begins with it[0], it[1] ... it[8] and wraps
to the next two lines due to space limitations in this document. For each test case, enter

Fair Isaac Corporation Confidential and Proprietary Information 152


Chapter 8: Ruleflow Tutorial

all 3 lines on the same line in the function body. It is important that there are no line
breaks in each of the nine test cases.

Note: This code creates a fixed array of nine AutoPolicy objects and initializes it by
reading files from the testData folder in your Blaze Advisor installation. The
readAutoPolicy() method is a static method of the AutoPolicy class. All classes in
an XML BOM have a similar method for reading in xml files. In addition, the
getInstallDirectory method of the NdProductInfo class in the Utilities folder is
used to obtain the Blaze Advisor installation directory to create the correct path for the
location of the test data.
The for each block loops over all of the objects in the array and passes them as
Elements to the postApplication() function, and then prints the status value.
You cast the object to an Element because the postApplication() function is
expecting it to come in from an external application. Passing the object as an Element
more closely replicates an actual service invocation.
5 Select Project > Build Project.
A message appears in the Problems view confirming a successful build.
6 You need to create a run configuration before running the project. Select Run > Run
Configurations... to open the Run Configurations dialog box.
7 Select Blaze Advisor Project in the leftmost list of launch configuration types, and click
the New launch configuration icon on the toolbar.
You may need to scroll to see the Blaze Advisor Project in the list.
8 Enter Ruleflow Tutorial Run Configuration in the Name field.
9 If the Ruleflow Tutorial Project does not appear in the Project to Run field, perform the
following steps to complete the run configuration for this project:
a Click Select Project to open the Rule Project dialog box.
b Select Ruleflow Tutorial Project [Features Tutorial Repository] and click OK.
10 Click Apply to save your edits.
11 Click Run from the Run Configurations dialog box.

Tip: For subsequent runs, you can click the Run icon on the Launch toolbar, select
Run > Run, or right-click the project in the Project Explorer and select Run As > 1 Blaze
Advisor Project. The Ruleflow Tutorial Run Configuration is automatically run with the
Run As command because there is a matching configuration for the currently selected
project. If you receive a message stating there are no recent launches, then select Run >
Run History > (number) Ruleflow Tutorial Run Configuration, where (number) represents
the numeral associated with one of the previous configuration runs.
12 Save your changes.
The three files with invalid in the name will be disqualified, while the six valid files will
have a status value of pending, as shown in the following figure:

Fair Isaac Corporation Confidential and Proprietary Information 153


Chapter 8: Ruleflow Tutorial

Look in the <ADVISOR_HOME>/tutorials/testData/rejectedApplications folder


to view the three rejected xml files. You can check the time stamps to verify when they
were generated. Similarly, the valid files should be in the pendingApplications folder.

Fair Isaac Corporation Confidential and Proprietary Information 154


CHAPTER 9
Deployment Tutorial

This FICO® Blaze Advisor® decision rules management system tutorial shows you how to
deploy a rule service into your application architecture so that client components can invoke
the service with data to be evaluated by the rules. Rule services are managed by an
implementation of the Blaze Advisor Rule Server. In this tutorial you will:
 Create reusable deployment entities
Deployment configuration settings are specified in reusable deployment entities which
are used by a wizard to generate the configuration and class files needed for
deployment. The deployment entities allow you to set the configurations once and to use
them to deploy the project as often as required.
 Release a copy of a project
Blaze Advisor includes a Release Project feature that lets you create a copy of a project
in a separate folder. When a version of a project is ready to be deployed, you can release
it and use the released copy for your deployment while continuing to develop the original
project.
 Use the Generate Deployment Wizard command to create:
 Rule server code
 Server configuration file
 Simple client code that shows how to invoke the service through the server
 Application code for launching the server, creating a client, and invoking the service
from the client
 Modify the client code to read in XML files and pass them to the service
 Run the application
Prerequisites for this tutorial: You should be familiar with the Java programming language
and have a basic understanding of client and server programming concepts.
If you are new to Blaze Advisor, complete the “Introductory Tutorial” on page 13 or review
the Blaze Advisor documentation.
Time estimate: 60 minutes
Role of the deployment in the Auto Policy scenario: All of the feature tutorials are based on
a hypothetical automobile insurance scenario. This tutorial deploys the Data Validation rule
service, which is responsible for evaluating the data input by a customer applying for an
insurance policy. This evaluation determines if there are any obvious reasons for rejecting
the application. For an overview of the service, see “Rule Services” on page 9. For an
overview of the complete scenario, see “Overview of the Features Tutorials Scenario” on
page 8.

Fair Isaac Corporation Confidential and Proprietary Information 155


Chapter 9: Deployment Tutorial

To view the completed version: In the IDE, you can view the completed versions of each
tutorial project are included under the Auto Policy Rules folder in the feature tutorials
repository:
 The Data Validation development projects can be found under Auto Policy Rules/
Testing/Rule Service Testing/Data Validation Ruleflow Testing Folder.
 The released version of Data Validation can be found under Auto Policy Rules/Rule
Services/Data Validation.
See “Opening the Deployment Tutorial Project” on page 156.
The complete deployment application is included in your Blaze Advisor installation at
<ADVISOR_HOME>/tutorials/deploymentsAutoPolicy/dataValidation. A
DeploymentDocumentation.html file with instructions for running the deployment application
is included in the folder.

Opening the Deployment Tutorial Project


To begin this module, you must open the Blaze Advisor perspective. See “Opening the
Blaze Advisor Perspective” on page 13. Once you have connected to the repository, open the
Deployment Tutorial Project to complete the tutorial steps.

To open the Deployment Tutorial Project


1 Select File > Import, expand the Blaze Advisor folder, select Blaze Advisor Project, and
click Next.
2 In the Select Repository wizard page, select Feature Tutorials Repository and click Next.
3 In the Select a Blaze Advisor Project wizard page, expand the Deployment Tutorial
folder, select the Deployment Tutorial Project, and click Finish to open the project.
4 In the Project Explorer, right-click Deployment Tutorial Project [Feature Tutorials
Repository] and select Open Project Editor.
The Project Editor displays the references to all the repository folders that contain the
SRL entities required for the Data Validation rule service.

The assumption is that all of the service components have already been developed and
tested. You are ready to create the deployment entities and to deploy the project. If you
compare this tutorial project to the Data Validation Ruleflow Testing Project in
the Auto Policy Rules/Testing/Rule Service Testing/Data Validation
Ruleflow Testing Folder of the repository, you see that they refer to the same folders,
with one exception. The Ruleflow Testing project includes a reference to Data
Validation Ruleflow Testing Folder, which contains the main() function used for

Fair Isaac Corporation Confidential and Proprietary Information 156


Chapter 9: Deployment Tutorial

testing the ruleflow. For this deployment, the main() function should not be included.
Instead, you will define a rule service entry point that will call the postApplication()
function, which is contained in the Data Validation Ruleflow folder, when the service is
invoked.
More details about the entry point are described later. Note that this project represents a
fully tested, runnable rule service that is ready to be deployed.

Configuring the Deployment Settings


Blaze Advisor allows you to configure and store deployment settings in deployment entities
that can be used with multiple rule service deployments. For example, if you know that most
of your deployments will use the same settings, you can configure the deployment entities
once, save them to a repository folder, and reuse them as needed. The deployment entities
are referenced by the Generate Deployment Wizard, which uses the settings to generate the
configuration and class files.
In this section, you will configure the following deployment entities:
 Rule Service Definition (RSD), which is used to configure the platform-independent
settings, such as the entry point and the rule service interfaces.
 Deployment Definition (DD), which is used to configure the system-independent
deployment settings, such as the deployment manager or remote debugging.
 System Definition (SD), which is used to configure the system-dependent deployment
settings, such as the connection details for the deployment manager and remote
debugger.

Note: For simplicity, this tutorial uses many of the default values in the deployment entities.
For information on other deployment options, see “Generating Rule Services” in
DeployingRuleServices.pdf.

To create the Rule Service Definition


1 In the Project Editor, click the Include Folder or Project icon, expand Deployment Tuto-
rial, and select the Deployment Entities folder.
2 Click Include.
3 Select the Deployment Entities folder in the Project Explorer and then select File > New >
Deployment Entities > Rule Service Definition.
4 In the Entity name field, enter Data Validation Rule Service Definition and
click Finish to open the Rule Service Definition Editor.
5 In the Rule Service field, enter:
Data Validation
6 Leave the Description field empty.
7 Next to the Entry Points panel, click Add.
8 From the Functional Item drop-down list, select postApplication(Element) and click
Finish.

Note: The Entry Point ID field is automatically filled in after selecting the functional item.

Fair Isaac Corporation Confidential and Proprietary Information 157


Chapter 9: Deployment Tutorial

To create the Deployment Definition


1 Select the Deployment Entities folder and then select File > New > Deployment Entities >
Deployment Definition.
2 In the Entity name field, enter Data Validation Deployment Definition and click
Finish to open the Deployment Definition Editor.
3 In the Target Platform field, within the Environment Settings section, retain Java.
4 In the Rule Server Name field, within the Rule Server Settings section, enter:
Data Validation
This entry determines the prefix of some of the generated files.
5 Click the Code Generation tab, and erase the entry in the Source package name field.

To create the System Definition


1 Select the Deployment Entities folder and then select File > New > Deployment Entities >
System Definition.
2 In the Entity name field, enter Data Validation System Definition and click Finish
to open the System Definition Editor.
3 In the Target Platform field, within the Target Platform section, retain Java.
4 Save your changes.

Releasing the Data Validation Project


Before you actually deploy the project, you first release the project. A released project is an
editable copy of the original (source) project. Generally, you release a project when you have
completed your testing and are ready to use the project in a deployed rule service.

See Also: For more information, see “Releasing Blaze Advisor Projects” in
DevelopingRuleProjects.pdf.

To release the project


1 With the Deployment Tutorial project open, select Project > Release Project.
2 In the Release Project dialog box, expand the Deployment Tutorial folder and select the
Rule Services folder.
3 Click New Folder.
4 Replace the default New Folder name with Data Validation and click OK.
5 In the Project Name field, replace the default value with Data Validation. This is how
the dialog box should appear:

Fair Isaac Corporation Confidential and Proprietary Information 158


Chapter 9: Deployment Tutorial

6 Leave the Filter field empty. This is an optional field that lets you apply a filter to include
some project items and not others when you release a project. See “Filtering Project
Content” in DevelopingRuleProjects.pdf.
7 (Optional) In the Comments field, erase the default text and enter your own comments.
8 Keep the Flatten unreleased subprojects option clear since this project does not contain
subprojects.
9 Clear the Check in new project release option. This option is only used to check in a
released project to a versioned repository.
10 Click Save.
11 Select Project > Close Project to close the project.
The released version of the project appears in the repository in the new folder you
created at Deployment Tutorial/Rule Services/Data Validation. It includes
copies of each folder referenced by the project. The copies have no connection to the
original folders from the Auto Policy Rules/Technical Library and the Auto
Policy Rules/Business Library. You will use the released version to deploy the
project.

Tip: To view the released project in the Repository Explorer, select Window > Show View
> Repository Explorer and then select the Feature Tutorials Repository.

Fair Isaac Corporation Confidential and Proprietary Information 159


Chapter 9: Deployment Tutorial

Generating the Deployment Files


The Blaze Advisor IDE includes the Generate Deployment Wizard that generates a server
configuration and the source code for your deployment. You will open the released version of
the Data Validation project you created in the last section and use the wizard to generate a
simple Java deployment.

To launch the Deployment Wizard and create the server


configuration
1 From the Repository Explorer, open the released project by double-clicking Data Valida-
tion in the Deployment Tutorial/Rule Services/Data Validation folder.
2 Select Project > Generate Rule Service Deployment.
3 Retain the default values in the first page of the wizard. Notice that the wizard is
referencing the Rule Service and Deployment Definitions you created earlier. Click Next
twice.

Note: The second page of the wizard references the System Definition you created
earlier.
4 In the Target Directory field, change the path to
<ADVISOR_HOME>\tutorials\dataValidation, where <ADVISOR_HOME> is a variable
representing the location of the Blaze Advisor installation.

Note: This is where the configuration and class files will be generated. In addition, the
dataValidation folder will be created by the wizard.

Tip: You can determine the location of the parent folder containing the Blaze Advisor
installation by selecting Window > Preferences and then clicking Blaze Advisor in the left
panel. The install location of the parent folder displays in the right panel. The default is
for Blaze Advisor to be installed to a subfolder, called Advisor(version number). For
example, if you installed Blaze Advisor 7.8 to a parent folder of C:\Blaze, then
ADVISOR_HOME> is C:\Blaze\Advisor78.

5 Click Next to display the Generated Files wizard page. Keep the default selection of files
to generate and click Finish.
6 Click OK to dismiss the message listing the files that were generated.
This is a description of files in the directory:
 Build.bat (Windows) or Build.sh (Unix).
This file checks to see if the correct environment variables are set and then compiles the
Java classes.
 Client.java
The code in the Client class is responsible for obtaining the data to be evaluated by the
rules and invoking the rule service with it.
 Data_Validation.server
The rule server configuration file.
 DeploymentDocumentation.html
This file contains instructions for running the generated application. The Generate
Deployment Wizard always generates instructions for running the deployment files. A

Fair Isaac Corporation Confidential and Proprietary Information 160


Chapter 9: Deployment Tutorial

sample one is included in this directory; however, to run the deployment for this tutorial,
follow the instructions in this document.
 Run.bat (Windows) or Run.sh (Unix)
This file runs the application after using the Build script.
 Runner.java
This file contains the application code that launches the server, creates a client instance,
and invokes the rule service through it.
 Server.java
This file contains the code for the Blaze Advisor Rule Server implementation.
Before you build and run the application, you need to modify the client code to read in the
test data that you want to pass to the rule service.

Building the Application


The generated code is a simple but complete client/server application. The only code you
need to write is in the Client.java file. You need to add instructions on how to obtain the xml
Element object to pass to the service. However, before you add the instructions, you can
open these files in a text editor to view the contents:
Runner.java provides a convenient way to test the generated files. It includes a main()
function that starts the application, and then calls a method called runExample() that:
 Creates an instance of the Server class:
Server server = (Server)Server.createServer(serverConfig);
The serverConfig argument is a String value with the path to the
Data_Validation.server file.
 Creates an instance of the Client class by passing the constructor a reference to the
Server instance:
Client client = new Client(server);
 Calls the run() method of the client, which reads in the data and invokes the service.
 Shuts down the server.
Server.java defines a subclass of NdStatelessServer, the basic Blaze Advisor stateless
server implementation for Java.

Tip: JavaDoc API documentation is available for NdStatelessServer and the other rule server
classes by opening the <ADVISOR_HOME>/doc/api/packages.html file in a web browser
and clicking one of the Rule Server links.
Server.java adds one method to the base class. The postApplication() method calls the
service entry point you defined in the Rule Service Definition.
/**
* Invokes a server through the entry point "postApplication"
* in the service "Data Validation".
*
* @param arg0 ==> Enter a description here
*
*/
public void postApplication(org.w3c.dom.Element arg0)
throws NdServerException, NdServiceException, NdServiceSessionException
{
// Build the argument list
Object[] applicationArgs = new Object[1];
applicationArgs[0] = arg0;

Fair Isaac Corporation Confidential and Proprietary Information 161


Chapter 9: Deployment Tutorial

// Invoke the service and returns its result, if any.


invokeService("Data Validation", "postApplication", null, applicationArgs);

The value of the Element argument is added to an Object array that is passed to the
invokeService() method, which is inherited from NdStatelessServer, along with the name
of the service and the name of the entry point. The service and entry point names correspond
to values stored in the Data_Validation.server configuration file.
Data_Validation.server is the server configuration file, and stores the configuration options
as xml values. The values conform to the settings from the Generate Deployment Wizard,
including the entry point you defined in the Rule Service Definition:
<DeployRulesServiceEntryPointConfig>
<AlwaysMapObjectsForDefaultModeRuleSets> false </
AlwaysMapObjectsForDefaultModeRuleSets>
<AlwaysMapPostedObjects> false </AlwaysMapPostedObjects>
<EntryPointId> postApplication </EntryPointId>

<SrlInvocationFunctional>
<SrlArgumentType> Element </SrlArgumentType>
<SrlName> postApplication </SrlName>
</SrlInvocationFunctional>

</DeployRulesServiceEntryPointConfig>

The static createServer() method of the Server class takes a String with the path to the
server configuration file as an argument, and returns a Server object that is instantiated with
the services defined in the configuration file, which are accessible through their entry points.
The server’s invokeService() method takes as arguments the name of the service, the
name of the entry point, and an Object array containing the entry point argument(s).
Client.java defines a simple client for the server. The constructor takes a reference to the
Server as an argument, and the postApplication() method calls the server’s
postApplication() method. There is also a private _postApplication() method that is
included as a convenience to make it easy to run and test the deployed files. The private
method is called by the run() method, which is called by the Runner described above. If you
add code to the private method that creates suitable data for invoking the server, you can use
the Runner to invoke the server.

Adding Client Code to Read the Test Data


The service entry point expects a org.w3c.dom.Element object. An Element represents an
element in an xml document. In this section, you add code to your Client class that reads in
xml files from the <ADVISOR_HOME>/tutorials /testData directory, obtains the Element
corresponding to the top AutoPolicy node in the file, and uses it to invoke the service. Your
Blaze Advisor installation includes the org.apache.xerces.parsers.DOMParser class
that you can use to read in the files.

To add the file reader code


1 In a text editor or a Java IDE, such as Eclipse, open the Client.java file that was generated
in the <ADVISOR_HOME>/tutorials/dataValidation folder.
2 Search for this text: Import Application specific code here.

Fair Isaac Corporation Confidential and Proprietary Information 162


Chapter 9: Deployment Tutorial

3 Copy and paste these import statements under //==> Import Application
specific code here:
import org.xml.sax.*;
import org.w3c.dom.*;
import org.apache.xerces.parsers.*;
import org.apache.xml.serialize.*;
import org.apache.xerces.dom.*;
4 Scroll down to the private void _postApplication() method definition.
This method body consists of comments that serve as placeholders for the code you will
add to assemble the invocation data.
5 In the Client.java file, locate this code block:
private void _postApplication()
throws NdServerException, NdServiceException, NdServiceSessionException
{
//==> Set up the invocation arguments.
//==>org.w3c.dom.Element arg0 = (value for arg0);
//==> Invoke the actual method.
//==>postApplication(arg0);
}
6 Replace the code block in the previous step with the method definition, as shown in the
following code:
private void _postApplication()
throws NdServerException, NdServiceException, NdServiceSessionException
{
//==> Set up the invocation arguments.
org.w3c.dom.Element arg0;
DOMParser parser = new DOMParser();
try {
Document topNode = null;

//==> Invoke the service with an invalid file.


//==> This should end up in the rejectedApplications folder.
String uri1 = "../testData/rs_invalid_age.xml";
parser.parse(uri1);
topNode = parser.getDocument();
arg0 = topNode.getDocumentElement();
//==> Invoke the actual method.
postApplication(arg0);
System.out.println("Invoked service with: "+uri1);

//==> Invoke the service with a valid file.


//==> This should end up in the pendingApplications folder.
String uri2 = "../testData/valid1.xml";
parser.parse(uri2);
topNode = parser.getDocument();
arg0 = topNode.getDocumentElement();
//==> Invoke the actual method.
postApplication(arg0);
System.out.println("Invoked service with: "+uri2);
} catch (Exception e) {
System.out.println(e.getMessage());
}

}
The code reads two xml files from the /testData directory. The first file,
rs_invalid_age.xml, is processed and written to the /testData/
rejectedApplications directory. However, the file name that appears is a
combination of the firstName and lastName elements in the file so the name,
rs_invalid_age.xml, becomes UnderageDriver.xml.
The second file, valid1.xml file, is processed and is written to the /testData/
pendingApplications directory. However, the file name is ClemClamity.xml. When

Fair Isaac Corporation Confidential and Proprietary Information 163


Chapter 9: Deployment Tutorial

this deployment is run, the file is updated and you can see that the timestamp for this file
is different from the other ones in the same directory.
7 Save the changes to the Client.java file.

Building and Running the Application


Before building and running the application, you need to modify the Run.bat or Run.sh file.
The rule service function that writes files to a particular directory uses an environment
variable called ADVISOR_HOME. You need to add this value to the command that starts the
application.
When you build the application, the Build.bat (for Windows) or Build.sh (for Unix) file first
checks to see if the JAVA_HOME and ADVISOR_HOME environment variables have been set. If they
have not been set you are instructed to run the setenv.bat or setenv.sh that is located in the
<ADVISOR_HOME>/bin directory. After the setenv file has been called, the JAVA_HOME setting
is used to locate your Java compiler, and the classes are compiled.

Note: The following instructions are similar for Windows and Unix; however, these
procedures are for Windows.

To modify the Run.bat or Run.sh file


1 Open the Run.bat or Run.sh file in a text editor.
2 Locate this code block in the Run.bat file:
:precompile
java Runner "./Rule_Service_Definition1_ser.server"
goto finish

:startrun
java Runner "./Rule_Service_Definition1.server"
3 Replace the code with this syntax:
:precompile
java -DADVISOR_HOME="%advisor_home%" Runner "./Data_Validation_ser.server"
goto finish

:startrun
java -DADVISOR_HOME="%advisor_home%" Runner "./Data_Validation.server"
This tutorial has not discussed the precompile option. However, it is available and you
can find information about it in the Blaze Advisor Rule Server documentation.
4 Save the modified file.

To build and run the application


1 Open a Command Prompt window and change to the <ADVISOR_HOME>\tutorials\dat-
aValidation directory.
2 At the Command Prompt window, type ..\..\bin\setenv and press Enter.
This calls the setenv batch file in the \bin directory.
3 Enter build and press Enter. You may see a warning message. This message is benign
and should be ignored.
4 At the command prompt, type run and press Enter.
5 Exit the Command Prompt window.

Fair Isaac Corporation Confidential and Proprietary Information 164


Chapter 9: Deployment Tutorial

The Results of Building and Running the


Application
The Java compiler compiles all of the .java files. If it finds any problems, you will have to
correct them and build the files again. If the errors are in the Client.java file, refer back to the
previous section and verify that the code was inserted correctly.
Once you run the deployment successfully, you should see the following lines display in the
Command Prompt window:
Invoked service with: ../testData/rs_invalid_age.xml
Invoked service with: ../testData/valid1.xml

You can also check your results by looking in the <ADVISOR_HOME>/tutorials/


testData/pendingApplications and /rejectedApplications directories. The XML
files with updated timestamps should be there.
If you want to try using some of the other files under the /testData folder, open the
Client.java file, search for .xml and replace the file names with others from the
/testData folder. You must build and run the deployment files again to see the changes.

Fair Isaac Corporation Confidential and Proprietary Information 165

You might also like