Attribute Dictionary and Classic Attribute Model

In most of the ecommerce implementations the merchant would use an external Order management system to maintain the catalog subsystem which includes items and it's attributes, we usually end up loading and defining catalog in WCS master catalog, in earlier versions WCS used to support a schema for defining descriptive and defining attributes for a product, one of the main limitations of this model was that you would end up defining the attributes for each product/item even if the attribute names are the same, for instance every product in your catalog might have a descriptive attribute by name BUYING_GUIDE which indicates the buying guide URL, you would define a new attribute BUYING_GUIDE as an attribute for every product.

Attribute dictionary is a new feature supported from V7 onwards, consider the previous example, you can now define just one attribute with name BUYING_GUIDE and share it among all product of your catalog, the value of this attribute alone can be different based on the catentry to which it is associated,with this new schema you can simplify the process of keeping attribute names and values consistent across your site.

Loading attribute using classic attribute model

CATENTRY -----> ATTRIBUTE ----> ATTRIBUTEVALUE

a. Define wc-dataload-env.xml and wc-dataload.xml dataloader files, wc-dataload-env.xml file consists of details related to your database environment, wc-dataload.xml defines the dataload source data.
you can reuse the env file located at following location  and load it to OOB Apache derby database
WCDE_ENT70\samples\DataLoad\Catalog\wc-dataload-env.xml

Define WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-dataload.xml as follows.

<_config:DataLoadConfiguration
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload.xsd"
    xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
  <_config:DataLoadEnvironment configFile="../wc-dataload-env.xml" />
  <_config:LoadOrder commitCount="100" batchSize="1" dataLoadMode="Replace">
         <_config:property name="firstTwoLinesAreHeader" value="true" />
         <_config:LoadItem name="ClassicAttributeAndValue" businessObjectConfigFile="wc-loader-classic-attribute-and-value.xml" >
              <_config:DataSourceLocation location="ClassicAttributeAndValue.csv" />
         </_config:LoadItem>
  </_config:LoadOrder>
</_config:DataLoadConfiguration>

b. Define the business object config file which defines the mapping of source data file fields with the database fields.

Define wc-loader-classic-attribute-and-value.xml in WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-loader-classic-attribute-and-value.xml as follows

<_config:DataloadBusinessObjectConfiguration
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload-businessobject.xsd"
    xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">

  <_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader" >
    <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" />
    <_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder"
      packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" dataObjectType="CatalogEntryType" >
      <_config:DataMapping>
        <!-- The part number of the catalog entry -->
        <_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" />
        <!-- The unique reference number of the catalog entry -->
        <_config:mapping xpath="CatalogEntryIdentifier/UniqueID" value="CatalogEntryUniqueId" />
        <!-- The unique reference number of the attribute -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeIdentifier/UniqueID" value="AttributeUniqueId" />
        <!-- The attribute data type -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeDataType" value="Type" />
        <!-- The attribute language -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/language" value="Language" />
        <!-- The attribute name -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Name" value="Name" />
        <!-- The attribute usage -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/usage" value="2" valueFrom="Fixed" />
        <!-- The attribute display sequence -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/displaySequence" value="Sequence" />
        <!-- The attribute description -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Description" value="Description" />
        <!-- The attribute secondary description -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/SecondaryDescription" value="SecondaryDescription" />
        <!-- The attribute group name -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/DisplayGroupName" value="GroupName" />
        <!-- The attribute custom field 1 -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Field1" value="Field1" />
        <!-- The attribute footnote -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Footnote" value="Footnote" />
        <!-- The units in which the attribute is measured -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/UnitOfMeasure" value="UnitOfMeasure" />
        <!-- The attribute value -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Value/value" value="Value" />
        <!-- The attribute value language -->
        <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/language" value="Language" />
        <!-- The Delete indicator -->
        <_config:mapping xpath="" value="Delete" deleteValue="1" />
      </_config:DataMapping>
      <_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload.mediator.CatalogEntryAttributeMediator" componentId="com.ibm.commerce.catalog" />
    </_config:BusinessObjectBuilder>
  </_config:DataLoader>
</_config:DataloadBusinessObjectConfiguration>

