Question regarding unique lists [message #484846] |
Wed, 09 September 2009 09:46  |
Eclipse User |
|
|
|
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 10:06   |
Eclipse User |
|
|
|
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
|
|
|
Re: Question regarding unique lists [message #484890 is a reply to message #484859] |
Wed, 09 September 2009 11:48  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.05837 seconds