コレクション定義レコード

コレクション定義レコード(CDR)は、Dgraphの特定のコレクションを定義します。

Dgraphでは、コレクションはコレクション定義レコード(CDR)によって表されます。CDRは、putCollection操作とputCollections操作が正常に実行されたときに作成されます。CDRはユーザーに対して表示されませんが、listCollections操作は実際にはcollectionRecord要素を介してCDRの表現を返します。

最初に作成されたCDRをlistCollections操作によって表示すると、次の例のようになります。
<collectionRecord collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
     <description>product records for the region</description>
     <property key="Region">New England</property>
     <collectionAttributes/>
</collectionRecord>

この時点ではこのコレクションに関連付けられているレコードは存在しないため、collectionAttributesフィールドが空であることに注意してください。

ソース・レコードがデータ・ドメイン内に収集されると、次のlistCollections操作による例が示すように、コレクション関連のレコード(つまり、uniquePropertyKey割当てがあるレコード)にタグ付けされた属性がcollectionAttribute属性によってCDRに追加されます。
<collectionRecord collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
   <description>product records for the region</description>
   <property key="Region">New England</property>
   <collectionAttributes>
      <collectionAttribute propertyKey="Class"/>
      <collectionAttribute propertyKey="Color"/>
      <collectionAttribute propertyKey="DaysToManufacture"/>
      <collectionAttribute propertyKey="DealerPrice"/>
      <collectionAttribute propertyKey="FinishedGoodsFlag"/>
      <collectionAttribute propertyKey="ListPrice"/>
      <collectionAttribute propertyKey="ModelName"/>
      <collectionAttribute propertyKey="ProductID"/>
      <collectionAttribute propertyKey="ProductLine"/>
      <collectionAttribute propertyKey="ProductSubcategoryKey"/>
      <collectionAttribute propertyKey="ReorderPoint"/>
      <collectionAttribute propertyKey="SafetyStockLevel"/>
      <collectionAttribute propertyKey="Size"/>
      <collectionAttribute propertyKey="SizeRange"/>
      <collectionAttribute propertyKey="SizeUnitMeasureCode"/>
      <collectionAttribute propertyKey="StandardCost"/>
      <collectionAttribute propertyKey="Status"/>
      <collectionAttribute propertyKey="Style"/>
      <collectionAttribute propertyKey="Weight"/>
   </collectionAttributes>
</collectionRecord>

これでcollectionAttributesフィールドに、このコレクションを構成するレコード属性が移入されました。

collectionRecordのプロパティ

collectionRecord要素には、次の表にリストされているプロパティがあります。これらのプロパティ(collectionAttributeプロパティを除く)は、最初にputCollection操作またはputCollections操作のcollection属性を介してユーザーが設定します。
collectionRecordのプロパティ 説明
collectionKey すべてのEndeca Server API(問合せを含む)でこのコレクションを指定するために使用される、コレクションの名前。collection::collectionKey属性を介して設定します。
displayName コレクションのユーザーフレンドリな表示名として使用することを目的とした、アプリケーションで使用可能な任意の文字列値。collection::displayName属性を介して設定します。
uniquePropertyKey どのレコードをこのコレクションに含めるかを決定する標準属性。collection::uniquePropertyKey属性を介して設定します。
description コレクションの説明として使用することを目的とした、アプリケーションで使用可能な任意の文字列値。collection::description属性を介して設定します。
property key コレクションに関連付けられる文字列メタデータ。collection::property key属性を介して設定します。
collectionAttribute propertyKey コレクションに属する標準属性。これらのプロパティは、レコード収集操作中にDgraphによって追加され、ユーザーが変更することはできません。