|
Re: EMF Ecore - EOpposite relation to self [message #933001 is a reply to message #932946] |
Thu, 04 October 2012 12:40   |
Eclipse User |
|
|
|
Miklós,
Comments below.
On 04/10/2012 5:43 PM, Miklós Földényi wrote:
> I am pretty new to EMF Ecore modelling and I have come across a problem that my usual Googling did not help with.
>
> Assume an object (referred to as "SomeObject") that can be connected to an arbitrary number of other "SomeObject"s. This relation is bi-directional, and I would like to have EMF maintain it for me.
>
> For this to model, I defined an additional class (referred to as "ConnectionPoint") that is contained by "SomeObject", and has a reference to the parenting "SomeObject" and an other "ConnectionPoint" object.
>
> This last reference is where I am stuck. As I understand, bi-directional links are defined by having 2 EReferences refer each other as EOpposites, however, in this case there is only 1 link, and itself should be it's own EOpposite. The editor does not offer this as an option.
That's not supported. You'd need to define something more like
outgoingConnection and incomingConnection and pair those two...
>
> How can I go about tagging this relation as being it's own opposite? Or is it not possible and should be modeled using some pattern I haven't come across yet?
>
> The ECore model diagram:
>
>
> Any help is welcome! :)
|
|
|
|
Re: EMF Ecore - EOpposite relation to self [message #933618 is a reply to message #933021] |
Fri, 05 October 2012 03:12  |
Eclipse User |
|
|
|
Hi
You don't need to introduce an unnecessary class.
Your problem is the same as the Person with parent and child roles.
Just give the two ends distinct role names.
Regards
Ed Willink
On 04/10/2012 18:56, Miklós Földényi wrote:
> Hi Ed!
>
> Thanks for confirming that this is not possible. Based on your reply I came up with the following:
>
>
> Works perfectly! :)
>
> Thx again,
> Miklós
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03288 seconds