I'm stuck with a very basic problem regarding EMF, here's what i've got.
EClass A:
aID : EInteger (Key: true)
EClass B:
bID : EInteger (Key: true)
EClass C:
Reference refA: to elements of A, containment: true, EKeys: aID,开发者_StackOverflow 0 .. n
Reference refB: to elements of B, containment: true, EKeys: bID, 0 .. n
Now here's the problem. In both my a and b list I'd like to have IDs from 0 to n. However, when I do this, I get the message:
The ID '1' of 'A' collides with that of 'B'
I hope my problem is described clearly. Does anyone know what I'm doing wrong? Thanks!
An EAttribute which is set as "ID" should be unique resource-wide. If you want to reference elements using a myReference[name="SomeName"] construction then you should use eKeys, then the eKeyed attribute should have a unique value within a reference.
I am under the impression you defined "aID" and "bID" as "ID's whereas that's not what you really want here.
That could be resolved using OO hierachy. You just need to extend A and B from a common Abstract class that contains the id attribute and it setted as ID in emf properties.
regards
精彩评论