COGENT's rule-based modelling language allows complex processes to be specified in terms of production-like rules. Each rule consists of a set of conditions, a set of actions, and, optionally, a trigger. Conditions include logical operations whose outcome may be true or false, such as matching an element in a buffer or testing the equality of data elements. Actions result in messages of various forms being sent to other boxes. A simple rule may have the following form:
|if||minuend(X) is in Working Memory and
subtrahend(X) is in Working Memory
|then||add equal(minuend, subtrahend) to Working Memory
send difference(0) to Write Answer
This rule fires when Working Memory contains two elements of the form minuend(X) and subtrahend(X) (where X is a variable). On firing, the rule adds a further element to Working Memory (equal(minuend, subtrahend)) and sends a message of the form difference(0) to another box, Write Answer.
The figure below shows some more complex rules:
On each processing cycle, all non-triggered rules whose conditions are satisfied are fired in parallel. Triggered rules fire only when the process in which they are contained receives a message that matches the rule's trigger. A structured, menu-driven, editor is provided to simplify the process of writing rules and to ensure that all rules are well-formed.