.. comment all inline tags to start with _how_vc_ .. _how_vc_top: .. index:: pair: Validation Constraints; How to .. index:: Constraints; How to Validation Contraints **************************************************** How to model constraints for use in validation **************************************************** .. include:: /pages/common/pageunderconstruction.txt :start-line: 3 .. contents:: :depth: 2 ======== Overview ======== ================== Step by Step guide ================== .. contents:: The modelling steps are: :local: :depth: 1 :backlinks: top ------------------- Adding a Constraint ------------------- .. include:: howtoAddValidationConstraints.txt --------------------------------- Using constraints for Validation --------------------------------- To use the OCL Validation tool of MagicDraw, the MagicDraw Architecte or Enterprise version must be used. For validating an OCL constraint, it should be stereotyped as **validationRule**. .. figure:: /images/howto/ht_vc_constraintStereotype.png :scale: 100% Stereotype constraints as validationRule An error message can be attached to a WR so it can be more easily identified and understood during validation. .. figure:: /images/howto/ht_vc_constraintErrorMsg.png :scale: 100% Add an error message string Stereotype packages as **validationSuite** if they contain elements with constraints for validation, or elements to be validated. .. figure:: /images/howto/ht_vc_validationSuite.png :scale: 100% Stereotype packages as validationSuite ------------------------------------- Instances for TestData and Validation ------------------------------------- .. todo:: how to add Instances. Stereotype the TestData package and sub-packages as **validationSuite** .. figure:: /images/howto/ht_vc_validationSuite.png :scale: 100% Stereotype packages as validationSuite ------------------- Validate the model ------------------- Launch the validation using the menu **Analyse > Validation > Validate**. .. figure:: /images/howto/ht_vc_validate01.png :scale: 100% Launch Validation Then in the Validation dialog box, choose the **Validation Suite** as the top package containing the constraints to validate. .. figure:: /images/howto/ht_vc_validate02.png :scale: 100% Select Validation Suite The results are displayed and can be used for navigation .. figure:: /images/howto/ht_vc_validate03.png :scale: 100% Validation Results .. sectionauthor:: |Erwan Livolant| ======================== Validation Syntax errors ======================== The following are some syntax errors with some suggestions for the error. ============================== ========================================================================================== Error Suggested fix ============================== ========================================================================================== No binary relational operation Trying to compare where mulitplicity is "*" try e.g. self.InOrganization->excludes(self) Unsupported kind of expression the "Constrained Element" has not been set for the constraint ============================== ========================================================================================== .. sectionauthor:: |Judith Crockford| .. include:: /keywords.rst