Skip to content

Eclipse UML2

The UML2 adapter identifies elements of UML models as traceable artifacts. UML models are configured as UML2 data access. UML elements are identified based on their metatypes, their assigned stereotypes, or their namespaces. For example, you might want to recognize only artifacts of type Class with stereotype «SafetyRelevant» that are in the safety package.

This adapter supports selection propagation: If you select an element in ANALYZE, the selected artifact will be opened in Eclipse’s UML model editor, and if you select an element in the UML model editor, it will be opened in ANALYZE.

Data access

Configuration

Open the ANALYZE configuration with the ANALYZE configuration editor, and add a new data access as described in section "Data accesses". Select UML2 as data access type.

Supported options:

  • resource – File filter pattern

Example:

resource *.uml

This configuration specifies that ANALYZE should load all files residing in the workspace whose filename extension is .uml.

Please note that this adapter supports files with .uml filename extension only.

Artifact type

Configuration

Open the ANALYZE configuration with the ANALYZE configuration editor, and add a new artifact type as described in section "Artifact types". Select your previously-configured Eclipse UML2 data access in the Data access drop-down list.

Example:

name valueOf("qualifiedName") 
subset namespace model
subset metatype uml.Operation
subset metatype uml.Class
map {
	attr to valueOf("isLeaf")
}

This example shows an artifact type configuration for the UML2 adapter. It provides all classes and operations in the model namespace that are residing in the uml package. Extracted artifacts are named according to their respective qualifiedName attribute. The custom attribute attr is mapped to the value of the isLeaf attribute of the matched element. Instead of explicitly specifying identifiers like model, you can also construct these identifiers by using complex string expressions. Within these, you can refer to attributes of UML elements via the valueOf keyword.

Keywords

The Eclipse UML2 artifact type configuration supports the following keywords:

  • name expr – Specifies the name of the artifact as the value of the expression expr. By default, this is the FQN, if defined. Otherwise, the element’s URI is used.
  • subset namespace – Filters elements by namespace.
  • subset metatype – Filters elements by metaclass.
  • subset stereotype – Filters elements by stereotype.
  • map – Maps artifact properties to custom attributes. For each attribute, this clause contains an expression of the form attribute to expression, where attribute is the attribute name, and expression defines how the assigned value is computed.
  • valueOf( elem) – Retrieves the value of the specified attribute elem for the current element. The attribute can be the name of any parameter defined for this element. The Name attribute is predefined and returns the name of the element. However, the configuration may specify any other value.

Content assist will show you a list of available stereotypes and metatypes, where appropriate. Place the text cursor right from subset metatype or subset stereotype, leave at least one space, and press [Ctrl]+[Space].

Please note that the configuration supports using the same keyword multiple times. For example, the expressions subset metatype uml.Class and subset metatype uml.Operation in the same configuration means "all Class or Operation elements in the uml package".

Version

An artifact’s version is used for suspicious links validation. The version of an artifact of this type is the URI of the element.

Relationships within a UML model can be interpreted directly as trace links. ANALYZE derives trace links based on UML relationships and their navigability.

Open the ANALYZE configuration with the ANALYZE configuration editor, and add a new link type as described in section "Configuring a link type".

  • As at least one of A and B, select an UML2 artifact type with Eclipse UML as its adapter. If you want to derive links from and to the same artifact type, choose this type both as A and as B.
  • As data access, select the very same UML2 data access that has already been assigned to the artifact types A and B.

Mapping example:

subset metatype uml.Association
subset metatype uml.DirectedRelationship
map {
	attr to valueOf("Navigable")
}

This example shows a link type configuration for the UML2 adapter. It extracts all Association and DirectedRelationship elements that are residing in package uml as trace links. The custom attribute attr of these links is mapped to the value of the Navigable attribute of the matched element.

The Eclipse UML2 link type configuration supports the following keywords:

  • subset metatype – Filters links by their metatype.
  • map – Maps link properties to custom attributes. For each attribute, this clause contains an expression of the form attribute to expression, where attribute is the attribute name and expression defines how the assigned value is computed.
  • valueOf( elem) – Retrieves the value of the specified attribute elem for the current element. The attribute can be the name of any parameter defined for this element. The Name attribute is predefined and returns the name of the element. However, the configuration may specify any other value.

Content assist will show you a list of available metatypes, where appropriate. Place the text cursor right from subset metatype, leave at least one space, and press [Ctrl]+[Space].

Please note that the configuration supports using the same keyword multiple times. For example, the expressions subset metatype uml.Association and subset metatype uml.DirectedRelationship in the same configuration means "all Association or DirectedRelationship in package uml.

A link’s version is used for suspicious links validation. The version of a UML2 link contains the relationship’s URI in the UML model, but we have to differentiate between two cases:

  • In the UML model, there’s a bidirectional or undirected relationship between elements E1 and E2. In this case, ANALYZE derives two trace links from the UML relationship: one from E1 to E2 and a second one from E2 to E1. Using the UML relationship’s URI as the version of both trace links would be ambiguous. In order to avoid that, the trace link’s version evaluates to the string concatenation of the relationship’s URI and the respective source element’s URI.
  • In the UML model, there’s a unidirectional relationship from element E1 to E2. In this case, the UML relationship’s URI would be unambiguous as the trace link’s version. However, in order to be consistent with the first case, the trace link’s version here also evaluates to the string concatenation of the relationship’s URI and the source element’s URI.