A classifier is a classification of instances - it describes a set of instances that have features in common. A classifier can specify a generalization hierarchy by referencing its general classifiers. Generalization hierarchies must be directed and acyclical. A classifier can not be both a transitively general and transitively specific classifier of the same classifier. OCL not self.allParents()->includes(self) A classifier may only specialize classifiers of a valid type. OCL self.parents()->forAll(c | self.maySpecializeType(c)) Refers to all of the Properties that are direct (i.e. not inherited or imported) attributes of the classifier. Note that there may be members of the Classifier that are of the type Feature but are not included in this association, e.g. inherited features. References the general classifier in the Generalization relationship. Specifies all elements inherited by this classifier from the general classifiers. The query conformsTo() gives true for a classifier that defines a type that conforms to another. This is used, for example, in the specification of signature conformance for operations. OCL result = (self=other) or (self.allParents()->includes(other)) The query allFeatures() gives all of the features in the namespace of the classifier. In general, through mechanisms such as inheritance, this will be a larger set than feature. OCL result = member->select(oclIsKindOf(Feature)) The general classifiers are the classifiers referenced by the generalization relationships. OCL result = self.parents() The query parents() gives all of the immediate ancestors of a generalized Classifier. OCL result = generalization.general The inheritedMember association is derived by inheriting the inheritable members of the parents. OCL result = self.inherit(self.parents()->collect(p | p.inheritableMembers(self)) The query allParents() gives all of the direct and indirect ancestors of a generalized Classifier. OCL result = self.parents()->union(self.parents()->collect(p | p.allParents()) The query inheritableMembers() gives all of the members of a classifier that may be inherited in one of its descendants, subject to whatever visibility restrictions apply. OCL c.allParents()->includes(self) OCL result = member->select(m | c.hasVisibilityOf(m)) The query hasVisibilityOf() determines whether a named element is visible in the classifier. By default all are visible. It is only called when the argument is something owned by a parent. OCL self.allParents()->collect(c | c.member)->includes(n) OCL result = if (self.inheritedMember->includes(n)) then (n.visibility <> #private) else true The inherit operation is overridden to exclude redefined properties. OCL result = inhs The query maySpecializeType() determines whether this classifier may have a generalization relationship to classifiers of the specified type. By default a classifier may specialize classifiers of the same or a more general type. It is intended to be redefined by classifiers that have different specialization constraints. OCL result = self.oclIsKindOf(c.oclType) A directed relationship represents a relationship between a collection of source model elements and a collection of target model elements. Specifies the sources of the DirectedRelationship. Specifies the targets of the DirectedRelationship. An element is a constituent of a model. As such, it has the capability of owning other elements. An element may not directly or indirectly own itself. OCL not self.allOwnedElements()->includes(self) Elements that must be owned must have an owner. OCL self.mustBeOwned() implies owner->notEmpty() The Elements owned by this element. The Element that owns this element. The Comments owned by this element. The query allOwnedElements() gives all of the direct and indirect owned elements of an element. OCL result = ownedElement->union(ownedElement->collect(e | e.allOwnedElements())) The query mustBeOwned() indicates whether elements of this type must have an owner. Subclasses of Element that do not require an owner must override this operation. OCL result = true A feature declares a behavioral or structural characteristic of instances of classifiers. The Classifiers that have this Feature as a feature. A multiplicity is a definition of an inclusive interval of non-negative integers beginning with a lower bound and ending with a (possibly infinite) upper bound. A multiplicity element embeds this information to specify the allowable cardinalities for an instantiation of this element. A multiplicity must define at least one valid cardinality that is greater than zero. OCL upperBound()->notEmpty() implies upperBound() > 0 The upper bound must be greater than or equal to the lower bound. OCL (upperBound()->notEmpty() and lowerBound()->notEmpty()) implies upperBound() >= lowerBound() The lower bound must be a non-negative integer literal. OCL lowerBound()->notEmpty() implies lowerBound() >= 0 For a multivalued multiplicity, this attribute specifies whether the values in an instantiation of this element are sequentially ordered. For a multivalued multiplicity, this attributes specifies whether the values in an instantiation of this element are unique. Specifies the lower bound of the multiplicity interval. Specifies the upper bound of the multiplicity interval. The query isMultivalued() checks whether this multiplicity has an upper bound greater than one. OCL upperBound()->notEmpty() OCL result = upperBound() > 1 The query includesMultiplicity() checks whether this multiplicity includes all the cardinalities allowed by the specified multiplicity. OCL self.upperBound()->notEmpty() and self.lowerBound()->notEmpty() and M.upperBound()->notEmpty() and M.lowerBound()->notEmpty() OCL result = (self.lowerBound() <= M.lowerBound()) and (self.upperBound() >= M.upperBound()) The query includesCardinality() checks whether the specified cardinality is valid for this multiplicity. OCL upperBound()->notEmpty() and lowerBound()->notEmpty() OCL result = (lowerBound() <= C) and (upperBound() >= C) The query lowerBound() returns the lower bound of the multiplicity as an integer. OCL result = if lower->notEmpty() then lower else 1 endif The query upperBound() returns the upper bound of the multiplicity for a bounded multiplicity as an unlimited natural. OCL result = if upper->notEmpty() then upper else 1 endif A namespace is an element in a model that contains a set of named elements that can be identified by name. All the members of a Namespace are distinguishable within it. OCL membersAreDistinguishable() References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports. References the ElementImports owned by the Namespace. References the PackageImports owned by the Namespace. A collection of NamedElements owned by the Namespace. A collection of NamedElements identifiable within the Namespace, either by being owned or by being introduced by importing or inheritance. The importedMember property is derived from the ElementImports and the PackageImports. References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports. OCL result = self.importMembers(self.elementImport.importedElement.asSet()->union(self.packageImport.importedPackage->collect(p | p.visibleMembers()))) The query getNamesOfMember() takes importing into account. It gives back the set of names that an element would have in an importing namespace, either because it is owned, or if not owned then imported individually, or if not individually then from a package. OCL result = if self.ownedMember->includes(element) then Set{}->include(element.name) else let elementImports: ElementImport = self.elementImport->select(ei | ei.importedElement = element) in if elementImports->notEmpty() then elementImports->collect(el | el.getName()) else self.packageImport->select(pi | pi.importedPackage.visibleMembers()->includes(element))->collect(pi | pi.importedPackage.getNamesOfMember(element)) endif endif The query importMembers() defines which of a set of PackageableElements are actually imported into the namespace. This excludes hidden ones, i.e., those which have names that conflict with names of owned members, and also excludes elements which would have the same name when imported. OCL result = self.excludeCollisions(imps)->select(imp | self.ownedMember->forAll(mem | mem.imp.isDistinguishableFrom(mem, self))) The query excludeCollisions() excludes from a set of PackageableElements any that would not be distinguishable from each other in this namespace. OCL result = imps->reject(imp1 | imps.exists(imp2 | not imp1.isDistinguishableFrom(imp2, self))) The Boolean query membersAreDistinguishable() determines whether all of the namespace's members are distinguishable within it. OCL result = self.member->forAll( memb | self.member->excluding(memb)->forAll(other | memb.isDistinguishableFrom(other, self))) A packageable element indicates a named element that may be owned directly by a package. A redefinable element is an element that, when defined in the context of a classifier, can be redefined more specifically or differently in the context of another classifier that specializes (directly or indirectly) the context classifier. At least one of the redefinition contexts of the redefining element must be a specialization of at least one of the redefinition contexts for each redefined element. OCL self.redefinedElement->forAll(e | self.isRedefinitionContextValid(e)) A redefining element must be consistent with each redefined element. OCL self.redefinedElement->forAll(re | re.isConsistentWith(self)) References the contexts that this element may be redefined from. The redefinable element that is being redefined by this element. The query isConsistentWith() specifies, for any two RedefinableElements in a context in which redefinition is possible, whether redefinition would be logically consistent. By default, this is false; this operation must be overridden for subclasses of RedefinableElement to define the consistency conditions. OCL result = false The query isRedefinitionContextValid() specifies whether the redefinition contexts of this RedefinableElement are properly related to the redefinition contexts of the specified RedefinableElement to allow this element to redefine the other. By default at least one of the redefinition contexts of this element must be a specialization of at least one of the redefinition contexts of the specified element. OCL result = self.redefinitionContext->exists(c | redefined.redefinitionContext->exists(r | c.allParents()->includes(r))) Relationship is an abstract concept that specifies some kind of relationship between elements. Specifies the elements related by the Relationship. A structural feature is a typed feature of a classifier that specifies the structure of instances of the classifier. A typed element is a kind of named element that represents an element with a type. This information is derived from the return result for this Operation. A value specification is the specification of a (possibly empty) set of instances, including both objects and data values. The query isComputable() determines whether a value specification can be computed in a model. This operation cannot be fully defined in OCL. A conforming implementation is expected to deliver true for this operation for all value specifications that it can compute, and to compute all of those for which the operation is true. A conforming implementation is expected to be able to compute the value of all literals. OCL result = false The query integerValue() gives a single Integer value when one can be computed. OCL result = Set{} The query booleanValue() gives a single Boolean value when one can be computed. OCL result = Set{} The query stringValue() gives a single String value when one can be computed. OCL result = Set{} The query unlimitedValue() gives a single UnlimitedNatural value when one can be computed. OCL result = Set{} The query isNull() returns true when it can be computed that the value is null. OCL result = false An association describes a set of tuples whose values refer to typed instances. An instance of an association is called a link. Association ends of associations with more than two ends must be owned by the association. OCL if memberEnd->size() > 2 then ownedEnd->includesAll(memberEnd) Specifies whether the association is derived from other model elements such as other associations or constraints. The ends that are owned by the association itself. References the classifiers that are used as types of the ends of the association. Each end represents participation of instances of the classifier connected to the end in links of the association. The navigable ends that are owned by the association itself. A class describes a set of objects that share the same specifications of features, constraints, and semantics. True when a class is abstract. The attributes (i.e. the properties) owned by the class. The operations owned by the class. This gives the superclasses of a class. The inherit operation is overridden to exclude redefined properties. OCL result = inhs->excluding(inh | ownedMember->select(oclIsKindOf(RedefinableElement))->select(redefinedElement->includes(inh))) A property is a structural feature of a classifier that characterizes instances of the classifier. A property related by ownedAttribute to a classifier (other than an association) represents an attribute and might also represent an association end. It relates an instance of the class to a value or set of values of the type of the attribute. A property related by memberEnd or its specializations to an association represents an end of the association. The type of the property is the type of the end of the association. A multiplicity of a composite aggregation must not have an upper bound greater than 1. OCL isComposite implies (upperBound()->isEmpty() or upperBound() <= 1) Subsetting may only occur when the context of the subsetting property conforms to the context of the subsetted property. OCL self.subsettedProperty->notEmpty() implies (self.subsettingContext()->notEmpty() and self.subsettingContext()->forAll (sc | self.subsettedProperty->forAll(sp | sp.subsettingContext()->exists(c | sc.conformsTo(c))))) A redefined property must be inherited from a more general classifier containing the redefining property. OCL if (redefinedProperty->notEmpty()) then (redefinitionContext->notEmpty() and redefinedProperty->forAll(rp| ((redefinitionContext->collect(fc| fc.allParents()))->asSet())->collect(c| c.allFeatures())->asSet()->includes(rp)) A subsetting property may strengthen the type of the subsetted property, and its upper bound may be less. OCL self.subsettedProperty->forAll(sp | self.type.conformsTo(sp.type) and ((self.upperBound()->notEmpty() and sp.upperBound()->notEmpty()) implies self.upperBound()<=sp.upperBound() )) Only a navigable property can be marked as readOnly. OCL isReadOnly implies isNavigable() A derived union is derived. OCL isDerivedUnion implies isDerived A property may not subset a property with the same name. OCL true If isReadOnly is true, the attribute may not be written to after initialization. Specifies a String that represents a value to be used when no argument is supplied for the Property. If isComposite is true, the object containing the attribute is a container for the object or value contained in the attribute. If isDerived is true, the value of the attribute is derived from information elsewhere. Specifies whether the property is derived as the union of all of the properties that are constrained to subset it. References the Class that owns the Property. References the owning association of this property, if any. References the properties that are redefined by this property. References the properties of which this property is constrained to be a subset. In the case where the property is one navigable end of a binary association with both ends navigable, this gives the other end. The DataType that owns this Property. References the association of which this property is a member, if any. If this property is owned by a class, associated with a binary association, and the other end of the association is also owned by a class, then opposite gives the other end. OCL result = if owningAssociation->isEmpty() and association.memberEnd->size() = 2 then let otherEnd = (association.memberEnd - self)->any() in if otherEnd.owningAssociation->isEmpty() then otherEnd else Set{} endif else Set {} endif The query isConsistentWith() specifies, for any two Properties in a context in which redefinition is possible, whether redefinition would be logically consistent. A redefining property is consistent with a redefined property if the type of the redefining property conforms to the type of the redefined property, the multiplicity of the redefining property (if specified) is contained in the multiplicity of the redefined property, and the redefining property is derived if the redefined property is derived. OCL redefinee.isRedefinitionContextValid(self) OCL result = redefinee.oclIsKindOf(Property) and let prop : Property = redefinee.oclAsType(Property) in (prop.type.conformsTo(self.type) and ((prop.lowerBound()->notEmpty() and self.lowerBound()->notEmpty()) implies prop.lowerBound() >= self.lowerBound()) and ((prop.upperBound()->notEmpty() and self.upperBound()->notEmpty()) implies prop.lowerBound() <= self.lowerBound()) and (self.isDerived implies prop.isDerived) and (self.isComposite implies prop.isComposite)) The query subsettingContext() gives the context for subsetting a property. It consists, in the case of an attribute, of the corresponding classifier, and in the case of an association end, all of the classifiers at the other ends. OCL result = if association->notEmpty() then association.endType-type else if classifier->notEmpty then Set{classifier} else Set{} endif endif The query isNavigable() indicates whether it is possible to navigate across the property. OCL result = not classifier->isEmpty() or association.owningAssociation.navigableOwnedEnd->includes(self) The query isAttribute() is true if the Property is defined as an attribute of some classifier. OCL result = Classifier->allInstances->exists(c | c.attribute->includes(p)) A data type is a type whose instances are identified only by their value. A data type may contain attributes to support the modeling of structured data types. The Attributes owned by the DataType. The Operations owned by the DataType. The inherit operation is overridden to exclude redefined properties. OCL result = inhs->excluding(inh | ownedMember->select(oclIsKindOf(RedefinableElement))->select(redefinedElement->includes(inh))) An enumeration is a data type whose values are enumerated in the model as enumeration literals. The ordered set of literals for this Enumeration. An enumeration literal is a user-defined data value for an enumeration. The Enumeration that this EnumerationLiteral is a member of. A primitive type defines a predefined data type, without any relevant substructure (i.e., it has no parts in the context of UML). A primitive datatype may have an algebra and operations defined outside of UML, for example, mathematically. A constraint is a condition or restriction expressed in natural language text or in a machine readable language for the purpose of declaring some of the semantics of an element. A constraint cannot be applied to itself. OCL not constrainedElement->includes(self) The value specification for a constraint must evaluate to a Boolean value. OCL self.specification().booleanValue().isOclKindOf(Boolean) The ordered set of Elements referenced by this Constraint. A condition that must be true when evaluated in order for the constraint to be satisfied. An opaque expression is an uninterpreted textual statement that denotes a (possibly empty) set of values when evaluated in a context. If the language attribute is not empty, then the size of the body and language arrays must be the same. OCL language->notEmpty() implies (body->size() = language->size()) The text of the expression, possibly in multiple languages. Specifies the languages in which the expression is stated. The interpretation of the expression body depends on the languages. If the languages are unspecified, they might be implicit from the expression body or the context. Languages are matched to body strings by order. An operation is a behavioral feature of a classifier that specifies the name, type, parameters, and constraints for invoking an associated behavior. A bodyCondition can only be specified for a query operation. OCL bodyCondition->notEmpty() implies isQuery An operation can have at most one return parameter; i.e., an owned parameter with the direction set to 'return' OCL self.ownedParameter->select(par | par.direction = #return)->size() <= 1 Specifies whether an execution of the BehavioralFeature leaves the state of the system unchanged (isQuery=true) or whether side effects may occur (isQuery=false). This information is derived from the return result for this Operation. This information is derived from the return result for this Operation. This information is derived from the return result for this Operation. This information is derived from the return result for this Operation. The class that owns the operation. The DataType that owns this Operation. References the Types representing exceptions that may be raised during an invocation of this operation. References the Operations that are redefined by this Operation. This information is derived from the return result for this Operation. Specifies the ordered set of formal parameters of this BehavioralFeature. If this operation has a return parameter, isOrdered equals the value of isOrdered for that parameter. Otherwise isOrdered is false. OCL result = if returnResult->size() = 1 then returnResult->any().isOrdered else false endif If this operation has a return parameter, isUnique equals the value of isUnique for that parameter. Otherwise isUnique is true. OCL result = if returnResult->size() = 1 then returnResult->any().isUnique else true endif If this operation has a return parameter, lower equals the value of lower for that parameter. Otherwise lower is not defined. OCL result = if returnResult->size() = 1 then returnResult->any().lower else Set{} endif If this operation has a return parameter, upper equals the value of upper for that parameter. Otherwise upper is not defined. OCL result = if returnResult->size() = 1 then returnResult->any().upper else Set{} endif If this operation has a return parameter, type equals the value of type for that parameter. Otherwise type is not defined. OCL result = if returnResult->size() = 1 then returnResult->any().type else Set{} endif The query isConsistentWith() specifies, for any two Operations in a context in which redefinition is possible, whether redefinition would be consistent in the sense of maintaining type covariance. Other senses of consistency may be required, for example to determine consistency in the sense of contravariance. Users may define alternative queries under names different from 'isConsistentWith()', as for example, users may define a query named 'isContravariantWith()'. OCL redefinee.isRedefinitionContextValid(self) OCL result = (redefinee.oclIsKindOf(Operation) and let op: Operation = redefinee.oclAsType(Operation) in self.formalParameter.size() = op.formalParameter.size() and self.returnResult.size() = op.returnResult.size() and forAll(i | op.formalParameter[i].type.conformsTo(self.formalParameter[i].type)) and forAll(i | op.returnResult[i].type.conformsTo(self.returnResult[i].type)) ) OCL result = ownedParameter->select (par | par.direction = #return) A parameter is a specification of an argument used to pass information into or out of an invocation of a behavioral feature. Specifies a String that represents a value to be used when no argument is supplied for the Parameter. Indicates whether a parameter is being sent into or out of a behavioral element. References the Operation owning this parameter. A behavioral feature is a feature of a classifier that specifies an aspect of the behavior of its instances. Specifies the ordered set of formal parameters of this BehavioralFeature. References the Types representing exceptions that may be raised during an invocation of this feature. The query isDistinguishableFrom() determines whether two BehavioralFeatures may coexist in the same Namespace. It specifies that they have to have different signatures. OCL result = if n.oclIsKindOf(BehavioralFeature) then if ns.getNamesOfMember(self)->intersection(ns.getNamesOfMember(n))->notEmpty() then Set{}->include(self)->include(n)->isUnique( bf | bf.parameter->collect(type)) else true endif else true endif An element import identifies an element in another package, and allows the element to be referenced using its name without a qualifier. The visibility of an ElementImport is either public or private. OCL self.visibility = #public or self.visibility = #private An importedElement has either public visibility or no visibility at all. OCL self.importedElement.visibility.notEmpty() implies self.importedElement.visibility = #public Specifies the visibility of the imported PackageableElement within the importing Package. The default visibility is the same as that of the imported element. If the imported element does not have a visibility, it is possible to add visibility to the element import. Specifies the name that should be added to the namespace of the importing package in lieu of the name of the imported packagable element. The aliased name must not clash with any other member name in the importing package. By default, no alias is used. Specifies the PackageableElement whose name is to be added to a Namespace. Specifies the Namespace that imports a PackageableElement from another Package. The query getName() returns the name under which the imported PackageableElement will be known in the importing namespace. OCL result = if self.alias->notEmpty() then self.alias else self.importedElement.name endif A package is used to group elements, and provides a namespace for the grouped elements. If an element that is owned by a package has visibility, it is public or private. OCL self.ownedElements->forAll(e | e.visibility->notEmpty() implies e.visbility = #public or e.visibility = #private) Specifies the packageable elements that are owned by this Package. References the packaged elements that are Types. References the packaged elements that are Packages.