A prototype is a special kind of a template, which has multiplicity properties (e.g. exactly 1, or 2-4). When a prototype is copied to create a specific model, each of its components is duplicated according to its default multiplicity (e.g. multiplicity ‘+’ indicated at least one instance is required, and 1 is created by default).
A model created from a prototype maintains a reference to its prototype, which enables easy maintenance of the constraints implied by the prototype and increases productivity: (1) At any point in time, Tersus Studio can validate a model to verify it is consistent with the constraints imposed by its prototype. Violations are graphically highlighted in the model diagram. (2) It is possible to update the prototype at a later stage and ensure all models created from it still conform to it. (3) A modeler can easily add instances of a component (up to the maximal number of instances allowed by the prototype). Tersus Studio suggests to the modeler all components that may be added to a model according to its prototype, and the modeler can add any of them by single mouse click. (4) Specifically, this enables the creation of prototypes with optional components. An optional component (marked by multiplicity ‘?’) is not created by default when a model is created from a prototype, but the modeler can choose to add it at any later stage. Similarly, adding an optional component to a prototype at a later stage makes it available for easy addition to all models created from the prototype.
Here's a quick write-up on prototypes (not proper documentation yet):
To turn a model into a prototype, add a shared property 'template' and set its value to 'prototype'
To add elements based on the prototype, right-click on the instance model, select 'Add Elements' and choose an element from the sub-menu.
By default, all elements are created with multiplicity 1 (so that the minimum number of instances, the maximum number of instances, and the default number of instances are all 1).
To change the multiplicity, add a local property 'prototype.multiplicity' to the element. It's value is interpreted as follows:
'example' : A single instance is created, but from then on the element is ignored (no validation, no suggestions in 'Add elements')
* : Any number of instances is valid (a single instance is created by default)
?: Both 0 and 1 instances are valid (a single instance is created by default)
+: The number of instances should be 1 or more (a single instance is created by default)
n-m: The number of instances should be between n and m, inclusive (n instances are created by default)
To modify the default number of instances created, add [d] where d is the number of instances created by default. Examples:
1-5 - The number of instances should be between 1 and 5, with 2 instances created by default
? - The number of instances should be 0 or 1, with no instances created by default