[rules-users] Three questions

Brian Trezise Brian.Trezise at intellidata.net
Mon Feb 11 17:46:25 EST 2008


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
brian.trezise at intellidata.net

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080211/b5567ac2/attachment.html 


More information about the rules-users mailing list