c. Run the dataloader as follows, refer to the screenshot below.



d. you can query following tables to understand the changes made by this dataload process.
you would notice that it has created two attributes with the same name in attribute table and associated it to individual catentries.

select * from attribute where CATENTRY_ID in
(select CATENTRY_ID from catentry where partnumber in ('TATA-0101','FUCO-0101'));

Loading attribute using attribute dictionary model



CATENTRY -----> CATENTRYATTR ---->ATTR
                                            |
                                            |
                                            ---------------->ATTRVAL


a. Define WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-dataload.xml as follows.

<_config:DataLoadConfiguration
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload.xsd"
    xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">

  <_config:DataLoadEnvironment configFile="../wc-dataload-env.xml" />

  <_config:LoadOrder commitCount="100" batchSize="1" dataLoadMode="Replace">
         <_config:property name="firstTwoLinesAreHeader" value="true" />
         <_config:LoadItem name="ADAttributeAndValue" businessObjectConfigFile="wc-loader-AD-attribute-and-allowed-values.xml" >
              <_config:DataSourceLocation location="ADAttribute.csv" />
         </_config:LoadItem>
         <_config:LoadItem name="ADCatentryAttributeAndValue" businessObjectConfigFile="wc-loader-ad-attribute-and-value.xml" >
              <_config:DataSourceLocation location="ADAttributeAndValue.csv" />
         </_config:LoadItem>
  </_config:LoadOrder>
</_config:DataLoadConfiguration>

b.  reused the file located in WCDE_ENT70\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-loader-AD-attribute-and-allowed-values.xml as is.


c. reused WCDE_ENT70\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-loader-catalog-entry-AD-attribute-relationship.xml

d. Created ADAttribute.csv with following content

ADAttributeAndValue,,,,,,,,
Identifier,Type,Name,AllowedValue1,AllowedValue2,AllowedValue3,AllowedValue4,AllowedValue5,Delete
BUYING_GUIDE,STRING,BUYING_GUIDE,,,,,,

e. Created ADAttributeAndValue.csv file with following content
CatalogEntryAttributeDictionaryAttributeRelationship,,,,,,
PartNumber,AttributeIdentifier,ValueIdentifier,Value,Usage,Sequence,Delete
TATA-0101,BUYING_GUIDE,,Http://mycompany.com/PartNumberA1.pdf,Descriptive,1,1
FUCO-0101,BUYING_GUIDE,,Http://mycompany.com/PartNumberA1.pdf,Descriptive,1,

Run the dataload script as follows.
C:\IBM\WCDE_ENT70\bin>dataload.bat C:\IBM\WCDE_ENT70\samples\DataLoad\Catalog\At
tributeDictionaryAttribute\wc-dataload.xml



The dataload process will first define the attribute BUYING_GUIDE in following tables.
Table name: ATTRDICT, Affected number of rows: 1.
Table name: ATTR, Affected number of rows: 1.
Table name: ATTRDESC, Affected number of rows: 1.


BUYING_GUIDE Attribute value is defined and then associated to the catentry.

Table name: ATTRVAL, Affected number of rows: 2.
Table name: ATTRVALDESC, Affected number of rows: 2.
Table name: CATENTRYATTR, Affected number of rows: 2.


As you can notice from the two datamodel, with Attribute dictionary model sample attribute and names can be shared among multiple catentries.

Here are reference to some of the useful Infocenter links on this topic.

Attribute dictionary data model
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=/com.ibm.commerce.data.doc/refs/rdmattrdict.htm

An excellent IBM tutorial on Classic attribute and attribute dictionary
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wcs/wcs/6.0.0.4/Customization/WCS6004_CatalogAttributeDictionary.pdf

Steps to hide display of classic attribute in Management Center.
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.management-center.doc/tasks/tpnhideclassattrib.htm
Pituluik Media Blogger | Freelancer |Operations Manager | Marketing and Sales Manager | Lancer Evo 4 Community. Indonesian Bloggers Who Become Bloggers Because of Hobby. Feel free to connect with me on Social Media Instagram @alberandesko

0 Response to "Attribute Dictionary and Classic Attribute Model"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel