4.4.6. Element Update Rule

[Tip]Description

An element update rule changes a property of a model element.

[Important]Syntax
ElementUpdateRuleAST ::= ElementUpdateOpAST ( ArithmeticTermAST , ArithmeticTermAST ) ;

ElementUpdateOpAST ::= rename | setValue | setFrom | setTo
                     | setMultiplicity | setAggregation | setInverse

All element update rules have two parameters. The first identifies the model element to be updated, while the second contains the new value.

[Note]Semantics

The setInverse rule defines an inverse relation between two relations. Both parameters are ASM terms that must evaluate to model element constants referencing relations; the inverse property is set for both relations having a reference to the other relation as the new value.

  • The rename rule modifies the name of a model element. Both parameters are ASM terms; the first must evaluate to a model element constant referencing an entity or relation, the second must evaluate to a string that will be the local name of the model element. Since the new name is required to be unique within its container (in case of entities) or within the source element (in case of relations), a possible name clash is resolved automatically by the interpreter at run-time by extending the name of the renamed model element with a randomly generated tag.

  • The setValue rule modifies the value of an entity. Both parameters are ASM terms; the first must evaluate to a model element constant referencing an entity, the second must evaluate to a string that will be the new value assigned to the entity. If the second parameter is not evaluated to a string an implicit conversion to string is performed.

  • The setFrom rule sets the source of a relation. Both parameters are ASM terms that must evaluate to model element constants; the first references a relation, the second references an arbitrary model element that will be the new source of the relation.

  • The setTo rule sets the target of a relation. Both parameters are ASM terms that must evaluate to model element constants; the first references a relation, the second references an arbitrary model elementthat will be the new target of the relation.

  • The setMultiplicity rule modifies the multiplicity property of a relation. Both parameters are ASM terms; the first must evaluate to a model element constant referencing a relation, the second must evaluate to a multiplicity value that will be the new value assigned to the relation.

  • The setAggregation rule modifies the aggregation property of a relation. Both parameters are ASM terms; the first must evaluate to a model element constant referencing a relation, the second must evaluate to a boolean value that will be the new value assigned to the relation.

Defined In:  model manipulation rule

See Also:  entity, relation, model element name, model element constant, string constant, multiplicity constant, boolean constant