エンティティー・ローダーの作成

エンティティー・ローダー・エディターから BOM 語彙にアクセスできます。構成体のセットを記述して、ロードする必要のあるエンティティーをソリューション BOM プロジェクトから定義します。定義した後は、特定のエンティティー ID を持つエンティティーを 1 回のみロードできます。

始める前に

エンティティー・ローダーを作成する前に、テスト・クライアント・プロジェクトを作成する必要があります。

このタスクについて

エンティティー・ローダー内には、ソリューションのテスト・エンティティーを定義できます。エンティティー・ローダーの構文は、Intellirule エディターで管理され、構文はビジネス・ルール言語をベースとします。変数を使用したり、エンティティーを変更したりするために、特定の言語構成要素を使用できます。

エンティティー・ローダー (.eldr) 内のエンティティーはすべて、load <entity> 構成体を使用して定義される必要があります。エンティティーを指定する順序は特に定められていません。

手順

  1. エンティティー・ローダー・ファイルの作成
    1. ソリューション・マップで、「エンティティー・ローダーの作成」をクリックします。
    2. 「エンティティー・ローダー」ウィザードで、ワークスペース内のテスト・クライアント・プロジェクトを選択し、エンティティー・ローダー・ファイルの名前を入力します。
    3. 「終了」をクリックします。
    .eldr ファイルが、テスト・クライアント・プロジェクトの「エンティティー・ローダー」フォルダーに保存されます。ファイルがエディターで開きます。
  2. .eldr ファイルのテキスト・エディターを開きます。
  3. スペースまたは Ctrl + スペース を押して、使用可能な構成体を表示します。
  4. 構成体をダブルクリックして定義に挿入します。
    the customer を Jane として識別する変数を定義するには、次の行 define 'the customer' as the customer identified by "Jane" ; を入力します。 その後、この変数を使用して、 load 構成体で the customer を参照することができます。例:
    define 'the customer' as a new customer where the customer id is "Jane" ;
    
    load 'the customer' ; 
  5. オプション: エンティティーに関連した概念を追加します。 以下の例では、新しい顧客 Jane が、id、first name、および last name によって識別されます。
    define 'Jane' as a new customer where 
       the customer id is "jane@example.com",
       the first name is "Jane" , 
       the last name is "Doe" ;
    
    load Jane ;
  6. ローダーに組み込むエンティティーごとに load 構成体を追加します。エンティティーは、変数名、または特定タイプの新しいエンティティーを参照することができます。

    load 構成体では、変数を使用できます。 以下の例では、where 節の後に変数 vehicle number が続き、delivery van の位置を 2 日間追跡するように移動式ジオメトリーが設定されます。

    load a new delivery van where  
       the vehicle number is "12347" ,
       the location is a new moving geometry tracked for 2 days ; 
  7. オプション: add 構成体を使用して、特定の値を持つ新規オブジェクトを追加します。 以下の例では、商品 orange が、Janes Cart のアイテムに追加されます。
    define 'Janes Cart' as a new shopping cart where 
       the customer is Jane , 
       the shopping cart id is "123456789" ; 
    
    add the product identified by 'orange' to the products of 'Janes Cart' ; 
    
    load 'Janes Cart' ; 
  8. すべてのエンティティーに、対応した load 構成体があること、および define、add、 load の各構成体がセミコロン (;) で終了することを確認してください。
  9. ファイルを保存します。

例

エンティティーのロード
以下の例では、orange が Jane のショッピング・カートに追加される前に、3 つのすべてのエンティティーがロードされます。
define 'Jane' as a new customer where 
	the customer id is "jane@example.com",
	the first name is "Jane" , 
	the last name is "Doe" ;
		
define 'Janes Cart' as a new shopping cart where 
	the customer is Jane , 
	the shopping cart id is "123456789" ; 
 
load Jane ; 

define 'orange' as "ORANGE";

load a new product where 
	the id is 'orange' , 
	the description is "An orange" ;

add the product identified by 'orange' to the products of 'Janes Cart' ; 

load 'Janes Cart' ; 
関係があるエンティティーのロード
以下の BMD では、E1 と E2 の関係が定義されています。
an E1 is a business entity identified by an e1.
an E1 has an abc.
an E2 is a business entity identified by an e2.
an E2 has an xyz.
an E2 is related to some E1s. 
以下のエンティティー・ローダーは、E1 と E2 の関係をチェックします。
define e1Instance as a new e1 where the e1 is "e1Id", 
   the abc is "ABCVal" ;
add the e2 identified by "e2Id" to the E1s of e1Instance ;
load e1Instance ;
load a new E2 instance where the e2 is "e2Id", the xyz is "XYZVal" ;