Hey Daniel,

My suggestion was that a single default rule could be fired to indicate that the prescription was invalid if all the matching rules failed to create a valid match. 

Example:

- Match Rule 1, Salience 50, Activation-group Match Rules

- Match Rule 2, Salience 50, Activation-group Match Rules

- Match Rule 3, Salience 50, Activation-group Match Rules

- Match Rule 4, Salience 50, Activation-group Match Rules

- Match Rule 5, Salience 50, Activation-group Match Rules

- Match Rule 6, Salience 50, Activation-group Match Rules

- Match Rule 7, Salience 50, Activation-group Match Rules

- Match Rule 8, Salience 50, Activation-group Match Rules

- Match Rule 9, Salience 50, Activation-group Match Rules

- No Match Rule 1, Salience 0, Activation-group Match Rules

Activation-group allows only one rule to fire from all the rules sharing that activation-group.  By putting a positive salience (priority) on all the match rules, if any one of them matches, thats all that can fire per the activation-group.  However, if the No Match rule is fired, that means that the prescription was not matched by any of the match rules.  It is a default.  The rule can be as simple as:

Rule No Match

salience 0

activation-group Match Rules

When

  Eval(true) // Always true

Then

  Do your no match logic

End

The activation-group is doing your heavy lifting, so to speak.

jp

------------------------------------------------------------------------------------------------------------

Message: 3

Date: Wed, 19 May 2010 06:20:39 -0700 (PDT)

From: djb <dbrownell83@hotmail.com>

Subject: Re: [rules-users] Using Drools as a glorified Hashmap

To: rules-users@lists.jboss.org

Message-ID: <1274275239719-829059.post@n3.nabble.com>

Content-Type: text/plain; charset=us-ascii


Hi John, Wolfgang,

Thanks for your suggestions.  Though I didn't use either of your suggestions

as described, it helped me work it out.  I added tokens describing the

prescriptions, then as they are matched (using RETE), the tokens are

retracted. Then any tokens left over are invalid.  It is probably as fast as

a HashMap.  I don't think John's solution would have worked, because no

single rule can determine whether a prescription is invalid.

Regards,

Daniel

--

View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Using-Drools-as-a-glorified-Hashmap-tp825851p829059.html

Sent from the Drools - User mailing list archive at Nabble.com.