| How to check my OCL constraints for "my custom profile" applied uml diagram [message #68157] | 
Wed, 25 February 2009 01:51   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi All, 
 
I have created a UML profile for a specific domain. In this profile there  
are lots of OCL constraints for "well-formedness" and domain model. I want  
to be able to validate my "UML diagrams" which "applied my profile". 
 
I searched for a while and i think the way to my solution passes through  
EMF Validation framework. For UML and Ecore models there is a validate  
option on objects. I want to register my checker to this validator. First,  
default checkers validates then my validator takes control? Is this  
possible? 
 
I have read  "Recipe: How To use the Eclipse Validation Framework with OCL  
constraints defined in a separate file". I have created a "genmodel" from  
my UML Profile file. By using this genmodel, i generated codes for  
plug-in. I generated all 4 projects (xxx, xxx.editor, xxx.edit,  
xxx.tests). I realised that after generation there is no seperated OCL  
files. All OCL constraints were being checked in xxxImpl objects. This  
code validations use OCL framework and validates from there. In this  
recipe there is seperated OCL files so i can not apply this receipe for my  
problem. 
 
When i directly Run my plug-ins, i saw that there is a New Emf Model  
generation for my profile, this is not what i want. I told above what i  
want, shortly i want to register my validator to default UMl model  
validator.
 |  
 |  
  | 
| Re: How to check my OCL constraints for "my custom profile" applied uml diagram [message #68255 is a reply to message #68157] | 
Fri, 27 February 2009 10:54   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: cdamus.zeligsoft.com 
 
Hi, Cagdas, 
 
The MDT OCL implementation supports the evaluation of OCL constraints  
that are defined in the context of a Stereotype on the model Elements to  
which the stereotype is applied.  See how this works in the  
org.eclipse.ocl.uml.tests.ProfilesTest JUnit test class. 
 
As far as extending the validation action in your editor is concerned,  
this is something that you would probably need to do in the  
ValidateAction class that is generated in your editor plug-in.  You may  
find some useful ideas in the EMF Validation Framework examples  
(installed from the "EMF Validation Framework Plug-ins" category in the  
"New -> Example..." wizard).  The "General" example illustrates the  
implementation of a Validate action that invokes the  
ModelValidationService; the "Adapter" example demonstrates how to bridge  
the validation service with your model's generated EValidator; the "OCL"  
example demonstrates a couple of different ways to use OCL to define  
constraints.  For your purpose, an approach like the dynamic OCL  
constraint provider example would probably be best, except that instead  
of finding constraints in *.ocl files, it would find them in your profiles. 
 
HTH, 
 
Christian 
 
 
Cagdas Cirit wrote: 
> Hi All, 
>  
> I have created a UML profile for a specific domain. In this profile  
> there are lots of OCL constraints for "well-formedness" and domain  
> model. I want to be able to validate my "UML diagrams" which "applied my  
> profile". 
>  
> I searched for a while and i think the way to my solution passes through  
> EMF Validation framework. For UML and Ecore models there is a validate  
> option on objects. I want to register my checker to this validator.  
> First, default checkers validates then my validator takes control? Is  
> this possible? 
>  
> I have read  "Recipe: How To use the Eclipse Validation Framework with  
> OCL constraints defined in a separate file". I have created a "genmodel"  
> from my UML Profile file. By using this genmodel, i generated codes for  
> plug-in. I generated all 4 projects (xxx, xxx.editor, xxx.edit,  
> xxx.tests). I realised that after generation there is no seperated OCL  
> files. All OCL constraints were being checked in xxxImpl objects. This  
> code validations use OCL framework and validates from there. In this  
> recipe there is seperated OCL files so i can not apply this receipe for  
> my problem. 
>  
> When i directly Run my plug-ins, i saw that there is a New Emf Model  
> generation for my profile, this is not what i want. I told above what i  
> want, shortly i want to register my validator to default UMl model  
> validator. 
>
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03745 seconds