Rule and Action Templates

Templates allow a section of a Rule or Action to be extracted, stored, and reused. Templates are separated by type; Rules and Actions, and can be used in Templates of the same type.

     Note: Templates cannot reference themselves as this would cause a circular reference, making the rule loop infinitely.

If a modification is made, the change is picked up by all items referencing the template.

     Note: You cannot delete a template when it is referenced.

Referencing one template inside another template allows trees of Rule templates that can be created with a Rule or Action at the root.

     Note: If a template tree is too deep, you may experience performance issues.

All Templates can start with a Value or a Predicate, while only Action Templates can start with an Operation.

     Example: A template can be used to define the relationship between road elements that make up a roundabout. The parameters are the objects that define the roundabout, and the output is a geometry value. This template can then be used in all Rules that need to access roundabout geometries.

Creating Templates

Create a Template using the New icon or via the context menu in the Navigation pane in either the Rules or Actions tabs. The object is defined in an Read and Commit parameter to the template. A template can have zero to many parameters.

     Note: Action Templates can only be inserted into other Actions.

A Template that is fully configured

Parameters can be added, removed, and changed even when the template is referenced.

     Warning: If the first node of a Template has its type changed (eg. Predicate to Value) then any Rules/Actions using the template will lose functionality until the correct component type is used.

ClosedCreate a new Template

  1. Navigate to the Rules/Actions tab.

  2. In the Navigation Pane, create a Rule Template or an Action Template.

  3. (Optional) Set the Context and add parameters with the Add icon .

    Set the Class and Name parameters

    Add more Class and Name pairs if needed.

  4. Add component nodes as you would with any other Rule or Action.

  5. Click Save.

    The Template is now ready to use.

ClosedExtract A Template

  1. Open a Rule or Action that has the structure that you want for your Template.

  2. Right click the node you want to make a Template from.

Using a Template

Templates can be used within Rules, Actions, or other Templates.

A Template that has been inserted into a Rule

Templates automatically inherit the Class and Attribute parameters from the Root node at the point in time they are added. This can be manually changed if needed.

ClosedAdding a Rule Template

  1. Open the Rule that you want to add the Template to.

  2. Click the required node and select Rule Template.

  3. Select a Template and click Select. The Rule Template is inserted into the rule.

ClosedAdding an Action Template

  1. Open the Action that you want to add the Template to.

  2. Click the required node and select Action Template.

  3. Select a Template and click Select. The Action Template is inserted into the action.