Prev Next

Define Metamodel Constraints

When extending UML to develop a domain-specific Profile, Enterprise Architect allows you to specify constraints to restrict the connectors that can be drawn from a Stereotype, either using the Quick Linker or from the Toolbox. These constraints are defined using the relationships under the 'Metamodel' page of the 'Profile' toolbox.

Access

Ribbon

Design > Diagram > Toolbox: Hamburger icon > Profile

Keyboard Shortcuts

Ctrl+Shift+3

Add Metamodel Constraints to a Profile

Item

Detail

See also

Meta-Relationship

A «metarelationship» connector between two Stereotypes is used to specify a valid UML Connector between these two Stereotypes.

The name of the UML Connector should be set in the tag 'metaclass' on the «metarelationship» connector.

Showing how the metarelationship connector can be used to automatically create quicklinker definitions.

In the Profile example, a «metarelationship» connector is drawn from ServiceSpecification to ServiceInterface and the name of the UML Connector is specified in the 'Tags' tab of the Properties window for the connector.

After importing this Profile into a model, Enterprise Architect will show the UML Connector when the Quick Linker is used to draw a relationship between a ServiceSpecification and ServiceInterface.

Meta-Constraint

A «metaconstraint» connector between two Stereotypes is used to specify a constraint between these two Stereotypes.

The constraint should be set in the tag 'umlRole' on the Meta-Constraint connector.

Showing how the metaconstraint connector can be used to define model validation rules.

In the Profile example, a «metaconstraint» connector is drawn from ActualProjectMilestone to ProjectMilestone and the constraint is specified as classifier on the tag 'umlRole' in the connector's Tagged Values.

After importing this Profile into a model, Enterprise Architect will show only the ProjectMilestone stereotyped elements when assigning a classifier for ActualProjectMilestone element.

Constraint values for the tag 'umlRole' include:

  • classifier – restricts the classifier for the source Stereotype element to the target Stereotype element
  • type – restricts the type for the source Stereotype element to the target Stereotype element
  • behavior - restricts the behavior for the source Stereotype element to the target Stereotype element
  • conveyed - restricts the conveyed element for the source Stereotype element to the target Stereotype element
  • slot - restricts the slot for the source Stereotype element to the target Stereotype element
  • client/source/end[0].role/informationSource – restricts the source of a connector to the target Stereotype element
  • supplier/target/end[1].role/informationTarget - restricts the target of a connector to the target Stereotype element
  • realizingConnector/realizingActivityEdge/realizingMessage - restricts the relationship that can realize an information flow
  • typedElement/instanceSpecification – when dropping as classifier from the Browser window, this constraint restricts the type to the target Stereotype element
  • owner/class/activity/owningInstance – restricts the container of this element to the target Stereotype element; this constraint is used to create embedded element rules for the Quick Linker and validate nesting during Model Validation
  • ownedElement/ownedAttribute/ownedOperation/ownedParameter/ownedPort – restricts the element/attribute/operation/parameter/port that can be owned by the source Stereotype element; this constraint is typically used to validate nesting during Model Validation
  • annotatedElement/constrainedElement – restricts the target of a Note Link connector to the target Stereotype element
Constraints on Meta-Constraint connector

Stereotyped Relationship

A «stereotypedrelationship» connector between two Stereotypes is used to specify a valid stereotyped connector between these two Stereotypes.

The stereotype name should be set in the tag 'stereotype' on the «stereotypedrelationship» connector.

Showing how the stereotyped relationship connector can be used to automatically create quicklinker definitions and model validation rules.

In the Profile example, a «stereotypedrelationship» connector is drawn from ApplicationComponent to ApplicationEvent and the stereotype of the relationship is set to 'Assignment' in the connector's Tagged Values.

After importing this Profile into a model, Enterprise Architect will show the 'Assigned' option when the Quick Linker is used to draw a relationship between an ApplicationComponent and ApplicationEvent.

Note :

  • The value of the tag 'stereotype' on the «stereotypedrelationship» connector can be either a simple or a fully qualified connector stereotype

Special Metaclasses

You can specify the source of a connector to be a superclass of all specialized forms, and the target to a special metaclass that specifies a relationship to the actual metaclass when it is used. You use one of these terms as the element name for a Class element with the stereotype «metaclass».

Item

Detail

See also

source.metatype

The target element must match the exact stereotype defined at the source.

source.metatype.general

The target element can match the exact stereotype used at the source, and any concrete (isAbstract=false) generalized stereotypes.

source.metatype.specific

The target element can match the exact stereotype used at the source, and any concrete (isAbstract=false) specialized stereotypes.

source.metatype.both

The target element can match the exact stereotype used at the source, and any concrete (isAbstract=false) generalized or specialized stereotypes.

<none>

Use this metaclass name when you want to prevent the source element from inheriting the specified connector from its supertypes.

Learn More