Rule Builder > Setting Up the Execution Object Model > Working With the Deployer > Setting a Ruleset Extractor Class |
Setting a Ruleset Extractor Class |
PREVIOUS NEXT |
The Rule Builder allows you to specify the repository elements that are extracted in your ruleset in one of the following ways:
This section has the following subsections:
The default ruleset extractor uses the working version of all the rules in the project. With this extraction behavior, the working version is seen as the "active" version of a rule. The rules are placed in a ruleset per top rule package. The packetAsPackage
property can be used to specify rule packets in the ruleset based on the package structure.
Some applications may require different behavior and a custom ruleset extractor. A custom ruleset extractor could, for example, take the last nonworking version of a rule corresponding to an "approved" version, while the working version could represent the "currently being developed" version. When you start the Rule Builder, the current default ruleset extractor is automatically set and displayed in the lower part of the Deployer Settings dialog box as shown in Figure 18.5. There are no operations to carry out unless you want to change the default value.
The package structure enables business rules to be organized into a logical structure for the rule writers. This is not necessarily the same organization of the execution rules in a ruleset. This means that there is not always a one-to-one correspondence between packages and rulesets, and sometimes you must explicitly specify the mapping of a project to a ruleset. Ruleset extraction is typically based on the value of custom properties, such as the expiration date or the status.
The rules of a ruleset can be grouped into tasks that are contained in a ruleflow, and which set the execution order based on properties.
The Rule Builder uses the project ruleset extractor for all the operations that require a ruleset to be generated. These are:
.irl
or .xrl
file
When you create a project in the Rule Builder, this project is automatically associated with the default ruleset extractor. There is only one ruleset extractor per project, as shown in Figure 18.6.
The default ruleset extractor directly maps the top-level package to a ruleset, that is, to a set of execution rules. For compatibility reasons, the name of the generated ruleset is the name of the top-level package, and the name of an execution rule in the ruleset is the fully qualified name of the original business rule, without the name of the top-level package.
In the case where rules from different top-level packages are mixed into one ruleset, you can allow execution rules to be generated with a fully qualified name including the name of the top-level package, by customizing IlrDefaultIRLExtractor
.
To define a ruleset extractor, you need to write a Java class that implements the IlrIRLExtractor
interface with methods that take the repository as an argument and return the information needed to build a ruleset: ruleset name, list of rules, and so on. For more information, refer to the Java API Reference Manual.
In the Ruleset Extractor Class panel of the Deployer Settings dialog box:
IlrDefaultIRLExtractor
class.
A query can be used to specify the rules to be extracted. If the query condition is true and the action "insert as query result" is set when you extract rules, only the rules that match the query elements are extracted into a ruleset for deployment.
This operation requires the Query plug-in installed.
To extract rules, proceed as follows (a sample query is provided):
For each business rule
such that priority is high
Do
Insert as query result
Your query should look like Figure 18.8.
extractionQuery
field to Rules to Extract in the Property Sheet as shown in Figure 18.9.
Engine Explorer | Project Explorer | Queries | Ruleflows | Setting Up Ruleset Imports | Exporting a Ruleset | Business Rule Checks | Rule Editor Shortcuts | Testing the Execution of a Ruleset | Setting the Classpaths | Setting a Ruleset Extractor Class | Exporting a Ruleset
Customer Support | Copyright © 1987-2004 ILOG S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |