5.2.4. Assignment statements for properties

5.2.4.1. The object of the perspective

For role assignment, we discussed the importance of the current context. For property assignment, a similar importance is attached to the object of the perspective. Remember that automatic actions are run for a user role having a perspective. A perspective has an object. The object is selected as a is query applied to the current context (it follows that there may not be an object and that there may be multiple objects).

Again, when the automatic effect is executed, there is a current object set (possibly empty). A the assignments are executed on each element of that object set in turn, binding an instance to the query variable object. It is available in the condition of the role state and in the effect making up the automatic action.

When we change the values of a property, we really change a role’s properties. If not stated otherwise, we change the properties of the current object set.

5.2.4.2. Operators

For assigning values to properties, we use a number of infix operators: =, =+, =-. We also re-use the delete operator we’ve seen for roles, but with an extra keyword property. However, property values are not moved or created, neither bound nor unbound.

5.2.4.3. =, =+, =-

The syntax for these three operators is the same. For example:

PropertyType =+ 10

would add the value 10 to the existing set of values for PropertyType for each element in the current object set.

In order to change the property values of another role, we provide an extra clause:

PropertyType =+ 10 for <roleExpression>

Here, <roleExpression> is a query executed on the current context. Of course it can select roles outside the current context, too.

An expression can be used on the right of the operator:

PropertyType =+ SomeRole >> AnotherProperty

The meaning of this expression is: add the value(s) of AnotherProperty, for each of the role instances of SomeRole, to those of PropertyType (of the same instance). The query expression is evaluated relative to the current context.

5.2.4.4. Delete

This is how to delete all values for a property on the instances in the current object set:

delete property PropertyType

And here is to delete the values on another role instance:

delete property PropertyType from <roleExpression>