2011-07-15 16 views
0

我被困在一個關於EMF的非常基本的問題,這裏是我所得到的。EMF(元)型號中的ID /鍵定義

EClass A: 
    aID : EInteger (Key: true) 

EClass B: 
    bID : EInteger (Key: true) 

EClass C: 
    Reference refA: to elements of A, containment: true, EKeys: aID, 0 .. n 
    Reference refB: to elements of B, containment: true, EKeys: bID, 0 .. n 

現在是問題所在。在我的a和b列表中,我想要從0到n的ID。然而,當我這樣做,我得到的消息:

The ID '1' of 'A' collides with that of 'B' 

我希望我的問題是清楚的描述。有誰知道我做錯了什麼?謝謝!

回答

0

這可以使用OO層次來解決。您只需要從包含id屬性的普通Abstract類擴展A和B,並將其設置爲emf屬性中的ID。

視爲

1

被設置爲「ID」的EAttribute應該是唯一的資源範圍。如果您想使用myReference [name =「SomeName」]構造來引用元素,那麼您應該使用eKeys,那麼eKeyed屬性應該在引用內具有唯一值。

我在印象中將「aID」和「bID」定義爲「ID」,而這不是您真正想要的。