4.4.2. Create Rule

[Tip]Description

The create rule can be used for model element or relationship creation.

[Important]Syntax
CreateRuleAST ::= new ( CreateModelElementAST ) ;
                | new ( CreateRelationshipAST ) ;
	
CreateModelElementAST ::= QualifiedTypeNameAST ( VariableRefAST ) InConstraintOptAST 
                        | QualifiedTypeNameAST ( VariableRefAST , ArithmeticTermAST , ArithmeticTermAST )

InConstraintOptAST ::= $empty | in ArithmeticTermAST

CreateRelationshipAST ::= supertypeOf TwoParametersAST
                        | subtypeOf TwoParametersAST
                        | typeOf TwoParametersAST
	                      | instanceOf TwoParametersAST  

TwoParametersAST ::= ( ArithmeticTermAST , ArithmeticTermAST )
[Note]Semantics

When an entity is being created

  • it will be the instance of the specified type (qualified type name),

  • it will be contained either by the entity determined by the term if the in branch is present or by the root element of the model space by default, and

  • a reference to it will be stored in the variable reference.

When a relation is being created

If the variable is already bound when the create rule is called its value will be overwritten.

When a relationship is being created

  • supertypeOf: the first term identifies the supertype, and the second term identifies the subtype.

  • subtypeOf: the first term identifies the subtype, and the second term identifies the supertype.

  • typeOf: the first term identifies the type of the model element, and the second term identifies the instance.

  • instanceOf: the first term identifies the instance element, and the second term identifies the type.

Defined In:  model manipulation rule