Relation Definition Meta-data
The Relation meta-data contains attributes for creating a relation between two classes. In order to define the relation, the Class definition must already be created for BOTH the parent and child classes. In the Commerce Server 2000 Data Warehouse, most relations are of the one-to-many type.
To link two classes, the ParentClassName attribute for the Relation must be set to the ClassDefName of the parent Class object. Likewise, the ChildClassName attribute for the Relation must be set to the ClassDefName of the child Class object. Any data members in the parent that are marked for inheritance are copied to the child when the relation is created.
To link specific class members, create a Relation Member that defines the members to link for the relation.
For information about creating a new relation between two existing classes, see Creating a New Class Relation.
The Relation definition meta-data contains an attribute used to define the type of the relation (RelType). The following table contains the valid relation types and the corresponding type codes. In the Commerce Server 2000 Data Warehouse, most relations are of the one-to-many type.
Relation Type | Code | Description |
One-to-Many | 2 | Each parent has zero or more children, each child has one parent. The identifier ("Classname"ID) of the parent is used as a foreign key by the child. |
Many-to-Many | 3 | Each parent has zero or more children, each child has one or more parents. |
One-to-Many with Inheritance | 194 | Same as one-to-many except all members of the parent are visible to the children. (In a regular one-to-many relation, only the key members of the parent class are visible.) |
The following table shows the attributes used for the class relation definitions. A set of these attributes is stored in the RelDef table for each class relation defined.
Attribute | Data Type | Constraint | Requirement | Description |
RelDefID | int | NOT NULL | Leave blank | Stores the unique identifier for the relation. |
CatalogID | int | NULL | Leave blank | Stores the identifier for the schema catalog. |
CatalogName | nvarchar (128) | NULL | Leave blank | Stores the name of the schema catalog, "DWSchema." |
ChildClassID | int | NULL | Leave blank | Stores the class identifier of the child class for the relation. |
ChildClassName | nvarchar (128) | NULL | Required | Stores the name of the child class for the relation. |
CreatedTime | datetime | NULL | Leave blank | Records when the relation was created. |
Description | nvarchar (128) | NULL | Optional | Stores the description potentially displayed in the UI. |
DisplayName | nvarchar (128) | NULL | Optional | Stores the name potentially displayed in the UI. |
MajorVersion | int | NULL | Optional | Stores the major version number for the relation. |
MinorVersion | int | NULL | Optional | Stores the minor version number for the relation. |
ModifiedTime | datetime | NULL | Leave blank | Records when the relation was last modified. |
ParentClassID | int | NULL | Leave blank | Stores the class identifier of the parent class for the relation. |
ParentClassKey | nvarchar (128) | NULL | Required | Stores the name of the key for the parent class. |
ParentClassName | nvarchar (128) | NULL | Required | Stores the name of the parent class for the relation. |
RelDefName | nvarchar (128) | NULL | Required | Stores the name of the relation. |
RefMemName | nvarchar (128) | NULL | Leave blank | Reserved. |
RelType | smallint | NULL | Required | Stores the type of the relation. |
Status | int | NULL | Leave blank | Reserved. |