Precedence rule create operations

The Configuration Web Service has two operations to create precedence rules.

The two create operations are:
  • The putPrecedenceRules operation creates each of the given precedence rules or updates them if they already exist. Existing rules that are not specified in the operation are not affected.
  • The importPrecedenceRules operation first removes all existing precedence rules, and then adds the given ones. Use this operation when you want a new set of precedence rules.

The precedence rules take effect as soon as they are loaded into the Dgraph. The precedence rule is stored by the Dgraph process as a record in its data files, so that the precedence rules are automatically reloaded each time the Dgraph process is re-started.

Both operations use the same schema syntax for the precedenceRule element:
<mdex:precedenceRule 
   key="ruleName" 
   triggerAttributeKey="triggerAttrName"
   triggerAttributeValue="mval|sval" 
   targetAttributeKey="targetAttrName"
   isLeafTrigger="true|false"/>
The meanings of the precedenceRule attributes are as follows:
precedenceRule attribute Meaning
key Specifies a unique identifier for the precedence rule (that is, it is the name of the rule). The identifier is a string, which does not have to follow the NCName format.
triggerAttributeKey Specifies the name of the Endeca standard attribute or managed attribute that will trigger the precedence rule. That is, the specified attribute must be selected before the user can see the target attribute.
triggerAttributeValue Optional. If used, specifies the attribute value (either managed value spec or standard attribute value) that must be selected before the user can see the target attribute. If not used, then any value in the trigger attribute will trigger the rule. Use of triggerAttributeValue in effect further refines the trigger to a specific standard or managed value.
targetAttributeKey Specifies the name of the Endeca standard or managed attribute that appears after the trigger attribute value is selected.
isLeafTrigger If the trigger is a managed attribute, isLeafTrigger specifies a Boolean value that denotes the type of the trigger attribute value:
  • If true, the trigger attribute is a leaf type, which means that the precedence rule will fire only if a leaf value is selected. That is, querying any leaf managed value from the trigger managed attribute will cause the target managed value to be displayed (many triggers, one target).
  • If false (the default), the trigger attribute is a non-leaf type, which means that the precedence rule will fire when any value is selected. That is, if the managed value specified as the trigger or any of its descendants are in the navigation state, then the target is presented (one trigger, one target).

Note that isLeafTrigger does not apply to Endeca standard attributes. You must specify it when you create a precedence rule, but whichever value you use is ignored by the Dgraph when the precedence rule is run.

putPrecedenceRules example

The following is an example of a putPrecedenceRules operation that creates a precedence rule named CityRule:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
   xmlns:ns="http://www.endeca.com/MDEX/config/services/types/3/0" 
   xmlns:ns1="http://www.endeca.com/MDEX/config/XQuery/2009/09">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:configTransaction>
         <ns:putPrecedenceRules>
             <ns1:precedenceRule
                key="CityRule" 
                triggerAttributeKey="DimGeography_StateProvinceName" 
                triggerAttributeValue="Victoria" 
                targetAttributeKey="DimGeography_City" 
                isLeafTrigger="true"/>
         </ns:putPrecedenceRules>
      </ns:configTransaction>
   </soapenv:Body>
</soapenv:Envelope>