Contents > 8 Defining Custom Design Metrics and Rules > 8.1 Definition of Metrics > 8.1.1 Projection > 8.1.1.2 Attribute "relset"

8.1.1.2 Attribute "relset"

Instead of relations, you can also feed element sets into the projection. For example, packages have a multi-valued attribute "ownedmembers" in the UML2 metamodel. We can count the number of elements in that set as follows:
<metric name="NumMembers" domain="package"> 
  <description>The number of owned members of the package.</description>
  <projection relset="ownedmembers" />
</metric>
Sources for sets can be Attribute "relset" defines a set expression (see Section 8.5.3 "Set Expressions") which is evaluated for the current element. The metric then counts the number of elements in that set.

For a projection, exactly one of the attributes "relation" or "relset" must be specified.