10.3.7. Contextualization of Properties

When we add a role type A to a role type R, all A’s properties become available on R. That is, we can add values for a property A$P to the representation of an instance of R. It is as if A$P was defined as one of R’s own properties.

In some circumstances, R might already have a property that can be seen as a local version of A$P. This is much like the situation where we have a role in a context that we want to add an aspect role to. So, in analogy, we would like to be able to specify that a property R$P should be considered as the specialization of A$P; that is, we want to add A$P as an ‘aspect property’ to A$R.

Notice that the defaults are different for roles than for properties. No aspect role is added implicitly to a specializing context, whereas we do want all aspect properties to be added implicitly to a specializing role. As a consequence, we need a different syntax to indicate what we want (explicitly adding all aspect properties would make our models very verbose).

Instead, we will write that an aspect property is replaced by a local property:

user Driver filledBy sys:PerspectivesSystem$User
  property License (String)
user Pilot
  aspect ta:Transport$Driver where
    License is replaced by Certification
  property Certification (String)

We expect the following effects from such a replacement:

  1. That a specialized perspective does not hold the aspect property, but its specialization (e.g. a perspective on Driver with property License, when specialized to Pilot should show Certification).

  2. That a calculation in the aspect that refers to License should, in effect, be computed as if License was replaced in the source text by Certification.

  3. That an assignment in the aspect on replaced property should be carried out on the replacement (e.g. when an assignment line sets License for Driver, it should set Certification for Pilot).

Obviously, the expected behavior 2 follows from runtime query contextualization. Behavior 1, in contrast, should be carried out on perspectives that are added from the aspect user role to a specializing user role – in compile time. Behavior 3, finally, will be carried out in runtime much as we do for action contextualization of role assignments.