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
Show replies by date