Date: Fri, 29 Mar 2024 08:14:31 +0100 (CET) Message-ID: <363192050.1619.1711696471282@nm-docs> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1618_1503095003.1711696471281" ------=_Part_1618_1503095003.1711696471281 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Before creating a new Constraint element, you must decide the Co= nstraint type to create. The Constraint type defines a target for which the= validation rule will be evaluated.
There are three types of Constrain= ts that can be evaluated:
Constraints on Metaclasses. When a Constraint is placed on a metaclass (one of the classes in the UML Standard Profile > UML2 Me=
tamodel), this Constraint is evaluated on all the model elements of that ki=
nd (e.g. if the Constraint is placed on the Actor metaclass, then this Cons=
traint applies to all actor elements in the model). The following is an exa=
mple of a rule (specified in OCL2.0) mandating that all actor names in the =
model must be capitalized. These Constraints are useful for specifying gene=
ric rules that must apply on all the model elements of a particular kind.=
p>
context=
Actor inv capitalize:
let startswith:String =3D name.substring(1,1) in
startswith.toUpper() =3D startswith
Recommendation
=It is strongly recommend not to mix the Constraints from different metal= evels into one validation suite. Learn more how to create validation suite >>
The examples of each Constraint type can be found in the model v= alidation sample model. To open this sample do one of the fol= lowing:
You can create a new Constraint for :
To create Constraint for a classifier or Stereotype
To create Constraint for a metaclass
Type its name.
The new Constraint is created in the model.
If you create a new Constraint for a metaclass, you must specify the