Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Question regarding unique lists
Question regarding unique lists [message #484846] Wed, 09 September 2009 13:46 Go to next message
No real name is currently offline No real nameFriend
Messages: 15
Registered: July 2009
Junior Member
Hello,

i have used EMF to import a XML schema and generate a meta model from it.
When i load a model i see the odd behaviour that EMF uses a
EDataTypeUniqueElist to store values of an attribute, but the values are
not unique (they shouldn't be unique).
For example, i have a list of four values: 5,2,0,0. These values come from
an xml file and all are in the list, which is perfectly fine. But when i
create a new instance of that object and try to add the same values to the
list, than only 5,2,0 is added, because it is an unique list. The last
behaviour is what i would expect, but how can it be that the values are
not unique in the list, if i load a model from an xml file?

Regards,

Manfred
Re: Question regarding unique lists [message #484859 is a reply to message #484846] Wed, 09 September 2009 14:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
Manfred,

Comments below.

Manfred wrote:
> Hello,
>
> i have used EMF to import a XML schema and generate a meta model from
> it. When i load a model i see the odd behaviour that EMF uses a
> EDataTypeUniqueElist to store values of an attribute, but the values
> are not unique (they shouldn't be unique).
The XSDEcoreBuilder generally sets isUnique to false for EAttributes for
which upperBound > 1... There is an ecore:unique attribute one could
use, but it doesn't look like that should be necessary. Which version
of EMF are you using? Do you have an example I can try?
> For example, i have a list of four values: 5,2,0,0. These values come
> from an xml file and all are in the list, which is perfectly fine. But
> when i create a new instance of that object and try to add the same
> values to the list, than only 5,2,0 is added, because it is an unique
> list. The last behaviour is what i would expect, but how can it be
> that the values are not unique in the list, if i load a model from an
> xml file?
> Regards,
>
> Manfred


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Question regarding unique lists [message #484890 is a reply to message #484859] Wed, 09 September 2009 15:48 Go to previous message
No real name is currently offline No real nameFriend
Messages: 15
Registered: July 2009
Junior Member
Ed,

i found the problem, the flag unique of that attribute in the genmodel was
accidently set to true. But while loading a model from a xml file, the
XMLHelperImpl uses in setValue(..) the method addUnique from
InternalEList. So it is not checked if the value is unique or not. That is
the reason why loading a model from a file worked for me and creating a
model did not.

I use EMF Version 2.4.1.

Thanks for your time,

Manfred
Previous Topic:[TENEO] Editors drag-drop functionality with GMF
Next Topic:EMF Notification
Goto Forum:
  


Current Time: Tue Apr 23 06:02:14 GMT 2024

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

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

Back to the top