クエリー条件

クエリー条件は、検索用に定義する基準です。

クエリー条件は、クエリーの Find 部分の下に表示されます。

デフォルトでは、クエリーの実行対象はビジネス・ルールですが、ほかのタイプのプロジェクト・エレメント、例えばフォルダー (ルール・パッケージ)、ルール・フロー、 変数セットなどに対してもクエリーを実行できます。

最初に、クエリーの実行対象となるプロジェクト・エレメントのタイプを選択します。次に、such that ステートメントとそれに続く条件ステートメントという形式でフィルターを追加して、クエリーを調整することができます。

例

Find all business rules
   such that the creator of each business rule is me
   and the creation date of each business rule is after 3/23/2016

such that ステートメントを使用してさまざまなプロジェクト・アイテム (以下) をフィルター処理し、クエリーを調整できます。

注:

現在のセッションでどのルールが変更されたか識別したり (after my login time でクエリー)、自分が変更したルールを識別したり (creator is me でクエリー) することができます。

プロパティーによるフィルター処理

クエリー対象のプロジェクト・エレメントのプロパティーのいずれかに従ってクエリーをフィルター処理できます (ルール・プロパティー を参照)。

例えば、以下のクエリーでは状況が new のビジネス・ルールのみが表示されます。

Find all business rules
   such that the status of each business rule is new

ビジネス用語によるフィルター処理

ルールの条件とアクションで使用するビジネス用語に従ってクエリーをフィルター処理できます。このタイプのフィルターは、例えばポリシーの変更によって影響を受けるルールを検索する場合に便利です。

Find all business rules
   such that each business rule modifies the value of the insurance rate

次のクエリーのコンストラクトでは、ビジネス用語を使用または変更するルールを検索します。

は~の値を使用する

特定のビジネス用語の値を使用するルールを返します。

例

次のクエリーは、ローンの等級値を使用するすべてのビジネス・ルールを返します。

Find all business rules
   such that each business rule uses the value of the loan grade in 'a report'
の句を使用する

特定のビジネス用語を呼び出すルールを返します。

例

次のクエリーは、「レポートの企業スコアに追加する」を使用するすべてのビジネス・ルールを返します。

Find all business rules
   such that each business rule uses the phrase [ add 'a number' to the corporate
   score in 'a report' ]
句~を使用する ... ここで

制約が適用される特定のビジネス用語を呼び出すルールを返します。

例 1

次のクエリーは、'借り手' のクレジット・スコアに '数値' を設定し、その数値が 100 に等しい用語を呼び出すすべてのビジネス・ルールを返します。

Find all business rules
   such that each business rule uses the phrase [ set the credit score of 'a borrower' 
 to 'a number' , where 'a number' equals 100 ]

このクエリーは、次のルールを返します。

if the age of 'the borrower' is 30
then set the credit score of 'the borrower' to 100;

例 2

次のクエリーは、'借り手' に割引 '数値' を与え、その場合の '借り手' クレジット・スコアが 200 以下の用語を呼び出すすべてのビジネス・ルールを返します。

Find all business rules
   such that each business rule uses the phrase [give the discount 'a number' to 'a borrower' where 
the credit score of 'a borrower' is at most 200]

制約に記述されているエレメントが出現しないルールがあると、そのルールが返されます。次のルールでは、'借り手' のカテゴリーはゴールドである、という事実は、'借り手' のクレジット・スコアが 200 以下である可能性を除外しません。

このクエリーは、次のルールを返します。

if the category of 'the borrower' is Gold then give the discount 10 to 'the borrower';

このクエリーは、次のルールは返しません。

if the credit score of 'the borrower' equals 300 then give the discount 10 to 'the borrower';
の値を変更する

特定のビジネス用語を変更するルールを返します。

例

次のクエリーは、保険料率を変更するすべての意思決定表を返します。

Find all decision tables
   such that each decision table modifies the value of 'the insurance rate'

実行時のルールの振る舞いによるフィルター処理

ルールのセマンティクス、つまりルールの実行中の振る舞いに従って、クエリーをフィルター処理できます。 このタイプのフィルターは、特定の条件が真である、または真になるときに適用できるルールを検索します。 このフィルターは、ルールの実行に適用される条件をテストし、それらが予期したとおりに振る舞うことを確認するために役立ちます。

次のセマンティック・クエリー・コンストラクトを使用することができます。

を適用できる

条件部分がクエリー条件を満たすことができる、すなわち、ルール条件にクエリー条件と矛盾するものがない、すべてのルールを返します。その結果、このクエリーは、クエリー条件に特に該当しない条件のあるルールも返します。

例

表 1. ルールの例のリスト
ルール ルールの内容
ルール 1 If the score of the borrower is at least 10 then...
ルール 2 If the age of the borrower is at least 21 then...
ルール 3 If the score of the borrower is less than 10 and the age of the borrower is more than 35 then...

クエリー 1:

Find all business rules
   such that each business rule may apply when the score of the borrower is 20 

このクエリーは、ルール 1 とルール 2 を返します。ルール 1 が返される理由は、借り手のスコアが少なくとも 10 であるなら、20 である可能性もあるためです。ルール 2 が返される理由は、ルール 2 には、この条件が適用されないことを明確に記述するものが何もないため、借り手のスコアは 20 である可能性もあるためです。ルール 3 は返されません。理由は、ルールが適用されないことを明確に記述する条件 (スコアは 10 未満) が含まれているためです。

