Hi,
We need to generate drl file from a template. Since the format
of the rules parameters doesn’t fall very well within decision table
concept (the parameters are not ‘homogeneous’, so each row in the
input excel table can mean different things), we decided to define the rules by
automatically generating drl files from a set of templates. To cover more cases
with a single template we’d need to bind every field of column by
default, even if the binding would not be used.
For example (Freemarker syntax is used in the template below):
Rule ${ruleId}
When
Record ( $account : account
${operation} ${value} )
….
Then
…..
End
In the example above, ‘operation’, ‘value’
and ‘ruleId’ are objects in the data model that we merge with the
template. One case of the rule would be when both ‘operation’ and ‘value’
are empty strings. This will result in this LHS: Record ( $account : account ).
Another case might be when ‘operation’ is ‘==’ string
and ‘value’ is ‘1’: Record ( $account : account == 1
).
The above is a simplified template to demonstrate the point.
The real business data model for facts (Record object) would have around 10
fields and we can have ~ 5 to 10 columns per rule. I wonder what kind of
performance implications does field binding bring? Are there any or this is
being optimized / filtered out by some preprocessor?
In other words, is there significant difference in
performance for the following LHS expressions:
1) Record ( $account : account, $name : name == ‘xxx’,
$balance : balance > 100, ….)
Vs
2) Record (name == ‘xxx’, balance > 100, ….)
Providing the functionality of both of these LHS expressions
is the same and field bindings in LHS #1 are never used throughout the rule.
Thanks,
Vlad