データ・ドメインでのコレクションの作成手順

ここでは、コレクションの作成に必要なステップの概要を示します。

この手順では、(一意のプロパティ・キーがProductID標準属性である)Productsおよび(一意のプロパティ・キーがSalesID標準属性である)Salesの2つのコレクションを作成すると仮定しています。また、(収集された場合に)各ソース・レコードが、ProductID属性(この場合はProductsコレクションに属します)またはSalesID属性(この場合はSalesコレクションに属します)のいずれかの割当てを持つと仮定しています。

コレクションを作成する手順:

  1. 空のEndecaデータ・ドメインを作成します。

    たとえば、Endeca Serverのcreate-ddコマンドを使用できます。

  2. 属性スキーマ(つまり、標準属性のPDR)をデータ・ドメインにロードします。特に、単一割当ての一意の属性としてProductIDおよびSalesID標準属性を作成するようにします。
  3. putCollections操作を使用して、次の例のようにコレクションを作成します。
    <soapenv:Envelope 
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
       xmlns:ns="http://www.endeca.com/endeca-server/sconfig/3/0">
       <soapenv:Header/>
       <soapenv:Body>
          <ns:putCollections>
             <ns:language>en</ns:language>
             <ns:collection collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
                <ns:description>product records for the region</ns:description>
                <ns:property key="Region">New England</ns:property>
             </ns:collection>
             <ns:collection collectionKey="Sales" displayName="Sales data" uniquePropertyKey="SalesID">
                <ns:description>sales information</ns:description>
                <ns:property key="Currency">$</ns:property>
             </ns:collection>
          </ns:putCollections>
       </soapenv:Body>
    </soapenv:Envelope>
  4. データ・ドメインにソース・レコードをロードします。

    前述のように、各ソース・レコードは、ProductIDまたはSalesID属性のいずれかの割当てを持つ必要があります(これは、レコードのレコード仕様(主キー)としても機能します)。

収集操作が完了した場合、listCollections操作の結果として、次のリストが返されます(読みやすくなるように一部が省略されています)。
<listCollectionsResponse xmlns="http://www.endeca.com/endeca-server/sconfig/3/0">
   <collectionRecord collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
      <description>Collection of Product information</description>
      <property key="Locale">US region</property>
      <collectionAttributes>
         <collectionAttribute propertyKey="Color"/>
         <collectionAttribute propertyKey="DealerPrice"/>
         ...
         <collectionAttribute propertyKey="Style"/>
         <collectionAttribute propertyKey="Weight"/>
      </collectionAttributes>
   </collectionRecord>
   <collectionRecord collectionKey="Sales" displayName="Sales data" uniquePropertyKey="SalesID">
      <description>Collection of Sales information</description>
      <property key="Currency">$</property>
      <collectionAttributes>
         <collectionAttribute propertyKey="FactSales_CurrencyKey"/>
         <collectionAttribute propertyKey="FactSales_CustomerPONumber"/>
         ...
         <collectionAttribute propertyKey="FactSales_TotalProductCost"/>
         <collectionAttribute propertyKey="FactSales_UnitPrice"/>
      </collectionAttributes>
   </collectionRecord>
</listCollectionsResponse>

このlistCollectionsResponseでは、ステップ3で作成されたProductsおよびSalesの2つのコレクションが示されています。また、Dgraphによって、コレクションの一意のプロパティ・キーからの割当てを持つレコードから属性がCDRに移入されたことも示されています。