Technical description - Capability Templates

Introduction

This section describes Capability templates. First the concept of a template is introduced, then an overview of how a template is defined in a capability.

A template represents a named abstraction of a grouping of ISO 10303-239 entities that are to be instantiated in order to represent the concept. A template is analogous to a procedure in procedural programming languages.

The template will define:

This will be represented both graphically and textually.

About Capability Templates

A capability template defines a pattern that identifies precisely which parts of the information model is to be instantiated to represent a given business term. For example, to specify how to assign an organization to something such as a part in a role such as the design authority.

The pattern defined by the template is described both graphically and textually.

Each template can then be used in other templates.

Reading Capability Templates

An example of how a Capability Template works can be made by looking at the Capability "assigning_reference_data", which represents the assignment of a class (...explanation...) to something. The EXPRESS-G model diagram showing the entities that are to be instantiated are shown in Figure 1 below. A pattern like this is used throughout ISO 10303-239 to assign reference data. Therefor a number of EXPRESS-G and instance diagrams will have to repeat this pattern again and again, which will lead to complex and cluttered diagrams. Consequently a template can be created that provides an abbreviation for this pattern. This is what is called a Capability Template.



Figure 1 —  Entities to be instantiated by assigning_reference_data template

Figure 1 —  Entities to be instantiated by assigning_reference_data template

As well as specifying the group of entities to be instantiated, the template can also specify values for the entity attributes. These values may be mandatory, in other words the attribute always has a given value, or may be specified when the template is used. For example, the External_class_library description attribute shall always be set to '/IGNORE' wherever it is used. The Class name attribute however may be specified when the template is used. For example, when identifying a part number reference data is assigned to an Identification_assignment entity and the Class name attribute is set of 'Part_identification_code'. The values are set on the attributes by defining parameters on the template, which are set when the template is used. This is analogous to arguments in procedures in procedural programming languages.

There may be situations in which it is necessary to assign an entity to an entity defined in the template. For example, the template "assigning_identification" specifies that the entity Identification_assignment should be instantiated to assign the identifier. There are cases when a date should be assigned to the Identification_assignment entity. For example to represent when the identifier was assigned. A template can therefore have a reference parameter which is used to mark a particular entity in a template as being referenceable from outside the template. This is analogous to a global variable in procedural programming languages.

A template can be used in an information model (EXPRESS-G diagram) to show a named abstraction of EXPRESS entities to be instantiated, (See Figure 2 and 3 for an example) and can be used an instance diagram to show an example of a template being used (See Figure 4 for an example).

Templates for Information models - Graphical representation

The graphical representation of a template used in a DEX information model includes:

  1. A blue rectangle shaded yellow indicating a template;
  2. The name of the template is in bold text in the rectangle;
  3. If the rectangle has dashed lines then the use of the template is optional - otherwise the template is mandatory;
  4. The parameters of the template are included in the rectangle. If the parameter is to be set to a particular value, then it shall be assigned in the parameter call, e.g. date_class_name='Start_date';
  5. If any entity in the template is an assigning entity, i.e. it has an attribute whose type is another entity, the assignment is represented by an arrow from the template rectangle. (For example the blue arrows with "items" text in Figure 2 below).
  6. Templates or entities can be assigned to an entity "in" the template. This is represented by an arrow pointing at the template. In order to identify which entity in the template is being referenced, a reference parameter would have been set up and is listed next to the arrow head, prefixed by ^. An example is provided below in Figure 2 and 4.

As the graphic for the template may be large, a miniaturised symbol can be used for the template. This comprises:

  1. A blue rectangle shaded yellow indicating a template;
  2. A short name for the template in bold text in the rectangle;
  3. If the rectangle has dashed lines then the use of the template is optional;

An example of the graphical form for templates for use in a model diagram is shown in Figure 2.

The diagram shows an EXPRESS-G diagram representing the entities to be instantiated to assign an organization. The diagram shows a number of templates that are assigning entities. For example, the mandatory template "assigning_reference_data" is assigning to the entity "Organization_or_person_in_organization_assignment". The optional template "assigning_calendar_date" is assigning a date to the same entity.

The diagram also shows the Organization and Organization_or_person_in_organization_assignment entities being being marked as reference parameters (^organization and ^organization_assgn respectively) that can be referenced from outside the template. An example of the reference parameters being assigned to is given below in Figure 4.



Figure 2 —  Graphical representation of assigning_organization template

Figure 2 —  Graphical representation of assigning_organization template

The same example using miniaturised templates is shown in Figure 3.



Figure 3 —  Graphical representation of assigning_reference_data template

Figure 3 —  Graphical representation of assigning_reference_data template

