エンティティは、データ内の様々なカテゴリの直感的な概念ビューを提供します。これらは、Oracle Endeca Serverのフラット・データ・モデルに存在するが直接には表示されないデータのカテゴリ間のリレーショナルな複雑さを反映します。
エンティティ(またはStudioのビュー)は、別名、フィルタおよびグループ化により物理レコードから導出されるレコードの論理セットを表します。 entity (or view, in Studio) represents a logical set of records that are derived from the physical records by aliasing, filtering, and grouping.エンティティには、属性の名前、タイプおよび表示名と、メトリックの名前および定義を含む固有のメタデータがあります。
様々なデータ・カテゴリの上にエンティティを作成する場合は、データの分析方法に基づいて、ビジネスの概念を複雑なデータ構造にマップします。エンティティは、すべてのデータがOracle Endeca Serverにロードされた後で、データのカテゴリ間に関係を再確立します。
それらにメトリックなどのメタデータを指定することで、エンティティを定義します。これにより、データ設計者は、データ内の様々なカテゴリ間の関係についてビジネス・アナリストに通知したり、エンティティでリクエストできるメトリックを提示したりできます。たとえば、メトリックは、グループ化または集約することが有用なエンティティに関する情報も提供できます。
エンティティを作成すると、それらはデータの(集約された)論理ビューとして機能し、ビジネス・アナリストはそれらに対して分析問合せを実行できます。
エンティティは、エンティティ構成WebサービスのputEntityまたはputEntities操作を使用して作成します。基礎となる属性がスキーマにすでに定義され、データ・ドメインに存在する場合は、エンティティのみ作成できます。
<semanticEntity key="?" displayName="?" isActive="?"> <definition>?</definition> <description>?</description> <attributes> <semanticAttribute name="?" displayName="?" datatype="?" isDimension="?" isKeyColumn="?" description="?"> <property key="?">?</property> </semanticAttribute> </attributes> <metrics> <metric name="?" displayName="?" datatype="?" description="?"> <definition>?</definition> <property key="?">?</ns:property> </metric> </metrics> <groups> <group key="?" displayName="?"> <semanticAttributeKey name="?"/> <property key="?">?</property> </group> </groups> <property key="?">?</property> </semanticEntity>
要素または属性の名前 | 説明 |
---|---|
key | 必須属性。エンティティの作成時に提供するエンティティの一意識別子。たとえば、キーSalesでエンティティを作成できます。キー名はNCName書式である必要があります。 |
displayName | オプションの属性。Studioなどのフロントエンド・アプリケーションで使用できる表示名を定義します。表示名にはNCName以外の書式を使用できます。 |
isActive | 必須要素。このエンティティがアクティブか非アクティブかを指定するブール値(trueまたはfalse)。非アクティブ・エンティティのdefinitionは、put操作の一部やEQL問合せとして評価されず、その定義は問合せに連結されません。非アクティブ状態。これにより、無効または不完全なEQL定義(後で修正する)でエンティティを保存したり、後で(アクティブにする時点で)使用するためにエンティティを保存したりすることができます。他のEQL問合せがエンティティを参照する場合、そのエンティティをアクティブにする必要があります。エンティティを保存する場合、isActiveを明示的に設定する必要があります。ベース・エンティティは常にアクティブであることに注意してください。 |
definition | 必須要素。エンティティを定義するEQL文。このEQL文は、その中に含まれるEQL式に基づいてレコードの仮想コレクションを作成(またはフィルタ処理)する必要があります。
エンティティのEQL定義は、セミコロンで区切られた1つ以上のDEFINE文から構成されます。DEFINE文の名前は、エンティティの名前と一致する必要があります。 たとえば、SalesエンティティのDEFINE文は次のようになります。
<definition> DEFINE Sales AS SELECT FactSales_SalesAmount AS SalesAmount, DimReseller_ProductLine AS ProductLine, DimSalesTerritory_SalesTerritoryCountry AS SalesTerritoryCountry, DimDate_FiscalYear AS FiscalYear, FactSales_SalesOrderNumber AS SaleOrderNumber </definition> |
description | オプションの属性。エンティティに関する説明テキストを提供します。 |
attributes | オプションの要素。エンティティ内の属性のリストを表します。attributes要素には、ゼロ個以上のsemanticAttribute要素を含めることができます。詳細は、後述の項を参照してください。 |
metrics | オプションの要素。1つ以上の推奨メトリック要素のリストを提供します。metrics要素には、ゼロ個以上のmetric要素を含めることができます。詳細は、後述の項を参照してください。 |
groups | オプションの要素。1つ以上のエンティティ属性グループを作成できます。詳細は、後述の項を参照してください。 |
property | オプションの要素 (これがsemanticEntity全体のproperty要素であることに注意してください)。エンティティ全体の文字列メタデータ・グローバル・プロパティを指定できます。キー名はNCName書式である必要があります。 |
attributes要素には、1つ以上のsemanticAttribute要素を含めることができます。エンティティ内の各属性は、definitionに含まれるEQL文で指定された属性に対応する必要があります。各semanticAttribute要素は、エンティティのメンバー属性を定義します。
<semanticAttribute name="?" displayName="?" datatype="?" isDimension="?" isKeyColumn="?" description="?"> <property key="?">?</property> </semanticAttribute>
<attributes> <semanticAttribute name="SalesAmount" displayName="Sales Amount" datatype="mdex:double" isDimension="false" isKeyColumn="true" description="sales info"> <property key="locale">EN</property> </semanticAttribute> ... </attributes>
<metrics> <metric name="?" displayName="?" datatype="?" description="?"> <definition>?</definition> <property key="?">?</property> </metric> </metrics>
各メトリックには、SUM(X)またはAVG(Y)などの集約関数を1つ以上含める必要があります。ここで、XおよびYは、エンティティに定義される属性になります。
<metrics> <metric name="TotalSales" displayName="Total Sale" datatype="mdex:double"> <definition>sum(SalesAmount)</definition> <property key="currency">$</property> </metric> </metrics>
エンティティ属性グループ(ビュー属性グループとも呼ばれる)は、(semanticAttribute要素を介して設定された)エンティティ属性のセットで構成されます。
エンティティ属性グループでは、グループに関連付けられるプロパティのセット(キー/値ペア)も使用できます。これらのプロパティでは、フロントエンド・アプリケーション(Studioなど)で使用できるグループのメタデータも提供できます。たとえば、注文制御にこのメタデータを指定できます(結果のソートに使用する属性の指定など)。
<groups> <group key="?" displayName="?"> <semanticAttributeKey name="?"> <property key="?">?</property> </group> </groups>
<semanticEntity key="Product" displayName="Product" isActive = "true"> <definition> DEFINE Product AS SELECT productId AS productId, description AS description, price AS price </definition> <attributes> <semanticAttribute name="productId" datatype="mdex:string" isDimension="true" isKeyColumn="true"> </semanticAttribute> <semanticAttribute name="description" datatype="mdex:string" isDimension="true" isKeyColumn="false"> </semanticAttribute> <semanticAttribute name="price" datatype="mdex:double" isDimension="true" isKeyColumn="false"> <property key="currency">$</property> </semanticAttribute> </attributes> <metrics/> <groups> <group key="ProdDescription" displayName="ProductId and Description Group"> <semanticAttributeKey name="productId"/> <semanticAttributeKey name="description"/> <property key="sortBy">productId</property> </group> </groups> <property key="sales_area">North America</property> </semanticEntity>
このグループには、2つのエンティティ属性("productId"と "description")がメンバーとして存在します。また、メタデータ・プロパティ("sortBy")もあり、その値を使用して"productId"属性で結果をソートできます。
前に説明したエンティティ定義の各部分をまとめるために、次の使用例について考えます。
販売トランザクションのリストをロードする場合は、顧客、製品およびサプライヤに関する情報もロードします。それぞれのエンティティを作成できます。SalesAmount、ProductLineおよびFiscalYearの各属性から導出されるレコードの仮想セットとしてSalesエンティティを作成する例を考えます。
Salesエンティティを定義するときは、そのメトリックも提供して、ビジネス・アナリストがこのエンティティに対してEQLで問合せを発行できるようにします。これらのメトリックは、SalesAmountの合計として定義されるTotalSales、またはSalesAmountの平均として定義されるAvgSalesになります。
<semanticEntity key="Sales" displayName="Sales Transactions" isActive="true"> <definition> DEFINE Sales AS SELECT FactSales_SalesAmount AS SalesAmount, DimReseller_ProductLine AS ProductLine, DimSalesTerritory_SalesTerritoryCountry AS SalesTerritoryCountry, DimDate_FiscalYear AS FiscalYear, FactSales_SalesOrderNumber AS SaleOrderNumber </definition> <description>Sales transaction information</description> <attributes> <semanticAttribute name="SalesAmount" displayName="Sales Amount" datatype="mdex:double" isDimension="false" isKeyColumn="true"> <property key="locale">EN</property> </semanticAttribute> <semanticAttribute name="ProductLine" displayName="Product Line" datatype="mdex:string" isDimension="true" isKeyColumn="false"> </semanticAttribute> <semanticAttribute name="SalesTerritoryCountry" displayName="Sales Territory Country" datatype="mdex:string" isDimension="true" isKeyColumn="false"> </semanticAttribute> <semanticAttribute name="FiscalYear" displayName="Year" datatype="mdex:int" isDimension="true" isKeyColumn="false"> </semanticAttribute> <semanticAttribute name="SaleOrderNumber" displayName="Sale Order Number" datatype="mdex:string" isDimension="false" isKeyColumn="false"> </semanticAttribute> </attributes> <metrics> <metric name="TotalSales" displayName="Total Sale" datatype="mdex:double"> <definition>sum(SalesAmount)</definition> <property key="currency">$</property> </metric> <metric name="AvgSales" displayName="Average Sale" datatype="mdex:double"> <definition>avg(SalesAmount)</definition> </metric> </metrics> </groups> <property key="SalesArea">North America</property> </semanticEntity>
レコードがEndecaデータ・ドメインにロードされた後、データ・ドメイン内の属性ごとに1つのベース・エンティティ・レコードが作成されます。ベース・エンティティ・レコードは、物理レコードの各属性を定義するPDRに基づいて作成されます。ベース・エンティティは、固有のカスタム・エンティティを作成するための便利な方法を提供します。