ルール依存性に基づくクエリー
ルール間のリンクと依存性を識別することによって、ルールにフィルターを適用することができます。ルール実行が他のルールの適用性に与える影響と、他のルールの実行によりルールが受ける影響をチェックすることができます。
may select
述語 may select <a rule> は、指定ルールを選択する可能性があるルール・フローおよびルール・タスクを返します。
ルール・フローを定義する場合、明示的に、あるいはフィルター関数を使用して、ルール・タスクを構成するルールを指定できます。 ルールのオーバーライド・メカニズムによっても、ランタイムで実行するためのルールの選択方法が決定される可能性があります (詳しくは、『ルールのオーバーライド』を参照してください)。
例
次のクエリーは、「ルール 1」を選択できるルール・フローとルール・タスクを返します。
Find all ruleflows such that each ruleflow may select "Rule 1"
may enable rule
述語 may enable rule <a rule> は、指定ルールを適用可能にする可能性があるルールを返します。
例
ルール 1:
if the age of the customer is 25 then set the category of the customer to Bronze ;
ルール 2:
if the category of the customer is Bronze then give Champagne to the shopping cart of the customer with message: "Congratulations" ;
クエリー:
Find all business rules such that each business rule may enable "Rule 2"
このクエリーは、ルール 1 を返します。これは、ルール 1 が顧客カテゴリーをブロンズに設定するので、それによりルール 2 の条件が有効になるためです。
may disable
述語 may disable <a rule> は、指定ルールを適用不可にする可能性があるルールを返します。
例
ルール 1:
if the age of the customer is 18 then set the category of the customer to Copper ;
ルール 2:
if the category of the customer is Bronze then give Champagne to the shopping cart of the customer with message: "Congratulations" ;
ルール 3:
if the age of the customer equals 25 and the category of the customer is Gold then set the category of the customer to Diamond ;
クエリー:
Find all business rules such that each business rule may disable "Rule 2"
このクエリーは、ルール 1 を返します。これは、顧客カテゴリーがコッパーに設定されるとルール 1 はブロンズにはならないためです。 クエリーはルール 3 を返しません。これは、そのアクションが顧客のカテゴリーをダイヤモンドに設定することであり、また、このルールはカテゴリーが既にブロンズではない状態からのみ実行可能なためです。 そのため、ルール 3 はルール 1 を無効にしません。
may be enabled by
述語 may be enabled by <a rule> は、指定ルールによって適用可能になる可能性があるルールを返します。
例
ルール 1:
if the age of the customer is 25 then set the category of the customer to Bronze ;
ルール 2:
if the category of the customer is not Copper then set the discount of the shopping cart of the customer to 5;
ルール 3:
if the age of the customer equals 25 and the category of the customer is Bronze then set the category of the customer to Diamond ;
クエリー:
Find all business rules such that each business rule may be enabled by "Rule 1"
このクエリーは、ルール 2 とルール 3 を返します。ルール 2 は、顧客カテゴリーがコッパーではない場合、ブロンズでありうるため、返されます。 ルール 3 も返されます。これは、顧客カテゴリーがブロンズになるように条件で指定されているためです。
may be disabled by
述語 may be disabled by <a rule> は、指定ルールによって適用不可になる可能性があるルールを返します。
例
ルール 1:
if the age of the customer is 25 then set the category of the customer to Bronze ;
ルール 2:
if the age of the customer equals 25 and the category of the customer is Copper then set the category of the customer to Gold
クエリー:
Find all business rules such that each business rule may be disabled by "Rule 1"
このクエリーではルール 2 が返されます。これは、ルール 2 がルール 1 によって適用不可になるためです。ルール 1 では、25 歳の顧客のカテゴリーはブロンズに設定されているため、コッパーではありません。
ルール・エクスプローラーでルールを右クリックして以下をクリックすることで、これらのクエリーを実行できます。