クエリー 2:

Find all business rules
   such that each business rule may apply when the score of the borrower is 5
 

このクエリーは、ルール 2 とルール 3 を返します。クエリー条件に「スコアが 10 未満」と設定されているため、ルール 1 は該当しません。 ルール 2 は、スコアが 5 であることを明確に否定していません。ルール 3 は、少なくとも 1 つの条件が該当し、もう一方の条件ではスコアが 5 であるという事実が否定されていません。

時に適用可能となる

条件部分がクエリー条件に該当するルールのみを返す、さらに特化したクエリーです。このクエリーは、クエリー条件に特に該当しない条件のあるルールは返しません。

例

表 2. ルールの例のリスト
ルール ルールの内容
ルール 1 If the category of the customer is Platinum then...
ルール 2 If the category of the customer is not Platinum then...
ルール 3 If the age of the customer is at most 65 then...
ルール 4 If the age of the customer is at most 65 and the category of the customer is not Platinum...

クエリー 1:

Find all business rules
   such that each business rule may become applicable when the category of
   'a customer' is Gold 

このクエリーは、ルール 2 とルール 4 を返します。ルール 2 は、顧客カテゴリーが Platinum ではない場合、Gold でありうるため、返されます。 ルール 4 も同じ理由で返されます。 顧客の年齢に関する追加条件は、カテゴリーがゴールドであるという条件に反しません。

ルール 1 は顧客カテゴリーがプラチナとなっているのでゴールド・カテゴリーには該当せず、クエリーから返されません。 クエリーは顧客カテゴリーがゴールドのときに適用可能となるルールを検索するので、顧客の年齢はこのクエリーには該当せず、ルール 3 も返されません。 言い換えると、ルール条件は顧客カテゴリーがゴールドであることに影響を受けません。

クエリー 2:

Find all business rules
   such that each business rule may become applicable when [the age of
   'a customer' is at least 21] 

このクエリーではルール 3 は返されません。理由は、このクエリーが探しているのは顧客年齢が 21 を超えた場合に適用可能に「変わる」ルールであるためです。ルール 3 は、顧客年齢が 21 未満の場合でも適用可能です。そのため、ルール 3 は適用可能に「変わる」ことはありませんが、顧客年齢が 21 未満から 21 以上に変わっても適用可能「のまま」となります。

の状態に導く可能性あり

実行時にクエリー条件に一致する結果を表示するルールを返します。 このクエリーは、ルールの条件部分とアクション部分の両方を考慮します。 ルールの及ぼす影響を基に、ルールにフィルターを適用します。 そのため、クエリー条件に影響を及ぼさないルールは返されません。

例

表 3. ルールの例のリスト
ルール ルールの内容
ルール 1 If the age of the borrower is at least 25 then set the credit score of the borrower to 60
ルール 2 If the age of the borrower is more than 18 and less than 25 then set the credit score of the borrower to 20

クエリー:

Find all business rules
   such that each business rule may lead to a state where the credit score of
   the borrower is more than 50

このクエリーは、ルール 1 は返しますが、ルール 2 は返しません。これは、借り手の年齢がチェックされてクレジット・スコアが設定されると、ルール 1 のみが 50 を越す結果を示します。

実行時のルールの影響によるフィルター処理

リンクとリンク間の依存関係を識別することによって、ルールをフィルター処理することができます。ルール実行が他のルールの適用性に与える影響と、ルールが他のルールの実行によって受ける影響をチェックすることができます。

は~を選択する可能性がある

指定ルールを選択できるルール・フローとルール・タスクを返します。

例

次のクエリーは、「ルール 1」を選択できるルール・フローとルール・タスクを返します。

Find all ruleflows
   such that each ruleflow may select "Rule 1"
は~を有効にする可能性がある

指定ルールを適用可能にするルールを返します。

例

表 4. ルールの例のリスト
ルール ルールの内容
ルール 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 の条件が有効になるからです。

は~を無効にする可能性がある

指定ルールを適用不可にするルールを返します。

例

表 5. ルールの例のリスト
ルール ルールの内容
ルール 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 Bronze then set the category of the customer to Diamond ;

クエリー:

Find all business rules
   such that each business rule may disable "Rule 2" 

このクエリーは、ルール 1 とルール 3 を返します。ルール 1 は、顧客カテゴリーがコッパーに設定されるとブロンズにはならないため、返されます。 ルール 3 も返されます。これは、条件の 1 つで顧客カテゴリーはブロンズになってはいますが、アクションで顧客カテゴリーがダイヤモンドに設定されているからです。 そのため、顧客カテゴリーがダイヤモンドであれば、ルール 2 は適用不可になります。

は~によって有効になる可能性がある

指定ルールによって適用可能になるルールを返します。

例

表 6. ルールの例のリスト
ルール ルールの内容
ルール 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 を無効にしません。

は~によって無効になる可能性がある

指定ルールによって適用不可になるルールを返します。

例

表 7. ルールの例のリスト
ルール ルールの内容
ルール 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 は、ルール 1 によって適用不可になるため、返されます。ルール 1 では、25 歳の顧客のカテゴリーはブロンズに設定されているため、コッパーではありません。