コレクション定義レコード(CDR)は、Dgraphの特定のコレクションを定義します。
Dgraphでは、コレクションはコレクション定義レコード(CDR)によって表されます。CDRは、putCollection操作とputCollections操作が正常に実行されたときに作成されます。CDRはユーザーに対して表示されませんが、listCollections操作は実際にはcollectionRecord要素を介してCDRの表現を返します。
<collectionRecord collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
<description>product records for the region</description>
<property key="Region">New England</property>
<collectionAttributes/>
</collectionRecord>
この時点ではこのコレクションに関連付けられているレコードは存在しないため、collectionAttributesフィールドが空であることに注意してください。
<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のプロパティ | 説明 |
|---|---|
| collectionKey | すべてのEndeca Server API(問合せを含む)でこのコレクションを指定するために使用される、コレクションの名前。collection::collectionKey属性を介して設定します。 |
| displayName | コレクションのユーザーフレンドリな表示名として使用することを目的とした、アプリケーションで使用可能な任意の文字列値。collection::displayName属性を介して設定します。 |
| uniquePropertyKey | どのレコードをこのコレクションに含めるかを決定する標準属性。collection::uniquePropertyKey属性を介して設定します。 |
| description | コレクションの説明として使用することを目的とした、アプリケーションで使用可能な任意の文字列値。collection::description属性を介して設定します。 |
| property key | コレクションに関連付けられる文字列メタデータ。collection::property key属性を介して設定します。 |
| collectionAttribute propertyKey | コレクションに属する標準属性。これらのプロパティは、レコード収集操作中にDgraphによって追加され、ユーザーが変更することはできません。 |