Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Ecore - EOpposite relation to self
EMF Ecore - EOpposite relation to self [message #932946] Thu, 04 October 2012 15:43 Go to next message
Miklós Földényi is currently offline Miklós Földényi
Messages: 6
Registered: October 2012
Junior Member
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.

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:
index.php/fa/11733/0/

Any help is welcome! Smile

[Updated on: Thu, 04 October 2012 15:45]

Report message to a moderator

Re: EMF Ecore - EOpposite relation to self [message #933001 is a reply to message #932946] Thu, 04 October 2012 16:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
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 #933021 is a reply to message #933001] Thu, 04 October 2012 16:56 Go to previous messageGo to next message
Miklós Földényi is currently offline Miklós Földényi
Messages: 6
Registered: October 2012
Junior Member
Hi Ed!

Thanks for confirming that this is not possible. Based on your reply I came up with the following:
index.php/fa/11738/0/

Works perfectly! Smile

Thx again,
Miklós

[Updated on: Thu, 04 October 2012 17:17]

Report message to a moderator

Re: EMF Ecore - EOpposite relation to self [message #933618 is a reply to message #933021] Fri, 05 October 2012 07:12 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4097
Registered: July 2009
Senior Member
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
>
>
Previous Topic:[CDO] Generated Editor with CDOResource
Next Topic:[JET]JETEmitter Problem when running workspace
Goto Forum:
  


Current Time: Fri Oct 24 23:11:51 GMT 2014

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

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