After you create IBM® Operational Decision Manager (ODM) rules, you can convert the rules to IBM Streams
Processing Language (SPL) from the command-line or from Streams Studio.
Before you begin
You must run the
streamsprofile.sh script to configure your environment
before you can convert your
ODM rules to
SPL.
Procedure
You can generate SPL code from the command line or from Streams Studio:
- To generate the SPL code from the command line, run the rulescompiler command. At a minimum you must specify the following parameters:
| Required parameters |
Description |
| -ruleproj, --ruleproject
ruleProject |
The rule project to compile. Specify the fully qualified path of the rule project. |
| -splproj, --splproject
splOutputProject |
The destination SPL project. Provide the fully qualified path of the SPL project that will contain the generated artifacts. |
You can also specify the following parameters:
| Optional parameters |
Description |
| -bkp, --backup |
Directs the compiler to create backups of all of the files that should be overwritten. |
| -func, --genfunc |
Generates function definitions from XOM. |
| -help |
Provides details about the options that can be specified. |
| -norup, --noruleupdates |
Disables the dynamic runtime rule update capability in the generated SPL code. |
| -ns, --namespace
namespace |
Namespace for the generated SPL composites, types, and functions. |
| -ofile,
--outputfileoutputfile |
Set the name of the output file. By default, this is the name of the ruleset or
ruleflow. |
| -op, --operation
operations |
Select the operations to compile. |
| -opt, --optimizecond |
Optimize condition testing in rules. |
| -overwrite, --overwrite |
Use this setting with caution. This setting overwrites destination files. The compiler
fails if this option is not specified and destination files already exist.
|
| -pkg, --usepackages |
Split ruleset by package into different operators. |
| -ruleflow
ruleflow |
The ruleflow to compile. |
| -types, --gentypes |
Generate type definitions from the business object model (BOM) |
- To generate the SPL code from Streams Studio:
- Right-click on the rule project that you want to convert to SPL and select Generate SPL Source Files.
- Ensure that the correct rule project is selected:
- Optional: In the Rule Flow field, select the rule flows to compile. The generated SPL source files will contain code to replicate the selected rule flows in SPL.
- Optional: If you are working with a decision service rule project, select operations from the project in the Operations to Compile field.
- Specify the destination SPL project.
- Optional: Specify the SPL namespace for the destination project.
- In the Options section, specify how you want the SPL code to be generated.
- Click Generate to generate artifacts into the destination project.
Results
Note: If you specified one or more ruleflows, the resulting SPL code will contain Barrier(...) operators for ruleflow join nodes in which the
branches are joined. Because the OUT and IN_OUT parameters can be
changed on any branch, output assignments in the Barrier(...) operator call to a
merge(...) function. By default, the function returns the elements of the first
branch. You can edit this function to change the default behavior.