An example showing the assignment of an entity to an entity "in" the template is given in Figure 4 below. The template "assigning_calendar_date" is being assigned to the reference parameter ^organization_assgn on the "assigning_organization" template. The reference parameter ^organization_assgn is bound to the Organization_or_person_in_organization_assignment entity in the "assigning_organization" template.



Figure 4 —  Graphical representation of assigning a template to an
          entity in a template

Figure 4 —  Graphical representation of assigning a template to an entity in a template

Templates for Instance Diagrams - Graphical representation

Instance diagrams show example instantiations of the model, i.e. instances of entities. The diagrams have been extended to include a graphic representing the template showing the instantiation of the template. It includes:

  1. A rounded rectangle indicating an instantiated template;
  2. An identification of the instantiated template in the diagram, prefixed by @;
  3. The name of the template being instantiated;
  4. The values passed as parameters to the template;
  5. An assignment of the template to other instances (the arrow).

As the graphic for the instantiated template may be large, a miniaturised symbol can be used for the template. This comprises:

  1. A rounded rectangle indicating an instantiated template;
  2. The object identifier (OID) of the instantiated template, prefixed by @;
  3. The short name of the template being instantiated;

Where miniaturised templates are used, there may be a table below the instance diagram showing the values of the parameters used.

An example of the graphical form for templates for use in an instance diagram is shown in Figure 5. The figure shows an instance diagram showing the entities instantiated to represent an organization owning a bicycle. The 'BikeHire Limited' organization is assigned to a bicycle (represented as a Product_as_realized) in the role of "Owner_of". The diagram shows two instantiated templates. @1assigning_classified_identification and @16assigning_reference_data.



Figure 5 —  Graphical representation of instantiated templates

Figure 5 —  Graphical representation of instantiated templates

The same example using miniaturised instantiated templates is shown in Figure 6.

Figure 6 —  Graphical representation of miniaturised instantiated templates

Figure 6 —  Graphical representation of miniaturised instantiated templates

The following templates are instantiated in the diagram:

Template Parameters
@3 asg_cls_id items=
#17
org_id=
BikeHire Limited
org_class_name=
Organization_name
org_ecl_id=
http://www.plcs.org/rdl
@16 asg_rd items=
#18
class_name=
Owner_of
ecl_id=
http://www.plcs.org/rdl
 

Templates definition

Templates are defined within a capability. This section describes the various section in the template definition.

Each template has a name, a description, a set of restrictions, a set of input and reference parameters and an instantiation path, where the instantiation path defines the EXPRESS entities that are to be instantiated. The template also includes Model diagrams and Instance diagrams.

Template name

The name provides an identifier for the template that is unique to DEXlib.

Template description

The description of the template is a free text description of the purpose of the templates.

Template restrictions

The template restrictions describe any constraints on the usage of the template. E.g. State when the template should not be used.

Template input parameters

Each template will define a set of input parameters. These allow values to be passed to the template when used in an instantiation path. The values can then be set to attributes in entities specified in the instantiation path.

Input parameters are passed into the template and their use in the path is indicated by @<param name>.

Each parameter may be marked as optional, indicating whether a value must be provided for the parameter.

A default value may be provided for the parameter.

The type of the parameter value may be specified as follows:

NOTE    Where the type is a class, then a possible set of classes can be identified. These may the super classes i.e. the class and its sub classes are valid values, or an individual class, in which case just the individual class is valid.

Template reference parameters

EXPRESS entities specified in the instantiation path can be bound to reference parameters. The reference parameter can then be used elsewhere in the instantiation path, in effect providing local variables.

The binding of an entity in a instantiation path to a reference parameter is done by enclosing the reference parameter, marked by ^ and the entity in %%. For example the entity External_class, can be bound to the reference parameter ^ext_class as follows:

%^ext_class = External_class%

The External_class can then be used elsewhere in the path by the use of ^ext_class.

If these entities are to be referenced when the template is used in the instantiation path of another template, then they are declared in the template heading as reference parameters.

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 two ways in which the constraint can be defined. An entity can be identified by stating the fixed values of a set of attributes, or an entity can be identified by the values of the template input parameters.

An example of a constraint based on the fixed values of a set of attributes is where is a requirement that any data set only contains one instance of the entity Product_category with the attribute name="Part". This would be defined by the following unique constraint:

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 a constraint based on the parameter values of a template is where a template instantiates a View_definition_context. This shown in in Figure 7.



Figure 7 —  Entity instantiated by a template

Figure 7 —  Entity instantiated by a template

The Life cycle stage and application domain of the View_definition_context are then provided by assigning reference data. The values for the reference data are provided by the template parameters: domain, domain_ecl_id, life_cycle_stage, life_cycle_stage_ecl_id. In any given dataset, there should only be one instance of a View_definition_context that has been classified with those parameter values. This would be defined by the following unique constraint:

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.

