Help TOC > Instructions for DEX developers > Developing Templates
Developing Templates Date: 2008/02/25 13:41:28
Revision: 1.7

Introduction

This section outlines how to develop a template.

Uniqueness constraints

There are some circumstances where a combination of attribute values can be used to uniquely identify an instance of an EXPRESS entity in a given data set. These circumstances are normatively declared by a uniqueness constraint.

There three ways in which the constraint can be defined.

An example of the XML for the first case where uniqueness is defined by predefined values set on the entity is:

      <unique_rule_attribute name="Unique product_category">
          <description>Product_category.name = 'part'</description>
          <unique_attribute entity="Product_category" attribute="name" value="Part"/>
      </unique_rule_attribute>
    

This results in the following constraint being displayed:

Unique constraint: Unique product_category
There shall be at most one instance of the entity (Product_category) with the attribute (name="Part") instantiated in the data set.

An example of the XML for the second case where the uniqueness is defined by input parameters on the template is:

      <unique_rule_param name="Unique view_definition_context">
      <unique_param param="domain"/>
      <unique_param param="domain_ecl_id"/>
      <unique_param param="life_cycle_stage"/>
      <unique_param param="life_cycle_stage_ecl_id"/>
      <unique_entity ref_param_in_path="contxt"/>
      </unique_rule_param>
    

This results in the following constraint being displayed:

Unique constraint: Unique view_definition_context
There shall be at most one instance of the entity (View_definition_context) within the data set uniquely identified by a combination of the following template parameters: domain, domain_ecl_id, life_cycle_stage, life_cycle_stage_ecl_id. The instance is referenced by the following template parameter: contxt.

An example of the XML for case where the uniqueness of an entity is specified by a set of templates instantiated with predefined values is:

    <unique_rule_param name="Unique unit">
      <unique_templates_with_values>
        <!-- a list of templates that are assigned to the
          entity whose uniqueness is being specified, where the template has 
          set parameter values that are part of the uniqueness constraint -->
        <unique_template_with_value template="assigning_reference_data" id="#1">
          <unique_templates_with_value_param param="class_name" param_value="Count"/>
          <unique_templates_with_value_param param="ecl_id" param_value="urn:plcs:std:rdl"/>
        </unique_template_with_value>
      </unique_templates_with_values>    
      <unique_entity ref_param_in_path="unit"/>     
    </unique_rule_param>
    

This results in the following constraint being displayed:

Unique constraint: Unique Count unit
There shall be at most one instance of the entity (Unit) within the data set uniquely identified by the parameter values set on the following templates instantiated by representing_count namely: template #1 assigning_reference_data(class_name=Count, ecl_id=urn:plcs:std:rdl).
The instance is referenced by the following template parameter: unit.