Validate OCL Constraints of a Profile

Papyrus supports an additional profile for defining Domain Specific Modeling Languages (DSML) that refines how constraints are validated. The additional profile enables a more precise specification of validation properties, for example:

CAVEAT: The information added via the profile using the DSML profile is not currently taken into account during OCL validation. The support will be added soon.

Advanced users can also define:

How to apply the DSML validation profile:


Open the specification via the property view


Open the specification via the property view


Edit DSML stereotype attributes

You can then edit the stereotype attribute to define information about the behavior of the validation.

Generation from Constraints


Constraints expressed in OCL can be validated directly in the tool. This is not the case for Java constraints which must be placed in a suitable plugin. However, Papyrus supports the generation of this plugin.

Generate constraints directly into the definition

Constraints written in OCL within the profile can be generated into the definition of the profile and read during the validation of the model.

How to

When you save the profile,Papyrus asks to you if want to define the profile.
Click on yes and then do not forget to check save OCL constraint in the definition (recently, the box is checked by default)


Save OCL constraints in the definition

Generate constraints as EMF validation plugins

The user can generate plugins that wrap constraint and can be used in the EMF plugin validation.
The constraint can be generated in Java code, or directly from OCL.

How to

Select the root profile

Click right on the model explorer-> create validation plugin for this DSML

Then a wizard to create the validation is launched. You have to give a name for you validation plugin.


Wizard of constraint validation creation

Then you need to install the created plugin.

Category:Papyrus