Software Disclaimer

Class UML 2.4.1::Constraint


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.

Direct Superclasses: PackageableElement

Direct Subclasses: IntervalConstraint, InteractionConstraint

Class Precedence List: Constraint, PackageableElement, ParameterableElement, NamedElement, Element


constrainedElement : Element (0 *); -- source Constraint
context : Namespace (0 1); -- source Constraint

Specifies the namespace that owns the NamedElement.
Subsets: NamedElement.namespace
Opposite: Namespace.ownedRule

specification : ValueSpecification (1 1); -- source Constraint
visibility : VisibilityKind (1 1); -- source PackageableElement
owningTemplateParameter : TemplateParameter (0 1); -- source ParameterableElement
templateParameter : TemplateParameter (0 1); -- source ParameterableElement
clientDependency : Dependency (0 *); -- source NamedElement
name : String (0 1); -- source NamedElement
nameExpression : StringExpression (0 1); -- source NamedElement
namespace : Namespace (0 1); -- source NamedElement
qualifiedName : String (0 1); -- source NamedElement
ownedComment : Comment (0 *); -- source Element
ownedElement : Element (0 *); -- source Element
owner : Element (0 1); -- source Element


Signature: CMOF_14_3_30() : Boolean;
Description: 14.3 [30] A Constraint must constrain at least one element and must be specified via an OpaqueExpression. see also:
Expression: constrainedElement->notEmpty() and specification.oclIsKindOf(OpaqueExpression)

Signature: value_specification_boolean() : Boolean;
Description: The value specification for a constraint must evaluate to a Boolean value.
The OCL used here is not normative.
Editor's notes: No () on specification. oclIsKindOf not isOclKindOf. More generally, it looks like this intends to perform runtime evaluation of the OCL string in the specification property (which should more accurately be specification.body, anyway). There is no way to describe this in OCL. Carried Over from UML 2.1.1
Expression: true
Original: self.specification().booleanValue().isOclKindOf(Boolean)

Signature: not_apply_to_self() : Boolean;
Description: A constraint cannot be applied to itself.
Expression: not constrainedElement->includes(self)

Signature: no_side_effects() : Boolean;
Description: Evaluating the value specification for a constraint must not have side effects.
Expression: true

Signature: boolean_value() : Boolean;
Description: The value specification for a constraint must evaluate to a Boolean value.
Expression: true


No additional operations.

Send questions or comments to