
Examples
Learn by examples.
WhatsNew:
OpenRules 6.1.3 is Available
A
new release OpenRules 6.1.3 enhances Executable
OpenRules® BDMS
with new functionality required by real-world applications.
December 20, 2011
WhatTheySay:
Forrester Research, Inc.
"OpenRules have the most-aggressive approaches to business-expert authoring
and typically requires less developer support than IBM ILOG, FICO Blaze Advisor,
and JBoss BRMS."
Market Overview: Business Rules Platforms 2011
July 5, 2011
Events
Recent Events

RuleML 2011, The 5th International Symposium on Rules, November 3-5, 2011, Fort Lauderdale, FL.
Business Rules Forum 2011, October 30 - November 3, 2011, Fort Lauderdale, FL.
Rules Fest 2011, October 24-27, 2011, Burlingame, CA
Decision Modeling Information Day - OMG Decision Modeling Notation (DMN) standard. See OpenRules' presentation.
Here are several examples that can help you quickly understand how OpenRules® represents decisions and supporting decision tables. Follow the links below to see different spreadsheets with business rules:
-
DecisionHello.xls - decision that defines customer greetings based on the time of day and customer's attributes
-
DecisionUpSell.xls - simple customer profiling and up-selling rules
-
Decision.xls, Rules.xls, Glossary.xls, Data.xls - loan pre-qualification decision
-
DecisionVacationDays.xls - decision that calculates vacations days.
A detailed description of these and other decision projects are provided in the document "Getting Started". You may also watch brief videos with simple explanations.
What you see are actually working decisions created in Excel without programming. Using the familiar Excel interface, a business analyst can enter decisions along with supporting decision tables and test cases, and then execute the decision to verify that it produces the expected results.
Below we will explain the first decision presented in the file DecisionHello.xls. It decides how to greet a customer during different times of the day. For example, if a customer, Robinson, is a married woman and the local time is 20:25, we want our decision to produce the following greeting: "Good Evening, Mrs. Robinson!"
In order to make this decision we need to make two sub-decisions:
- Define Greeting Word (e.g. “Good Afternoon”)
- Define Salutation Word (e.g. “Mrs.”)
OpenRules® provides special tables for representing decisions where each sub-decision is implemented as a Decision Table. So, first we will create an Excel table “DetermineCustomerGreeting” of the type "Decision":
| Decision DetermineCustomerGreeting | |||
| Decisions | Execute Rules | ||
| Define Greeting Word | := DefineGreeting() | ||
| Define Salutation Word | := DefineSalutation() | ||
| Print Greeting | := System.out.println(response.greeting + ", " + response.salutation + customers[0].name + "!") | ||
The first column of this table defines the decision name and the second column defines the decision table that implements the related (sub) decision. The first decision table determines a greeting word based on the current hour:
|
DecisionTable DefineGreeting |
|
|
If |
Then |
|
Current Hour |
Greeting |
|
0-11 |
Good Morning |
|
11-17 |
Good Afternoon |
|
17-22 |
Good Evening |
|
22-24 |
Good Night |
The second decision table determines a salutation word based on the customer gender and marital status:
|
DecisionTable DefineSalutation |
|||||
|
Condition |
Condition |
Conclusion |
|||
|
Gender |
Marital Status |
Salutation |
|||
|
Is |
Male |
|
|
Is |
Mr. |
|
Is |
Female |
Is |
Married |
Is |
Mrs. |
|
Is |
Female |
Is |
Single |
Is |
Ms. |
These decision tables deal with decision variables that are described in the following glossary:
|
Glossary glossary |
||
|
Decision Variable |
Business Concept |
Attribute |
|
Gender |
Customer |
gender |
|
Marital Status |
maritalStatus |
|
|
Greeting |
Response |
greeting |
|
Salutation |
salutation |
|
|
Current Hour |
hour |
|
We associate all facts with the proper business concepts like Customer and Response and their attributes. The proper concepts can be defined as Java objects, Excel tables, or XML files. Here is the their representation in Excel tables:
|
Datatype Customer |
|
|
String |
name |
|
String |
maritalStatus |
|
String |
gender |
|
int |
age |
|
Datatype Response |
|
|
String |
greeting |
|
String |
salutation |
|
int |
hour |
We may also create test cases for these data types directly in Excel:
|
Data Customer customers |
|||
|
name |
maritalStatus |
gender |
age |
|
Customer Name |
Marital Status |
Gender |
Age |
|
Robinson |
Married |
Female |
24 |
|
Smith |
Single |
Male |
19 |
|
Variable Response response |
||
|
greeting |
salutation |
hour |
|
Greeting |
Salutation |
Current Hour |
|
? |
? |
20 |
We may execute this decision from a standard Java program (that is provided and contains just two lines) and it will produce the following results:
Define Current Time
Conclusion: Current Hour is 20
Define Greeting Word
Conclusion: Greeting is Good Evening
Define Salutation Word
Conclusion: Salutation is Mrs.
Print Greeting
Good Evening, Mrs. Robinson!
The same decision can work with Java objects or it can be deployed as a web service.
You may learn more how business analyst works with subject matter expert to create more complex decisions by reading this tutorial that implements a decision for clinical guidelines.
It is also possible to use business rules that contain snippets of Java code to express their logic. The following examples show two projects that specify clinical guidelines:
- DecisionPatientTherapy.xls - a decision described at this tutorial
- HealthCareRules.xls - business rules implemented without use of Decisions
- HealthCareForms.xls - a web-based graphical interface created using OpenRules® Forms.
OpenRules® installation includes many other examples:
To learn more, please download these and other examples from here, change the rules, and run them from the provided batch-files or from your own Java code. See how complex projects with extensive rules and web components can be organized and maintained under Eclipse with OpenRules® plug-ins.
Contact us at OpenRules, Inc. with any questions, suggestions or if you need support or consulting services.






