In the Oracle Endeca Server data model, the primary-key attribute (also known as the record specifier) is used to uniquely identify records in the Endeca data domain.
Each record in the Endeca data domain is uniquely identified by a unique value pair, which is a combination of a unique standard attribute and a value that appears only on that record (that is, no other record in the data set has the same key-value pair that is on this record). This unique standard attribute is called a primary-key attribute. The primary-key attribute and a value assigned to a record becomes the primary key (record specifier) of the record.
Each record added to the Endeca data domain must have a unique assignment from exactly one primary key, so that the Oracle Endeca Server can uniquely identify it. This requirement is enforced when you are adding records to an empty data domain that does not yet have a schema (system records) defined in it.
You can use any attribute as a primary key as long as this attribute is guaranteed to be unique. An attribute is unique when no two records in a single Endeca data domain have the same value for it. (Note that by default, a standard attribute is not unique. To make a standard attribute unique, you must update the standard attribute configuration in its PDR, before loading any records.)
The primary-key attribute type can be of any supported Dgraph property types. The name of the primary-key attribute must be in an NCName format. Typically, you would use the mdex:string or mdex:int types for the primary-key attribute.
The PDR (Property Description Record) for the primary-key attribute must have the mdex-property_IsUnique attribute set to true. This means that a value may be assigned to at most one record.
For example, assume that the name of a primary-key attribute is partID. The value partID=P123 can be assigned to only one record in the data set and is the primary key for that record. No other record can have this key-value pair. As a result, this primary key uniquely identifies this record in the Endeca data domain.
Each data domain must have at least one primary key standard attribute, although this primary key attribute could be different for different types of your data records. This allows the Oracle Endeca Server to handle different record types, each of which can have a meaningful identifying standard attribute. For example, a store that carries multiple types of items might identify book records by a bookID primary key attribute, and apparel records by an apparelID attribute.
<ingest:ingestFault xmlns:ingest="http://www.endeca.com/MDEX/ingest/2/0"> <ingest:errorDetail>Error applying updates: Assignment bookID: "5544" is second unique assignment on record Record: apparelID: "4455" bookID: "5544"</ingest:errorDetail> </ingest:ingestFault>
As the example shows, the second unique assignment (bookID) will cause the error.