Académique Documents
Professionnel Documents
Culture Documents
11/23/2016
page 1 of 22
WODM v7.5
11/23/2016
page 2 of 22
WODM v7.5
Java XOM
3.
4.
You can define a Java XOM in the New Rule Project wizard when you
create the project, or later, using the rule project Properties dialog. The
procedure is the same in each case.
To define a Java project using the Properties dialog:
In the Rule Explorer view, select the rule project, then on the Project
menu, click Properties.
In the left pane of the Rule Project Properties dialog, click Java Execution
Object Model.
11/23/2016
page 3 of 22
WODM v7.5
5.
6.
1.
2.
3.
4.
1.
2.
1.
2.
3.
Select the Java project(s) required for the XOM from the list displayed. Use
the Select All button if you want to select them all.
Click OK. The Java XOM is now defined.
To add a JAR file or a class folder:
In the Rule Explorer view, select the rule project, then on the Project
menu, click Properties.
In the left pane of the Rule Project Properties dialog, click Java Execution
Object Model.
Click the Libraries tab. The Libraries page enables you to choose JAR
files and class folders. To add JAR files that have been imported in the
Eclipse workspace, click Add JARs. This opens a dialog that enables you
to browse JAR files in the workspace.To add JAR files that are not in the
workspace, click Add External JARs. This opens a dialog that enables
you to browse the JAR files in your file system.To add class folders, click
Add Class Folder. This opens a dialog that enables you to browse
directories in the workspace. In this same dialog, you can add external
class folders by creating a folder in the workspace that you link to an
external folder in the file system.NoteBy default, the JRE library is already
in the list of libraries. This library is the same as the one used to run
Eclipse and cannot be removed. You can browse the JRE library to see the
JAR files used by this library.
Click OK.
You now need to specify the location of the source to be used to reference
a library.
To set a source location to reference a library:
On the Libraries tab, expand the item you want to set as the source and
select the Source item.
Click Edit. This opens a dialog that enables you to select a ZIP file or a
source folder from the workspace or your file system.
Java XOM entries can be ordered.
To order the entries:
In the left pane of the Rule Project Properties dialog, click Java Execution
Object Model.
Click the Order tab. This page shows a list of all selected Java XOM
entries.
Select one or more entries and use the Up and Down buttons to move
them.
Click OK.
Dynamic XOM
11/23/2016
page 4 of 22
WODM v7.5
7.
8.
5.
6.
3.
The Execution Object Model (XOM) is an object model against which rules
are executed. Business rules are written against the Business Object
Model (BOM), then translated into the ILOG Rule Language (IRL) and run
against the XOM. The rule engine evaluates the rules against the
application objects and executes them when appropriate.
In Decision Server, a XOM can be generated from native Java classes or
from dynamic classes, or derived from XML Schema Definitions (XSDs).
The word dynamic means that no native Java object is constructed or
generated. Instead, dynamic XML objects are created to represent the
instances of the dynamic classes.
A XOM generated from native Java classes is known as a Java XOM.
A XOM generated from dynamic classes is known as a Dynamic XOM.
When looking for a XOM class, the rule engine looks first in the dynamic
XOM, then in the Java XOM.
The following diagram shows the mapping between a XOM and Java
classes and dynamic classes.
11/23/2016
page 5 of 22
WODM v7.5
4.
5.
6.
7.
11/23/2016
page 6 of 22
WODM v7.5
9.
10.
Hierarchies
11/23/2016
page 7 of 22
WODM v7.5
The structure of the items that are managed in a rule project are defined by
a rule model. You can extend this rule model by adding custom properties
to the rule class or by creating a hierarchy property. A hierarchy defines a
tree of values and the hierarchical relationship between the nodes of the
tree.
Runtime rule selection can use hierarchies as a way of providing a further
filtering mechanism.
The following figure shows an example of a geography hierarchy, where
USA is the root node. A location custom property has been defined for
each rule.
The following table shows the BAL constructs that you can use to write the
runtime rule selection for the geography example:
Location property examples
BAL construct
the location of the rule is
Description
Florida
11/23/2016
page 8 of 22
WODM v7.5
11/23/2016
page 9 of 22
WODM v7.5
packages
11.
12.
Rule Designer is usually more efficient when you work with several small
or medium sized packages, as opposed to a few large packages. The
reasons for this are that:
Rule Designer loads only the required packages. If all your rule artifacts
are stored in a single package, Rule Designer must load all the rule
artifacts when you launch it. If your rules are organized into packages,
Rule Designer loads only the rule artifacts from the required packages
when you launch it.
To resolve the fully qualified name of a rule, Rule Designer navigates
through packages to find the rule. If the tree of packages is well distributed,
Rule Designer accesses the rule faster.NoteA fully qualified name is the
short name of the rule prefixed with its package name.
However, make sure that you do not have too many small packages,
because looking for rule model elements slows down Rule Designer.
7.
8.
When your rule project contains a large business object model, business
rule language-related features are slower. Parsing, checking, Content
Assist, and navigation in business rules and technical rules is slower with
large business object models.
To reduce the BOM footprint:
Reduce the BOM size by removing unused verbalizations, BOM members
and classes.When you define a BOM entry from a XOM, the BOM entry
might include a lot of technical classes and methods that are not actually
used in your rules. Because the size of the BOM has an impact on Rule
Designer performance, it is better to remove all unused business elements
from the BOM.
Split the BOM into several smaller BOMs that can be spread among your
rule projects. See Guidelines for organizing your application into rule
projects.
11/23/2016
page 10 of 22
WODM v7.5
8.
When a RuleApp archive is generated, the number and size of its rule
artifacts account for most of the resource consumption.
To reduce the resource usage cost of a business rule application:
Transform each large rule project into several smaller ones.
Keep each rule project as it is, and generate multiple smaller rulesets out
of it. You can use ruleset extractors, one per ruleset, to extract part of the
rule project. Note that in this case, you might have to change the
application that executes the rulesets.
Purpose of BOM
You use the BOM to make business rule editing user-friendly by providing
tools to set up a natural language vocabulary. With this vocabulary, policy
managers can describe their business logic in a business rule language.
A BOM contains the classes and methods that rule artifacts act on. As an
object model, the BOM is very similar to a Java object model. It consists of
classes grouped into packages. Each class has a set of attributes,
methods and, possibly, other nested classes.
BOM-to-XOM mapping defines the correspondence between the BOM and
the Execution Object Model (XOM) used at runtime.
11/23/2016
page 11 of 22
WODM v7.5
Dissecting a BOM
Navigation and Action Phrases
13.
14.
15.
You can define several navigation or action phrases for a BOM element, so
that rule authors can use different wordings while using the same method
or attribute.
To add a phrase to a method:
In the Member Verbalization section of the BOM Editor, click either Create
a navigation phrase or Create an action phrase. The phrase appears in
the list of phrases. A warning might appear because the new phrase is
defined with the default verbalization. If you already have the default
verbalization for an existing phrase, there is a conflict because you should
not define the same verbalization twice in the vocabulary.
Click the phrase to expand it, and then in the Template field edit the
verbalization.
Save the BOM.
You can now use the phrase in your business rules.
Categories
A category is an identifier that you can assign to business rules and certain
11/23/2016
page 12 of 22
WODM v7.5
16.
17.
In th
is...
any
any
visib
any
another category
visib
another category
any
visib
category1
visib
category2
visib
visib
hidd
Example
In your Business Object Model, you have a Car class with a category
vehicle. You also have a rule project that contains a business rule
11/23/2016
page 13 of 22
WODM v7.5
Similarly, if the Car class has a member with a category other than
vehicle, you cannot use this member in the conditions and actions for
CarRentalRule, even though you can define a variable of the Car type
in the definition2s part of the rule.
Domains
A domain places a restriction on type elements in the BOM. You can set a
domain on classes, attribute types, method return types, and arguments.
The main domains include:
Static domains, comprising Literals, Static references, Bounded,
Collection, and Other domain types.
Dynamic domains, with values stored in an Excel file or set by the
execution of Java code.
Enumerated domains, comprising Literals, Static references, and
Dynamic domain types.
Complex domains, comprising Bounded, Collection, and Other
domain types.
Note
Not all kinds of BOM domain are enforced in BAL rules or other business
rules. Business rules use only enumerated domains (literal, static
11/23/2016
page 14 of 22
WODM v7.5
9.
10.
11.
Bounded
A bounded domain specifies an interval between two bounding values,
such as [0,120].
In the Rule Designer BOM editor, when defining a bounded domain on an
integer attribute, you can specify the * (asterisk) character as the lower or
upper bound of the domain. When you specify *, the bound value is
replaced in the corresponding .bom file by -2147483648 for the lower
bound, or 2147483647 for the upper bound. These values correspond to
Integer.MIN_VALUE and Integer.MAX_VALUE, respectively.
Note
Bounded domains are not enforced at business rule level.
Collection
A collection domain specifies the cardinality and the type of collection
elements, for example, 0,*classCustomer.
If you have members of type java.util.Collection, set a collection
domain on these members for them to be automatically considered as a
collection in business rules. You can also create, add, and remove
methods for the items in the collection domain using the BOM Editor.
For more information, refer to Collections.
11/23/2016
page 15 of 22
WODM v7.5
Dynamic
9.
10.
You can populate a domain in the BOM dynamically from a data source,
and then synchronize the data source and the domain.
A dynamic domain is an enumerated domain with values from an Excel file
or set by the execution of Java code.
You define a dynamic domain in the BOM editor:
To create dynamic domains with values extracted from an Excel file, see
Creating dynamic domains from Excel .
To create dynamic domains with values extracted from other data sources,
see Creating dynamic domains.
Note
You can create a dynamic domain only on a BOM class.
Literals
A domain set as an enumeration of literals specifies a list of values, for
example, {1,2,3}.
Static references
4.
5.
Other
The other domain types were introduced to support most domains coming
from the XML binding. In an XML schema, you can define pattern domains
(even for numbers) and simultaneously an enumeration. You can also
define pattern domains or intersection of domains in the business object
model.
You can define other types of domains using the syntax of regular
expressions. For example, you can define a pattern for Strings as follows:
"a*n"
You can define an intersection of domains as follows:
({1, 3, 5, 7, 9}, [0,6])
11/23/2016
page 16 of 22
WODM v7.5
Note
Other domains are not enforced at business rule level.
o You can add new rows to a decision table and fill in its cells to
11/23/2016
page 17 of 22
WODM v7.5
Decision trees
Decision trees provide an alternative and more convenient way of viewing
and managing large sets of business rules, especially when these rules
are not symmetric.
Large sets of nonsymmetric rules may be easier to understand using
decision trees, where the path from the first condition to the end of the
actions along any branch corresponds to one rule.
Looking at the following figure, you can see that decision trees are easy to
use once you understand that:
A condition is declared in its diamond-shaped node
.
The possible values for the condition are represented by
branches
.
The actions are declared at the end of each branch
.
Technical rules
Technical rules are written using the ILOG Rule Language (IRL). IRL is a
Java-like rule language that can be executed directly by the rule engine.
A technical rule is made of a condition part and an action part.
The condition part, which begins with the keyword when,
11/23/2016
page 18 of 22
WODM v7.5
BAL
You use constructs to build rules. You use operators to perform arithmetic
operations, associate or negate conditions, and compare expressions. You
use literals to declare values as being of a particular type. You use
punctuation to structure rules, avoid ambiguity, and provide clarity.
11/23/2016
page 19 of 22
WODM v7.5
Functions
A function can be created in a rule project in order to share code
procedures across more than one element of a ruleset. A function is
expressed in ILOG Rule Language (IRL) and its code is evaluated when
the ruleset executes.
A function can be called either from the action part of a rule, from another
function, or from an action task of a ruleflow.
You can add as many functions to the rule project as you like. The code
that you write in a function in Rule Designer is mapped to the IRL
function keyword.
Functions can be used to set up the working memory when testing ruleset
execution.
The function is composed of a header and a statement part.
The header contains the function return type and its signature. A function
signature consists of the function name and an argument list. This list can
be either empty or composed of pairs: the argument type and name,
separated by commas.
function returnType functionName (argumentList)
{
code
}
The statement part can contain any action statements, just as in the action
part of a rule, plus a return statement.
You use return to exit from the current function. The flow of control
returns to the statement that follows the original function call. The return
statement has two forms: one that returns a value and one that does not.
To return a value, simply put the value (or an expression that calculates the
value) after the return keyword:
return ++count;
11/23/2016
page 20 of 22
WODM v7.5
The data type of the value returned by return must match the type of the
functions declared return value. When a function is declared void, use the
form of return that does not return a value:
return;
Specify the name, type and (optionally) the initial value of the ruleset
variable.
If you do not want the ruleset variable to be visible from business
rules, delete the default verbalization from the Verbalization column.
Otherwise, modify the verbalization.
The ruleset variable is now defined and you can start using it in business
rules.
11/23/2016
page 21 of 22
WODM v7.5
11/23/2016
page 22 of 22