R1163 - modelint/shlaer-mellor-metamodel GitHub Wiki
R1163 / Mc:Mc-1
Model Attribute is accessed in zero, one or many Extend Action
Extend Action accesses value of zero, one or many Model Attribute
Consider the following Scrall expression that operates on a Tank
class with Attributes ID
, Pressure
, and Temperature
.
Tank(*)
selects all instances of Tank.
Within the []
brackets, the Rename Action renames the Temperature
Attribute to the F temp
Table Attribute in the new Table. Then the Extend Action adds the F Temp
Table Attribute. In parenthesis we see the Farhenheit()
type operation invoked on the Tank.Temperature value. We assume here that the Attribute was defined as Temperature
(coincidentally the same name as the Attribute) and that this Scalar type provides the units conversion operation so that we can just invoke it.
We then apply a Project Action to obtain a Table with three columns. The resulting Table Flow is labeled as tank temps
via the Scrall #=
table assignment operator.
tank temps #= Tank(*)[Temperature >> C temp, >> F temp (Temperature.Fahrenheit())].(ID, C temp, F temp)
Note that within the Extend Action, we see that for any given instances of Tank, the Tank.Temperature
value is an input to the extension computation within the parenthesis. For any given Extend Action, any number of Model Attributes in the input Class or Table may supply Scalar input to the computation of the extended Table Attribute value. Each such input is manifested as a Scalar Flow via R1170.
A given Model Attribute may or may not contribute to any number of Extend Action computations.