I have three questions, re: the following line of code in Drools (LHS).

 

sd : SmartDescription(description matches "MAR(K|KE|KED)? ",
pFamilies.containsKey(SchemaConstants.CERAMIC_CHIP_CAPACITORS) ||
pFamilies.containsKey(SchemaConstants.CERAMIC_NETWORKS), description :
description, pFamilies : possibleFamilies);

 

To put it in plain English, I want to match against the regex, but only if
the rule can provide useful information (ie the two constant family id keys
are still present in the family maps).  When I put in
SchemaConstants.familyKey, it tells me I've got an unexpected token.  How
can I accomplish this?

 

Is there a way to store the regex in a local rule variable? Ie, 

String pattern = "MAR(K|KE|KED)? ";

Description matches pattern, .

 

?

 

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?

Thanks,

___________________________________________________
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to