Customizing the metamodel > Keywords for USRPROPS > HETEROGENEOUS (ONEOF, LISTOF)
  
HETEROGENEOUS (ONEOF, LISTOF)
HETEROGENEOUS enables a single property to refer to definitions of more than one type. (A normal list references definitions of a single type.) The HETEROGENEOUS keyword is used to modify either the ONEOF or the LISTOF keyword.
When you click the Choices button of a class list, only class definitions are provided to choose from.
When you click the Choices button of a heterogeneous list, you are provided with various types of definitions that are specified in the heterogeneous list clause, such as class, process, entity, and so on.
Syntax for ONEOF
PROPERTY property-name
{ EDIT HeterogeneousOneOf [ class ] [ reset ] type-1 { [ , type-n ] } ...
}
The reset clause clears any existing list of specified types for the property.
Syntax for LISTOF
PROPERTY property-name
{ EDIT HeterogeneousListOf [ class ] [ reset ] type-1 { [ , type-n ] } ...
}
The reset clause clears any existing list of specified types for the property.
Restrictions
There are certain restrictions for a heterogeneous list property. You cannot use any of the following keywords with the HETEROGENEOUSLISTOF or HETEROGENEOUSONEOF keyword in the same property:
The property must not be KEY.
It must not contain a KEYED (BY) clause.
It must not be COMPLETE.
It must not have a FROM clause.
It must not have a DEFAULT.
It must not be INITIAL USER REQUIRED.
It must not have a restriction (REFERENCED IN or WHERE) clause.
It must not have the INIT_FROM_SYMBOL attribution.
No type name can be listed more than one time.
Symbols cannot be referenced.
Adding values to the list
Most of the time, you are expected or are being restricted to dragging values into a heterogeneous property from the Select and Drag browser provided by clicking Choices. There are two other methods of entering new values into the property.
Adding the values manually
You can add the values manually. To add new values you must enter the new values with their fully-qualified name, in the following format:
ClassName:TypeName:FullyQualifiedName
where:
ClassName is the System Architect encyclopedia class type: Diagram or Definition.
TypeName is the specific name of the Diagram or Definition type, such as Class (definition) or Use Case Step (definition).
Each part of the FullyQualifiedName is separated by periods.
For example, a Use Case Step, which is keyed by its Use Case, which is keyed by its Package, would be entered as follows:
Definition:"Use Case Step":"package-name"."use-case-name"."use-case-step-name"
Adding values by using the + button
You can add new values is by clicking the + button.
1 Select a definition type; for example, Class.
A graphic depicting selecting a definition type; Class, for example.
2 Enter the new Class definition’s required properties, and then click OK. An edit session for the new Class definition opens.
A graphic depicting entering the new Class definition’s required properties.
3 Modify other properties of the new definition, and then click OK. A reference to the new definition is added to the heterogeneous property.
Example
In following example, the “Underlying Procedure” property of the “Procedure” definition can be populated with definitions of the type Use Case, Class, Method, and Use Case Step.
Definition " Procedure"
{
PROPERTY "Underlying Procedure"
{ EDIT HETEROGENEOUSLISTOF "Use Case", "Class", "Method", "Use Case Step" }
The user interface provided by the HETEROGENEOUSONEOF or HETEROGENEOUSLISTOF keyword displays a column that contains the name of each definition type, and the fully qualified name of the particular definition dragged into the list.
A graphic depicting the ’heterogeneous list’ user interface.
The key properties that qualify the name of a definition are provided in the user interface, separated from each other by . (periods). For example a Use Case Step is keyed to its containing Use Case, which is keyed by its containing Package. In the HETEROGENEOUSONEOF or HETEROGENEOSLISTOF field, a Use Case Step is represented by "package-name"."use-case-name"."use-case-step-name".
If there are embedded spaces in the name of any item, that item is enclosed in quotation marks. For example, in the picture above, the Use Case Step named "Approve Credit" is in the Use Case named Reservation_System, which belongs to the Package named "Reserve Room".
When you click Choices for a heterogeneous list, all called for types of Diagram, Symbol, or Definition are presented, with their type listed in brackets after their name.
This graphic is described in the surrounding text.
The Properties window also presents values of a heterogeneous list. You can drag the borders of the Properties rows or columns to see the values. Each value is preceded by its class type (Diagram, Symbol, or Definition), type name (that is, Use Case Step definition).
This graphic is described in the surrounding text.
See also
Keywords for USRPROPS