[rules-users] Using Drools as a glorified Hashmap

Wolfgang Laun wolfgang.laun at gmail.com
Tue May 18 07:29:46 EDT 2010


If I understand the chemistry correctly, the relation
  mayUse( Drug, Presc ) -> Boolena
must be implemented.

Then, the Facts are pairs of MayUse<Drug, Presc>. To see whether it's valid,
you insert a Fact IsValid containing just the two. If a rule can match
the IsValid to a MayUse, then it's valid and IsValid is retracted. If a
low-salience rule matches just IsValid it's not valid. Or you write the
complementary rule.

-W



On Tue, May 18, 2010 at 11:56 AM, djb <dbrownell83 at hotmail.com> wrote:
>
> Hi Drools users,
>
> I've got a situation where I've got a list of Drug codes which can only be
> used for certain prescription codes.
>
> The traditional method for implementing this is to simply pre-load the
> values in a static Hashmap.  Then if get() returns null, it is not a valid
> combination.  O(1), blazingly fast.
>
> The issue with using Drools for this, is that Drools can match a code to a
> code, and mark it as valid, but cannot call it invalid, as another rule may
> still be relevant.  Therefore, using Drools for this would require marking
> combinations as valid, and afterwards, doing a linear traversal of the
> prescriptions to see if there are any combinations that are not valid.
>
> Is this the case?  I would like to try implement it in Drools just for the
> sake of consistency, but it seems a bit of a hack.
>
> Thanks,
> Daniel
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Using-Drools-as-a-glorified-Hashmap-tp825851p825851.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list