Home » Modeling » UML2 » Validating an EMF model programatically
Validating an EMF model programatically [message #535591] |
Mon, 24 May 2010 14:42  |
Eclipse User |
|
|
|
I was going over the EMF Validation Framework example and I was able to set everything up and add a few extra constraints. Then I run the plugin as an eclipse application, I create the model and then in the editor menu I can select validate to check the constraints and everything works fine.
But I was wondering if it is possible to validate a model programmatically, without using the editor.
// For example, create a few objects:
Book myBook = EXTLibraryFactory.eINSTANCE.createBook();
myBook.setTitle("EMF Validation");
Writer writer = EXTLibraryFactory.eINSTANCE.createWriter();
writer.setName("Hector");
//And then do the validation
I've been searching the web with no luck. Can something like this be done? I would appreciate any hints.
Thanks.
|
|
| | | |
Re: Validating an EMF model programatically [message #535732 is a reply to message #535625] |
Tue, 25 May 2010 08:52   |
Eclipse User |
|
|
|
Hi, Hector,
I gather from this thread that you have used the example plug-in's
Validate context menu action to successfully test your constraints. It
serves as an example of how to perform validation using the API: just
look at the implementation of that action. :-)
Hopefully the Programmer's Guide documentation included in the SDK will
be helpful, also.
Finally, this subject is not quite in the scope of the MDT UML2
newsgroup. Any follow-up question that you may have about EMF
Validation should be directed to the EMF newsgroup; indeed, you will
probably find that many of your questions (including this one) have been
asked and answered, there.
HTH,
Christian
On 24/05/10 07:30 PM, Hector Chavez wrote:
> Hector Chavez wrote on Mon, 24 May 2010 19:26
>> I tried using Diagnostician.INSTACE before but it seems that it only
>> checks the default core constraints, which is not useful in my case. I
>> added a couple of custom constraints and those are ignored by the
>> Diagnostician.
>>
>> Hector
>
>
> To be more specific, I added two ocl constraints on plugin.xml following
> the format given in the OCL validation tutorial on the eclipse
> documentation web site. Those constraints are correctly checked when I
> use the editor->validate, but are ignored by the Diagnostician.
>
> Hector
>
|
|
|
Re: Validating an EMF model programatically [message #535736 is a reply to message #535732] |
Tue, 25 May 2010 09:03   |
Eclipse User |
|
|
|
Thank you, I didn't think about that, I'll check the EMF newsgroup.
Hector
Christian W. Damus wrote on Tue, 25 May 2010 08:52 | Hi, Hector,
I gather from this thread that you have used the example plug-in's
Validate context menu action to successfully test your constraints. It
serves as an example of how to perform validation using the API: just
look at the implementation of that action. 
Hopefully the Programmer's Guide documentation included in the SDK will
be helpful, also.
Finally, this subject is not quite in the scope of the MDT UML2
newsgroup. Any follow-up question that you may have about EMF
Validation should be directed to the EMF newsgroup; indeed, you will
probably find that many of your questions (including this one) have been
asked and answered, there.
HTH,
Christian
On 24/05/10 07:30 PM, Hector Chavez wrote:
> Hector Chavez wrote on Mon, 24 May 2010 19:26
>> I tried using Diagnostician.INSTACE before but it seems that it only
>> checks the default core constraints, which is not useful in my case. I
>> added a couple of custom constraints and those are ignored by the
>> Diagnostician.
>>
>> Hector
>
>
> To be more specific, I added two ocl constraints on plugin.xml following
> the format given in the OCL validation tutorial on the eclipse
> documentation web site. Those constraints are correctly checked when I
> use the editor->validate, but are ignored by the Diagnostician.
>
> Hector
>
|
|
|
| | |
Re: Validating an EMF model programatically [message #628464 is a reply to message #535625] |
Tue, 25 May 2010 08:52   |
Eclipse User |
|
|
|
Hi, Hector,
I gather from this thread that you have used the example plug-in's
Validate context menu action to successfully test your constraints. It
serves as an example of how to perform validation using the API: just
look at the implementation of that action. :-)
Hopefully the Programmer's Guide documentation included in the SDK will
be helpful, also.
Finally, this subject is not quite in the scope of the MDT UML2
newsgroup. Any follow-up question that you may have about EMF
Validation should be directed to the EMF newsgroup; indeed, you will
probably find that many of your questions (including this one) have been
asked and answered, there.
HTH,
Christian
On 24/05/10 07:30 PM, Hector Chavez wrote:
> Hector Chavez wrote on Mon, 24 May 2010 19:26
>> I tried using Diagnostician.INSTACE before but it seems that it only
>> checks the default core constraints, which is not useful in my case. I
>> added a couple of custom constraints and those are ignored by the
>> Diagnostician.
>>
>> Hector
>
>
> To be more specific, I added two ocl constraints on plugin.xml following
> the format given in the OCL validation tutorial on the eclipse
> documentation web site. Those constraints are correctly checked when I
> use the editor->validate, but are ignored by the Diagnostician.
>
> Hector
>
|
|
|
Re: Validating an EMF model programatically [message #628465 is a reply to message #535732] |
Tue, 25 May 2010 09:03  |
Eclipse User |
|
|
|
Thank you, I didn't think about that, I'll check the EMF newsgroup.
Hector
Christian W. Damus wrote on Tue, 25 May 2010 08:52
> Hi, Hector,
>
> I gather from this thread that you have used the example plug-in's
> Validate context menu action to successfully test your constraints. It
> serves as an example of how to perform validation using the API: just
> look at the implementation of that action. :)
>
> Hopefully the Programmer's Guide documentation included in the SDK will
> be helpful, also.
>
> Finally, this subject is not quite in the scope of the MDT UML2
> newsgroup. Any follow-up question that you may have about EMF
> Validation should be directed to the EMF newsgroup; indeed, you will
> probably find that many of your questions (including this one) have been
> asked and answered, there.
>
> HTH,
>
> Christian
>
>
> On 24/05/10 07:30 PM, Hector Chavez wrote:
> > Hector Chavez wrote on Mon, 24 May 2010 19:26
> >> I tried using Diagnostician.INSTACE before but it seems that it only
> >> checks the default core constraints, which is not useful in my case. I
> >> added a couple of custom constraints and those are ignored by the
> >> Diagnostician.
> >>
> >> Hector
> >
> >
> > To be more specific, I added two ocl constraints on plugin.xml following
> > the format given in the OCL validation tutorial on the eclipse
> > documentation web site. Those constraints are correctly checked when I
> > use the editor->validate, but are ignored by the Diagnostician.
> >
> > Hector
> >
|
|
|
Goto Forum:
Current Time: Wed Jul 23 07:21:39 EDT 2025
Powered by FUDForum. Page generated in 0.30452 seconds
|