我想使用決策表基於流水線中越來越小的值實現簡單的規則。如何在drools中使用決策表實現更少和更多的規則?
這是很容易實現DRL的規則,例如:
rules "less than"
when Example(value < 10)
then
System.out.println("Less than 10")
end
rules "equals"
when Example(value = 10)
then
System.out.println("Equals 10")
end
rules "greater than"
when Example(value > 10)
then
System.out.println("Greater than 10")
end
但我怎麼能在Drools中它轉化爲決策表?到目前爲止,我所看到的所有例子都是在條件單元中完成比較。甚至有可能在價值單元中進行比較?
我見過的所有例子都是格式:
CONDITION | ACTION
Example |
value |
-----------------------------------|-------------------------------------
10 | System.out.println("equals to 10")
但只適用於1條規則,並執行以下完全有不同的含義:
CONDITION | CONDITION | CONDITION | ACTION
Example
value | value > $1 | value < $1 |
-----------+------------+------------+----------------
10 | 10 | 10 | ???
甚至可以做下列?
CONDITION | ACTION
Example |
value |
-----------------------------------+----------------------------------------
10 | System.out.println("equals to 10")
> 10 | System.out.println("greater than 10")
< 10 | System.out.println("less than 10")
什麼是實施這些規則的正確方法?
我們可以絃樂做同樣的比較。我嘗試過,但不斷出現錯誤。 –