Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Validation - constraints(constraints)
EMF Validation - constraints [message #756240] Fri, 11 November 2011 16:00 Go to next message
adampatrick is currently offline adampatrickFriend
Messages: 6
Registered: January 2011
Junior Member
Started to use annotations to define constraints.

Define the first constraint ok on the EClass... EAnnotation >> Details Entry

setting all the properties in the ecore model to the right values

this first constraint is to do there is two attributes min and max and as a quick constraint min cannot be greater than max.... implemented (java - once the code stub created) and tested this and all works ok!


then wanted to set another constraint - having min and max both set at zero does not make a whole lot of sense .....

.... now at first I thought that I should define a new 'Details Entry' in the annotation I defined but doing this causes the ECore model to be invalid.... I called the Key 'constraints' and entered something appropriate in Value. .... error was...."feature details has a map entry at index 1 with a key that collides with that of the map entry at index 0".....hmmmm

then I thought maybe you have to define a seprate annotation for each constraint ... but this then failed to generate any code for this constraint.

So then I thought are you only supposed to define one constraint per EClass (it does not seem right in my head to do this)? but wanted to get some good opionions first before I do that

.... as a side:
may want to define further constraints too on this one EClass .... having negative min/max values does not make sense either.....




Re: EMF Validation - constraints [message #756250 is a reply to message #756240] Fri, 11 November 2011 16:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
The key is "constraints" (plural) and the value is a space separated
list of named constraints.

On 11/11/2011 5:00 PM, adampatrick wrote:
> Started to use annotations to define constraints.
> Define the first constraint ok on the EClass... EAnnotation >> Details
> Entry
>
> setting all the properties in the ecore model to the right values
>
> this first constraint is to do there is two attributes min and max and
> as a quick constraint min cannot be greater than max.... implemented
> (java - once the code stub created) and tested this and all works ok!
>
>
> then wanted to set another constraint - having min and max both set at
> zero does not make a whole lot of sense .....
> ... now at first I thought that I should define a new 'Details Entry'
> in the annotation I defined but doing this causes the ECore model to
> be invalid.... I called the Key 'constraints' and entered something
> appropriate in Value. .... error was...."feature details has a map
> entry at index 1 with a key that collides with that of the map entry
> at index 0".....hmmmm
>
> then I thought maybe you have to define a seprate annotation for each
> constraint ... but this then failed to generate any code for this
> constraint.
>
> So then I thought are you only supposed to define one constraint per
> EClass (it does not seem right in my head to do this)? but wanted to
> get some good opionions first before I do that
>
> ... as a side:
> may want to define further constraints too on this one EClass ....
> having negative min/max values does not make sense either.....
>
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Validation - constraints [message #756255 is a reply to message #756250] Fri, 11 November 2011 16:40 Go to previous messageGo to next message
adampatrick is currently offline adampatrickFriend
Messages: 6
Registered: January 2011
Junior Member
bing - light bulb moment! - thanks
Re: EMF Validation - constraints [message #756263 is a reply to message #756255] Fri, 11 November 2011 17:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
On 11/11/2011 16:40, adampatrick wrote:
> bing - light bulb moment! - thanks
The OCLinEcore automates all this.

Regards

Ed Willink
Re: EMF Validation - constraints [message #757001 is a reply to message #756240] Tue, 15 November 2011 22:13 Go to previous message
adampatrick is currently offline adampatrickFriend
Messages: 6
Registered: January 2011
Junior Member
ok - hint taken and up and running thanks to your tutorial.
Previous Topic:CIF Simulation
Next Topic:[CDO] Not Active: Transaction #
Goto Forum:
  


Current Time: Sat Apr 27 04:56:00 GMT 2024

Powered by FUDForum. Page generated in 0.04174 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top