Example: Category relationships
You can insert, replace, or delete your category relationship data simultaneously by using the Data Load utility. These examples use a CSV file to demonstrate how to insert, replace, or delete your categories relationship data.
This example uses a CSV file to demonstrate how to insert, replace, or delete your data. You can also create and use an XML formatted file to insert, replace, or delete your data. If you choose to create and use an XML formatted file, ensure that your XML elements use the same names as are used for CSV column names.
CSV column and XML element definitions
- GroupUniqueId
- (Integer) The internal unique reference number of the category. Either this field or the GroupIdentifier is required.
- GroupIdentifier
- (String) The category identifier. This field cannot be null, and it must be unique. Either this field or the GroupUniqueId is required.
- ParentGroupUniqueId
- (Integer) The unique reference number of the parent category. Either this field or the ParentGroupIdentifier is required. This is null if this is a top-level category.
- ParentGroupIdentifier
- (String) The parent identifier of this category. Either this field or the ParentGroupUniqueId is required. This is null if this is a top-level category.
- ParentStoreUniqueId
- (Integer) The unique reference number of the store that owns the parent category.
- ParentStoreIdentifier
- (String) The Store identifier the parent category belongs to. Use this field in an extended sites store, where the parent store is different from the store that the category is added to.
- CatalogIdentifier
- (String) The identifier of the catalog that the parent category belongs to.
- Sequence
- (Double) An optional number that is used to control the order in which child categories are displayed in a parent category.
- Delete
- (String) A flag indicating whether to delete. Specify
1
to delete the row.
CSV file with sample category relationship data
Insert or replace
The CSV file contains sample
category relationship data with columns delimited by commas: CSV file with sample category relationship data
GroupIdentifier | ParentGroupIdentifier | Sequence |
---|---|---|
LCD_category | TV_category | 1 |
Fridge_category | Appl_category | 2 |
Delete
The CSV file contains
sample category relationship data with columns delimited by commas: CSV file with sample category relationship data
GroupIdentifier | ParentGroupIdentifier | Sequence | Delete |
---|---|---|---|
LCD_category | TV_category | 1 | 1 |
Fridge_category | Appl_category | 2 | 1 |
Mapping data
The following code snippet
from the catalog relationship loader configuration file demonstrates
how to map each value to a business object logical schema path.
<_config:DataMapping>
<_config:mapping xpath="CatalogGroupIdentifier/UniqueID" value="GroupUniqueId" />
<_config:mapping xpath="CatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="GroupIdentifier" />
<_config:mapping xpath="ParentCatalogGroupIdentifier/UniqueID" value="ParentGroupUniqueId" />
<_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="ParentGroupIdentifier" />
<_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/UniqueID" value="ParentStoreUniqueId" />
<_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" value="ParentStoreIdentifier" />
<_config:mapping xpath="Attributes/CatalogIdentifier" value="CatalogIdentifier" />
<_config:mapping xpath="displaySequence" value="Sequence" />
<_config:mapping xpath="" value="Delete" deleteValue="1"/>
</_config:DataMapping>
If you perform an insert or
replace operation, do not specify the "Delete" column in the CSV file
or you can leave the "Delete" column empty.Business object mediator
The mediator class name is com.ibm.commerce.catalog.dataload.mediator.CatalogGroupRelationshipMediator.
Note: When you use a mediator that is provided with HCL Commerce with the Data
Load utility, the utility assumes that you are loading data for all columns for a
business object. If you want to update the data in only specific columns, configure
a column exclusion list for the load process. A column exclusion list causes the
Data Load utility to ignore specific columns during the load operation. If you do
not use a column exclusion list, the utility updates all columns in the row of a
database table row when the utility updates the row. If no value is set in the input
file, the utility can replace the existing column value with a default value or set
the value to be null. For more information, see Configuring a column exclusion list.