[rules-users] How to write a rule that fires when it matches against specific facts in working memory.

Wolfgang Laun wolfgang.laun at gmail.com
Thu Jan 27 05:10:33 EST 2011


2011/1/27 Bruno Freudensprung <bruno.freudensprung at temis.com>
>
> Hi,
>
> I finally noticed a "forall" keyword that might be useful (see section "5.1.4.1. Syntax of templates").
> Maybe can you try something like:
> [forall(&&){Option(code == $)}]

This must be written as
   forall(){Option(code == "$")}
so that
   P1,P2,P3
yields
   Option(code == "P1")  Option(code == "P2")  Option(code == "P3")


But there's no way to produce the various binding variables that are
required for writing the "not" CE, as in

   $o1: Option(code == "P1")  $o2: Option(code == "P2")  $o3:
Option(code == "P3")
   not Option( this != $o1, this != $o2, this != $o3 )

And even if there were, this would require two columns, which is clumsy.

accumulate with a special function is the best approach.

-W



>
>
> Bruno.
>
> Bruno Freudensprung a écrit :
>
> Hi Gurvinder,
>
> I've just taken a look at chapter 5.1 of Drools Expert about decision
> tables but I've been unable to find out how to do that.
> If you find a solution, could you please post it here? I'm pretty sure I
> will need that as well ;-).
> Best regards,
>
> Bruno.
>
> groovenarula a écrit :
>
>
> Thanks for the options, Bruno and Wolfgang.
>
> But is there a more 'generic' way to do the matches ? The problem I have is
> that the # of instances that might match could vary. And I have to provide a
> means for the business users to be able to provide that 'option's code'
> using a decision table. Basically I need to be able to provide a construct
> that's would look something like :
>
>     Options
>     "P1,P2"
>     "P1,P4,P5"
>
> So in the above decision table had 2 rules where in the first row represents
> a rule that matches against Options with Codes P1 and P2. And the second
> rule would match against options with codes P1, P4 and P5.
>
> Is it possible to represent this using Drools decision tables ?
>
> Thanks
> Gurvinder
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> 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