Containment Example
This example shows how to configure a concept
Car to contain a concept
Wheel by adding a
ContainedConcept property
Wheels, whose value is an instance of the concept
Wheel.
The
Wheels property provides the link between the container and contained concept:
Car (Concept) —
Wheels (property) —
Wheel (Concept)
The concept
Car contains four instances of the contained concept
Wheel, so you define the property as an array. The concept
Car could also contain other concepts, such as
Door and
Engine, defined in a similar way using
ContainedConcept properties.
However, the contained concepts —
Wheel,
Door, and
Engine — cannot be contained by any other concept type. They can only be contained by the
Car concept. For example, the concept
Wheel cannot be contained in the concept
Motorbike, if it is already contained by the concept
Car.
ContainedConcept property. You can use inheritance, however, to achieve a result similar to that gained by the general programming technique of linking to multiple contained class properties. Suppose you extend the concept
Wheel by creating child concepts
CarWheel and
MotorcycleWheel. You can then use
CarWheel as the concept contained by
Car, and
MotorcycleWheel as the concept contained by
Motorcycle. Rules that apply to
Wheel also apply to
CarWheel and
MotorcycleWheel, because of inheritance.
Depending on your needs, another option would be to use a reference relationship instead of a containment or inheritance relationship.