To get the sum of the Default Values of a Property


  1. Create an Opaque Behavior named 'Sum of Default Values of Property'.
  2. Right-click the Opaque Behavior element/symbol and open its Specification window. Do one of the following:
    1. Click the plus sign next to the Owned Parameter property to edit it.

      If you cannot see the Owned Parameter property, make sure the Expert mode is enabled.

    2. On the left side menu, select Parameters > Create.
  3. In the Specification of Parameter window, set Name to propertyType to PropertyDirection to in, and Multiplicity to [0..*]. Click Back.
  4. In the Opaque Behavior Specification window, click three dots  next to the Body and Language property to edit it.
  5. In the Body and Language dialog, select Language > StructuredExpression.

  6. Select Metachain Navigation.
  7. Click Insert.
  8. Under Metaclass or Stereotype, select Property, and under Property, select Default Value.
  9. Click Insert again.
  10. Under Metaclass or Stereotype, select LiteralReal, and under Property, select Value.
  11. Select Metachain Navigation > Context and set Value to property.
  12. Select Create Operation > Operation from Model > Reduce.

    If you cannot see the Operation from Model operation under Operations, make sure the Expert mode is enabled.

    If you cannot see the Reduce operation, make sure the Apply Filter box is not checked.

  13. Drag and drop the created Metachain Navigation onto Input.
  14. Select Reduce Operation > Script.
  15. From the Language drop-down list, select Javascript Rhino.
  16. Select Create parameter > Parameter.
  17. Insert the following script as the Body for the Script:

    Javascript Rhino
    arg1+arg2

  18. Click OK.

Sample model

The model used in these examples is the Case Studies for Querying the Model sample model. To open this model, you need to download case studies for querying the model.mdzip