Rule and Action Templates

Templates allow a section of a Rule or Action to be created, stored, and reused. Rules Templates can only be used in Rules and other Rules Templates, and Actions Templates can only be used in Actions and other Action Templates.

     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.

For 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 Add button 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: Templates are only compatible with the type that they are created for. ie. Action Templates are only compatible with Actions, and vice versa.

Parameters can be added, removed, and changed even when while 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 button.

    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.

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.