Red Hat Training

A Red Hat training course is available for Red Hat Decision Manager

第3章 DMN モデルの例

DMN は、異なる DMN オーサリングプラットフォーム間で使用される DMN モデルを有効にする XML スキーマを定義します。DMN 仕様は、作成、テスト、および実稼働環境での実行に対して、同じファイルを使用するソフトウェアプラットフォームを複数有効にします。視覚的なオーサリング機能が必要な場合は、Trisotech や Signavio など、サードパーティーのオーサリングプラットフォームを使用する必要があります。

以下の意思決定の要件ダイアグラムは、映画チケットの購入時における、年齢を対象にした分類タイプの決定を示します。この基本例では、この簡単な決定を別の意思決定の入力にし、計算が繰り返し行われるのを回避する分類を作成する方法を示します。

図3.1 年齢の分類決定に対する意思決定要件ダイアグラム

dmn age classification drd

この例では、正しい文字列出力 (AgeClassification) を生成するのに必要な数値の入力値が 1 つ (Age) だけとなります。AgeClassification の意思決定の内部機能が基本的なテーブルになります。

図3.2 年齢の分類決定に対するデシジョンテーブル

dmn age classification decision table

このテーブルは、年齢の範囲を決定する簡単な FEEL 式を使用して、値を AgeClassification 出力値に割り当てます。このデシジョンモデルは、 Trisotech DMN オーサリング環境で作成されました。

以下の出力は、このデシジョンモデルの XML ソースとなります。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<semantic:definitions xmlns:semantic="http://www.omg.org/spec/DMN/20151101/dmn.xsd"
                      xmlns:feel="http://www.omg.org/spec/FEEL/20140401"
                      xmlns:tc="http://www.omg.org/spec/DMN/20160719/testcase"
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      namespace="http://www.redhat.com/_c7328033-c355-43cd-b616-0aceef80e52a" 1
                      name="dmn-movieticket-ageclassification" 2
                      id="_99">
  <semantic:extensionElements/>
  <semantic:inputData displayName="Age" id="_1" name="Age">
    <semantic:variable id="_2" name="Age" typeRef="feel:number"/>
  </semantic:inputData>
  <semantic:decision displayName="AgeClassification" id="_3" name="AgeClassification">
    <semantic:variable id="_4" name="AgeClassification" typeRef="feel:string"/>
    <semantic:informationRequirement>
      <semantic:requiredInput href="#_1"/>
    </semantic:informationRequirement>
    <semantic:decisionTable hitPolicy="UNIQUE" id="_5" outputLabel="AgeClassification">
      <semantic:input id="_6">
        <semantic:inputExpression typeRef="feel:number">
          <semantic:text>Age</semantic:text>
        </semantic:inputExpression>
      </semantic:input>
      <semantic:output id="_7"/>
      <semantic:rule id="_8">
        <semantic:inputEntry id="_9">
          <semantic:text>&lt; 13</semantic:text>
        </semantic:inputEntry>
        <semantic:outputEntry id="_10">
          <semantic:text>"Child"</semantic:text>
        </semantic:outputEntry>
      </semantic:rule>
      <semantic:rule id="_11">
        <semantic:inputEntry id="_12">
          <semantic:text>[13..65)</semantic:text>
        </semantic:inputEntry>
        <semantic:outputEntry id="_13">
          <semantic:text>"Adult"</semantic:text>
        </semantic:outputEntry>
      </semantic:rule>
      <semantic:rule id="_14">
        <semantic:inputEntry id="_15">
          <semantic:text>&gt;= 65</semantic:text>
        </semantic:inputEntry>
        <semantic:outputEntry id="_16">
          <semantic:text>"Senior"</semantic:text>
        </semantic:outputEntry>
      </semantic:rule>
    </semantic:decisionTable>
  </semantic:decision>
</semantic:definitions>
1
モデルの名前空間
2
モデル名

この基本ファイルは、ビジネスロジック、および意思決定全体の入力と出力を入れるのに十分な情報と、一貫して関係を視覚的に表示するソフトウェアツールを有効にするのに十分な詳細を取得します。

ルートの definitions タグの namespace 属性および name 属性は、このデシジョンモデルを一意に識別します。多くの XML のように、namespace 値は、ドキュメントを作成する組織または個人に関連付けられた一意の URL として表示されます。