[rules-dev] Enhancing the usefulness of FOL clauses, take 2

Wolfgang Laun wolfgang.laun at gmail.com
Tue Sep 21 10:30:18 EDT 2010


Observe:

rule "Bill Status"
salience 100
when
    p :- exists Bill( paid == true )
then
    System.out.println( "There are " + (p ? "some" : "no") + " paid bills."
);
end

rule "Pay Bills"
when
    $bill: Bill( paid == false )
then
    System.out.println( "Paying " + $bill.getAmount() );
    modify( $bill ){ setPaid( true ) }
end

There are three unpaid Bills inserted, then fireAllRules():
There are no paid bills.
Paying 3000
There are some paid bills.
Paying 2000
Paying 1000

-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20100921/a24b9901/attachment.html 


More information about the rules-dev mailing list