We first create a simple profile named MyProfile. We create a Stereotype called MySubClass.
To declare a constraint, we have to select the Constraints panel, then click on the red cross to add one constraint. The right part of this panel holds the constraint.
The Level combo choice is to selecting the context of the OCL evaluation. M1 is for user model level, that's the legal way to write constraints (here a instance of the meta-class Stereotype). M2 is for the meta class of the current element (metaclass Stereotype).
The following screenshot shows the choices proposed by the content assistor. We can call it by pressing Ctrl + Space.
For this example, we create two constraints:
- to check a tag value: self.aValue > 4
- to check a naming convention: self.base_Class.name.substring(1,4)='Imp_'