Previous Table of Contents Next


4.6.3 OCL Representation of Instance Constraints


   Constraints

   [C-6-1] A DataValue originates from a Classifier that is a DataType.context DataValue inv:self.classifier.oclIsKindOf(DataType)

   [C-6-2] A DataValue has no Slots.context DataValue inv:self.valueSlot->isEmpty

   [C-6-3] An Object may only own Objects and DataValues.context Object inv:self.contents->forAll(c | c.oclIsKindOf(Object) or c.oclIsKindOf(DataValue))

   [C-6-4] If an Object represents an association, at least two of its ends must not beempty.context Object inv:self.classifier.oclIsKindOf(Association) implies

   self.slot.feature->iterate( ae ; cnt : Integer = 0 | if ae.oclIsKindOf(AssociationEnd) and ae.value.notEmpty then cnt + 1 else cnt end if ) > 1

   [C-6-5] If the StructuralFeature describing a Slot is an AssociationEnd, the Classifier associated with the Object owning the Slot must be an Association.

context Slot inv:

   self.feature.oclIsKindOf(AssociationEnd) implies self.value.classifier.oclIsKindOf(Association)

   [C-6-6] A DataType instance associated with a DataSlot instance must be compatiblewith the type of the DataSlot indicated by the feature::type inherited from Slot.context DataSlot inv:self.dataType->notEmpty implies self.dataType.oclIsKindOf(self.feature.type)

   [C-6-7] The StructuralFeature instance obtained via the feature reference inherited from Slot must be an Attribute.context DataSlot inv:self.feature.oclIsTypeOf(Attribute)

   [C-6-8] The value reference inherited from Slot must be empty.context DataSlot inv:self.value->isEmpty()

   [C-6-9] If the Slot instance is not also a DataSlot, the value reference must be present. context Slot inv:self.oclIsTypeOf(Slot) implies self.value->notEmpty()