Brian, let me take a stab at answering your questions.
On Feb 11, 2008 5:46 PM, Brian Trezise <Brian.Trezise(a)intellidata.net> wrote:
When I put in
SchemaConstants.familyKey, it tells me I've got an unexpected token.
That's because Drools's LHS do not allow function calls.
"containsKey()" is a function call.
Drools cannot guarantee how often left-hand sides are evaluated, so to
rule out side-effects, function calls are forbidden altogether.
Providing an operator to test for containment in a map's keys is
another improvement request I submitted, please add a comment to
http://jira.jboss.org/jira/browse/JBRULES-1457 if you need that too.
If your map does not contain NULL values, you can use the MVEL
operator [] like so:
pFamilies[SchemaConstants.CERAMIC_CHIP_CAPACITORS] != null
Is there a way to store the regex in a local rule variable? Ie,
String pattern = "MAR(K|KE|KED)? ";
Description matches pattern, …
I'm not aware of local variables (though they would certainly be
useful, maybe similar to Scheme's let) - To avoid clobbering the code
with literals like that, I usually put them into Java code, e.g.
Utils.Patterns.MarkedPattern = "MAR(K|KE|KED)?";
Finally, this is a rather long line, is there a way to split apart the
testing of the map condition from the match condition into a separate part,
to let it match the .containsKey on a separate line?
Newlines should not be significant.
- Godmar