Template instantiation path

The instantiation path defines the set of entities that are to be instantiated by the template. It specifies:

The instantiation path is derived from the ISO 10303 SC4 reference path syntax (SC4 Document: QCN241) so must follow an EXPRESS instantiation.

The instantiation path may invoke other templates.

The following notational conventions apply for the definition of instantiation paths:

|| enclosed section constrains the supertype entity;
-> the attribute, whose name precedes the -> symbol, references the entity or select type whose name follows the -> symbol;
<- the entity or select type, whose name precedes the <- symbol, is referenced by the entity attribute whose name follows the <- symbol;
[i] the attribute, whose name precedes the [i] symbol, is an aggregate; any element of that aggregate is referred to;
[n] the attribute, whose name precedes the [n] symbol, is an ordered aggregate; member n of that aggregate is referred to;
=> the entity, whose name precedes the => symbol, is a supertype of the entity whose name follows the => symbol;
<= the entity, whose name precedes the <= symbol, is a subtype of the entity whose name follows the <= symbol;
= the string, select, or enumeration type is constrained to a choice or value;
\ the instantiation path expression continues on the next line;
-- the text following is a comment;
// Enclosed section invokes a template. The word following the / is the name of the template. The parameters to the template are name value pairs defined in () . E.g.
/assigning_reference_data (items=^this, class_name=@date_class_name, ecl_id=@date_ecl_id)/
@ The text following the @ is the name of a parameter that has been passed into the template. E.g.
External_class.name = @class_name
%% Enclosed section specifies that the entity is bound to a parameter, indicated by ^, that can be referenced from outside the template. E.g.
%^ext_class = External_class%
^ The text following the ^ is the name of a reference parameter that can be referenced from outside the template.
$ The text following the $ identifies a reference parameter in the preceding template call. The syntax is $<template_name>.<reference_parameter>, where <template_name> is the name of the template and <reference_parameter> is the name of a reference parameter for that template. E.g.
/assigning_organization(items=^part, org_assgn_class_name='Owner_of', org_id_class_name='CAGE')/
%^org_assgn = $assigning_organization.organization_assgn%
The template assigning_organization has a reference parameter ^organization_assgn. This is identified by $assigning_organization.organization_assgn and has been bound to the local reference parameter ^org_assgn.

Table 1 — Instantiation path syntax

Template example

Figure 6 shows a template assigning_organization. The template has 5 input parameters:

These are shown in the diagram in bold blue italic text. The digram also shows how the parameters are used to set values on the instantiated entities.

The template has two reference parameters:

The reference parameters are shown in the diagram in bold blue text prefixed by a ^.



Figure 7 —  Graphical representation of miniaturised instantiated templates

Figure 7 —  Graphical representation of miniaturised instantiated templates

The template path for the assigning_organization template shown above in Figure 7, is as below. The comments (lines starting with --) describes each line.

          -- Instantiate an Organization
          -- NOTE - an organization entity should only be instantiated once for
          -- any organization
          Organization
           
          -- Bind the Organization to the parameter ^organization.
          -- The parameter is a reference parameter so the Organization
          -- entity can be referred to when this template is used. 
          %^organization = Organization%
           
          
          -- Set the Organization attributes id and name to be ignored 
          Organization.id = '/IGNORE'
          Organization.name = '/IGNORE'
           
          
          -- Identify the Organization
          /assigning_classified_identification(items=^organization, 
          id=@org_id,
          id_class_name=@org_id_class_name, 
          id_ecl_id=@org_id_ecl_id)/      
           
          
          -- Instantiate an Organization_or_person_in_organization_assignment
          Organization_or_person_in_organization_assignment
          
          -- Bind the Organization_or_person_in_organization_assignment
          -- to the parameter ^organization_assgn 
          -- The parameter is a reference parameter so the 
          -- Organization_or_person_in_organization_assignment entity can be
          -- referred to when this template is used. 
          %^organization_assgn = Organization_or_person_in_organization_assignment%
           
          
          -- Set the Organization_or_person_in_organization_assignment
          -- role attribute to be ignored 
          Organization_or_person_in_organization_assignment.role = '/IGNORE'
          
          -- Assign the organization to the  
          -- Organization_or_person_in_organization_assignment
          Organization_or_person_in_organization_assignment.assigned_entity -> ^organization
           
          
          -- classify the Organization_or_person_in_organization_assignment 
          /assigning_reference_data(items=^organization_assgn, 
          class_name=@org_assgn_class_name, 
          ecl_id=@org_assgn_ecl_id)/
           
          
          -- Assign the Organization_or_person_in_organization_assignment.items 
          -- to the instances passed into the template through the @items
          -- input parameter
          Organization_or_person_in_organization_assignment.items -> @items