我不明白这段drl
代码的一些部分,但我将在这里发布一个问题:
完整的 drl 代码在这里:
package org.kie.kogito.queries;
unit LoanUnit;
import org.kie.kogito.queries.LoanApplication;
import org.kie.kogito.queries.AllAmounts;
rule SmallDepositApprove when
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount <= 2000 ]
then
modify($l) { setApproved(true) };
end
rule SmallDepositReject when
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount > 2000 ]
then
modify($l) { setApproved(false) };
end
rule LargeDepositApprove when
$l: /loanApplications[ applicant.age >= 20, deposit >= 1000, amount <= maxAmount ]
then
modify($l) { setApproved(true) };
end
rule LargeDepositReject when
$l: /loanApplications[ applicant.age >= 20, deposit >= 1000, amount > maxAmount ]
then
modify($l) { setApproved(false) };
end
rule NotAdultApplication when
$l: /loanApplications[ applicant.age < 20 ]
then
modify($l) { setApproved(false) };
end
query FindApproved
$l: /loanApplications[ approved ]
end
query FindNotApprovedIdAndAmount
/loanApplications[ !approved, $id: id, $amount : amount ]
end
rule AllAmounts
when
accumulate ( $a : /loanApplications ; $sum : sum($a.amount))
then
allAmounts.add(new AllAmounts($sum));
end
query FindAllApplicationAmounts
$a : /allAmounts
end
modify($l) { setApproved(true) };
我已经看到了update
在其他 drl 文件中的使用。modify
和有什么区别update
?是否有修改过的链接文件?