10

ルール間に階層(実行の順序だけでなく)を定義し、ルールの実行を制御する方法があるかどうか疑問に思いました。つまり、親ルールが実行された場合、以下のルールは評価されるべきではありません。

このスレッドの情報はオプションですが、基本的にはIF / THEN/ELSEです。

別のオプションはありますか?

ありがとう

4

1 に答える 1

15

I am not sure if I understand your question, but using a combination of Activation Groups and the traditional conflict resolution strategies might achieve what you need. For instance, lets say you have 3 rules, A, B and C. You want to use, lets say, salience to give priority of execution to them in that order, and once one is executed, no other rule in that group should execute. You can define them like this:

rule A
    salience 30
    activation-group "x"
...

rule B
    salience 20
    activation-group "x"
...

rule C
    salience 10
    activation-group "x"
...

The salience guarantees that if A activates, it will fire first, followed by B, followed by C if they were activated. The Activation Group guarantees that once one of the rules fire, all other activated rules in that group will be cancelled. So, lets say that in your session, rules B and C activate, but not A, then B will fire and C will be cancelled.

Please note that activation groups do not prevent rules from later being re-activated. It just cancels any activations currently in the agenda at the time one of the rules in the group fire.

于 2012-06-01T16:23:01.790 に答える