如果集合沒有特定的對象,我需要激發規則。在集合中不存在流口水
AuditAssignment可作爲問題的事實。
AuditAssignment有一個屬性「requiredSkill」
審計任務有一個屬性「審計師」
審計對象有「資格」的名單,這是「requiredSkill」的集合
現在,我需要檢查,如果auditassignment對象中的核數師的資格有requiredSkill
下面是我試過,但不起作用樣品規則。
rule "checkIfAuditSkillIsMatching"
when
$auditAssignment : AuditAssignment($neededSkill : requiredSkill.getSkillCode())
$auditor : Auditor($auditorSkills : qualifications)
not exists (Skill (skillCode == $neededSkill) from $auditorSkills )
then
System.out.println(" **** " + $neededSkill);
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
我曾嘗試下面的一個以及
rule "checkIfAuditSkillIsMatching"
when
$validAuditorCount : Number (intValue < 1 ) from accumulate (
$auditor : Auditor($auditorSkills: qualifications)
and exists AuditAssignment(auditor == $auditor ,
$auditorSkills.contains(requiredSkill)) ,
count($auditor)
)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
感謝。會嘗試一下。 – lives
對不起 - 我覺得我沒有正確說明問題。我已經重寫了這個問題 – lives