Previous Table of Contents Next


4.3.4 OCL Representation of Core Constraints


4.3.4.1 Operations

   The operation allFeatures results in a Set containing all Features of the Classifier itself and all its inherited Features.

   allFeatures : Set(Feature);allFeatures = self.feature->union(self.parent.oclAsType(Classifier).allFeatures)

   The operation allAttributes results in a Set containing all Attributes of the Classifieritself and all its inherited Attributes.

   allAttributes : set(Attribute);allAttributes = self.allFeatures->select(f | f.oclIsKindOf(Attribute))

   The operation specification yields the set of Classifiers that the current Classifierrealizes.

   specification: Set(Classifier)specification = self.clientDependency->select(d | d.stereotype.name = "realization"

    and d.supplier.oclIsKindOf(Classifier)).supplier.oclAsType(Classifier)

   The operation parent returns a Set containing all direct parents of a Classifier.

   parent : Set(Classifier);parent = self.generalization.parent

   The operation allParents returns a Set containing all the Classifiers inherited by this Classifier (the transitive closure), excluding the Classifier itself.

   allParents : Set(Classifier);allParents = self.parent->union(self.parent.allParents)

   The operation allContents returns a Set containing all ModelElements contained in the Classifier together with the contents inherited from its parents.

   allContents : Set(ModelElement); allContents = self.contents->union(self.parent.allContents-> select(e | e.elementOwnership.visibility = #public or e.elementOwnership.visibility = #protected))

   The operation supplier results in a Set containing all direct suppliers of the ModelElement.

   supplier : Set(ModelElement);supplier = self.clientDependency.supplier

   The operation allSuppliers results in a Set containing all the ModelElements thatare suppliers of this ModelElement, including the suppliers of these Model Elements. This is the transitive closure.

   allSuppliers : Set(ModelElement);allSuppliers = self.supplier->union(self.supplier.allSuppliers)

   The operation contents results in a Set containing all ModelElements contained bythe Namespace.

   contents : Set(ModelElement)contents = self.ownedElement -> union(self.namespace.contents)

   The operation allContents results in a Set containing all ModelElements containedby the Namespace.

   allContents : Set(ModelElement);allContents = self.contents

   The operation allVisibleElements results in a Set containing all ModelElements visible outside of the Namespace.

   allVisibleElements : Set(ModelElement) allVisibleElements = self.allContents -> select(e | e.elementOwnership.visibility = #public)

   The operation allSurroundingNamespaces results in a Set containing all surrounding Namespaces.

   allSurroundingNamespaces : Set(Namespace) allSurroundingNamespaces = self.namespace->union(self.namespace.allSurroundingNamespaces)

   The operation contents results in a Set containing the ModelElements owned by orimported by the Package.

   contents : Set(ModelElement)contents = self.ownedElement->union(self.importedElement)

   The operation allImportedElements results in a Set containing the ModelElements imported by the Package.

   allImportedElements : Set(ModelElement)allImportedElements = self.importedElement

   The operation allContents results in a Set containing the ModelElements owned by or imported by the Package.

   allContents : Set(ModelElement)allContents = self.contents

4.3.4.2 Constraints

   [C-3-1] A Constraint cannot be applied to itself.context Constraint inv:not self.constrainedElement->includes (self)

   [C-3-2] A DataType cannot contain any other ModelElements.context DataType inv:self.ownedElement->isEmpty

   [C-3-3] Tags associated with a model element (directly via a property list or indirectly via a stereotype) must not clash with any meta attributes associated with the model element.

   context ModelElement inv:

   -- cannot be specified with OCL

   [C-3-4] A model element must have at most one tagged value with a given tag name.context ModelElement inv:self.taggedValue->forAll(t1, t2 : TaggedValue |

   t1.tag = t2.tag implies t1 = t2)

   [C-3-5] A stereotype cannot extend itself. context ModelElement inv: self.stereotype->excludes(self)

   [C-3-6] The base class name must be provided. context Stereotype inv: Set {self.baseClass}->notEmpty