Loading the managed attribute schema

This topic describes implementation details of graphs to load the Dimension Description Records (DDRs) to create the managed attribute schema.

Use a CSV-based configuration graph to load the managed attribute schema. See CSV-based configuration graphs.

Input file

The Dimension Description Record (DDR) has the same name as the associated standard attribute. It is used to create a hierarchy of standard attribute values. The input file resembles the following illustration:

Example DDR input file. The file is described in detail in the text.
The first line of the sample file is the header row, which specifies the properties defined in the input file. In this example, the following properties are defined:
Key,Refinement,DimSearch,RecHierarchy

The names of these properties are arbitrary; you can use different names in your input file if you choose (for example, you can use AttrName instead of Key). The properties are delimited (for example, by the comma in a CSV file or the pipe character in a text file).

In this example, the header properties map to these DDR properties:
Input Header Property Maps to PDR Property
Key mdex-dimension_Key
Refinement mdex-dimension_EnableRefinements
DimHierarchy mdex-dimension_IsDimensionSearchHierarchical
RecHierarchy mdex-dimension_IsRecordSearchHierarchical

Managed attribute Transformer

In the configuration graph, use a Transformer component to build the XML to submit to the server to define your standard attribute schema. The XML consists of a set of DDRs (<mdex:record>), each of which is comprised of attribute properties (for example, <mdex-dimension_EnableRefinements>, <mdex-dimension_IsDimensionSearchHierarchical>, and <mdex-dimension_IsRecordSearchHierarchical>).

The following code builds an XML from the input file illustrated above:

//#CTL2

integer n = 1;
integer aggrKey = 0;

// Transforms input record into output record.
function integer transform() {
   string maBool = "";
   string maRecord = "<mdex:record xmlns=\"\">";
   maRecord = maRecord + "<mdex-dimension_Key>" + $0.Key + "</mdex-dimension_Key>";

   // Make sure to lower case the booleans in the CSV file
   maBool = lowerCase($0.Refinement);
   maRecord = maRecord + "<mdex-dimension_EnableRefinements>" + maBool + "</mdex-dimension_EnableRefinements>";

   maBool = lowerCase($0.DimHierarchy);
   maRecord = maRecord + "<mdex-dimension_IsDimensionSearchHierarchical>" + maBool + "</mdex-dimension_IsDimensionSearchHierarchical>";

   maBool = lowerCase($0.RecHierarchy);
   maRecord = maRecord + "<mdex-dimension_IsRecordSearchHierarchical>" + maBool + "</mdex-dimension_IsRecordSearchHierarchical>";

   $0.xmlString = maRecord + "</mdex:record>";

   // Batch up the web service requests.
   $0.singleAggregationKey = aggrKey;
   n++;
   if (n % 15 == 0) {
      aggrKey++;
   }

   return ALL;
}

First, the code defines two integer variables, the first as a loop counter, the second as the aggregation key (aggKey).

Next, the transform() function builds the DDRs by creating the <mdex:record> container, and adding the <mdex-dimension_EnableRefinements>, <mdex-dimension_IsDimensionSearchHierarchical>, and <mdex-dimension_IsRecordSearchHierarchical> nodes. The value of each node is derived from the corresponding value in the input file.

Note that in the example input file, the values are specified in ALL CAPS. Convert these values to lower case before adding them to the XML.

Finally, the records are grouped into batches of 15 for submission to the server. Submitting in batches ensures a continuous stream of processing through all components in the graph, which improves the performance of both Integrator ETL and the Endeca Server.

Web service request

Use the updateDimensions operation of the Configuration Web Service to load the DDR configurations into the Endeca Server. The following code illustrates a typical updateProperties operation to load DDRs:

<config-service:configTransaction 
  xmlns:config-service="http://www.endeca.com/MDEX/config/services/types/3/0">
  <config-service:OuterTransactionId>${OUTER_TRANSACTION_ID}</config-service:OuterTransactionID>   
<config-service:updateDimensions 
      xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
        $xmlString
    </config-service:updateDimensions>
</config-service:configTransaction>

This example includes two variables:

  • OUTER_TRANSACTION_ID

    This variable specifies the outer transaction ID for the request. The variable and its value are stored in the workspace.prm file of the Integrator ETL project.

  • $xmlString

    This variable contains the PDRs that have been constructed by the Reformat component in the graph.

This code is added to the Web Services Client component in the configuration graph.