skip to main content
Corticon Studio: Rule Modeling Guide : Rules containing calculations and equations : Terminology
 

Try Corticon Now

Terminology

First we will introduce some terminology that will be used throughout this chapter. In the simple expression A = B, we define A to be the Left-hand Side (LHS) of the expression, and B to be the Right-hand Side (RHS). The equals sign is an Operator, and is included in the Operator Vocabulary in Corticon Studio. But even such a simple expression has its complications. For example, does this expression compare the value of A to B in order to take some action, or does it instead assign the value of B to A ? In other words, is the equals operator performing a comparison or an assignment? This is a common problem in programming languages, where a common solution is to use two different operators to distinguish between the two meanings -- the symbol == might signify a comparison operation, whereas := might signify an assignment.
In Corticon Studio, special syntax is unnecessary because the Rulesheet itself helps to clarify the logical intent of the rules. For example, typing A=B into a Rulesheet's Condition row (and pressing Enter) automatically causes the Values set {T,F} to appear in the rule column cell drop-down lists. This indicates that the rule modeler has written a comparison expression, and Studio expects a value of true or false to result from the comparison. A=B, in other words, is treated as a test – is A equal to B or isn't it?
On the other hand, when A=B is entered into an Action or Nonconditional row (Actions rows in Column 0), it becomes an assignment. In an assignment, the RHS of the equation is evaluated and its value is assigned to the LHS of the equation. In this case, the value of B is simply assigned to A. As with other Actions, we have the ability to activate or deactivate this Action for any column in the decision table (numbered columns in the Rulesheet) simply by checking the box that automatically appears when the Action's cell is clicked.
In the Rule Language Guide, the equals operator (=) is described separately in both its assignment and comparison contexts.
Note: A Boolean attribute does not reset when non-boolean input is provided for a non-conditional rule
While this is the expected behavior in the Corticon language, it can cause unexpected results. On input of a Boolean attribute, if the value of the XML element is true or 1, Corticon interprets that as a true Boolean value, otherwise it defaults to a false Boolean value. Attributes in the input document are not modified unless the value is actually changed in the rule; that is, setting a true Boolean attribute to the value of true does not modify the XML.
Note: You can have reliable behavior when you use following workaround. To guarantee a modification in the XML, you need to guarantee that the rules actually change the value of the attribute. For example, instead of action...
Entity_1.booleanAttr1 = T
Note: ...first set the value of the attribute to null, and then set it to true:
Entity_1.booleanAttr1 = null
Entity_1.booleanAttr1 = T