Skip to main content



      Home
Home » Modeling » EMF » EOpposite for multiple children
EOpposite for multiple children [message #415520] Wed, 19 December 2007 11:09 Go to next message
Eclipse UserFriend
Hi there,

maybe I didn't get the EOpposite right, because I can't figure this out:

I have a "Man" and a "Girl" and a "Boy" class, where the two latter
inherit from "Child".
The "Man" aggregates "daughters" and "sons" directly but not
additionally "children" to explicitly separate them.
Vice versa the "Child" is associated to its "father", and as "Girl" and
"Boy" inherit from "Child", each also has a "father".

Now I want to set "daughters" to EOpposite of "father". And for "sons"
respectively. This is not possible... why?

Cheers,
Hauke
Re: EOpposite for multiple children [message #415524 is a reply to message #415520] Wed, 19 December 2007 13:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

This is because the relationship must be uniquely bi-directional and you
can only have one EOpposite. For example for "father" the EOpposite is
"children", while for "children" the EOpposite is "father". Because of
this you can't have both "daughters" and "sons" to have the same
EOpposite of "father". Then "father" would have two EOpposites.

Hauke Fuhrmann wrote:
> Hi there,
>
> maybe I didn't get the EOpposite right, because I can't figure this out:
>
> I have a "Man" and a "Girl" and a "Boy" class, where the two latter
> inherit from "Child".
> The "Man" aggregates "daughters" and "sons" directly but not
> additionally "children" to explicitly separate them.
> Vice versa the "Child" is associated to its "father", and as "Girl" and
> "Boy" inherit from "Child", each also has a "father".
>
> Now I want to set "daughters" to EOpposite of "father". And for "sons"
> respectively. This is not possible... why?
>
> Cheers,
> Hauke

--
Thanks,
Rich Kulp
Re: EOpposite for multiple children [message #415526 is a reply to message #415520] Wed, 19 December 2007 13:52 Go to previous messageGo to next message
Eclipse UserFriend
Hauke,

We expect the opposite of the opposite to be the original feature. You
can define separate "father" features in Girl and Boy and define
EOperations on Child that match the signature of the "father" accessor
methods generated in the derived classes. As to why, well, an eOpposite
is a single valued feature so the "father" feature of the "Child" class
cannot have two different opposites...


Hauke Fuhrmann wrote:
> Hi there,
>
> maybe I didn't get the EOpposite right, because I can't figure this out:
>
> I have a "Man" and a "Girl" and a "Boy" class, where the two latter
> inherit from "Child".
> The "Man" aggregates "daughters" and "sons" directly but not
> additionally "children" to explicitly separate them.
> Vice versa the "Child" is associated to its "father", and as "Girl" and
> "Boy" inherit from "Child", each also has a "father".
>
> Now I want to set "daughters" to EOpposite of "father". And for "sons"
> respectively. This is not possible... why?
>
> Cheers,
> Hauke
>
Re: EOpposite for multiple children [message #415527 is a reply to message #415524] Wed, 19 December 2007 13:54 Go to previous message
Eclipse UserFriend
Rich,

Sorry, I was on a call when I has already drafted my answer so I didn't
see that you'd already answered it well before I hit send after the
call. Thanks!


Rich Kulp wrote:
> This is because the relationship must be uniquely bi-directional and
> you can only have one EOpposite. For example for "father" the
> EOpposite is "children", while for "children" the EOpposite is
> "father". Because of this you can't have both "daughters" and "sons"
> to have the same EOpposite of "father". Then "father" would have two
> EOpposites.
>
> Hauke Fuhrmann wrote:
>> Hi there,
>>
>> maybe I didn't get the EOpposite right, because I can't figure this out:
>>
>> I have a "Man" and a "Girl" and a "Boy" class, where the two latter
>> inherit from "Child".
>> The "Man" aggregates "daughters" and "sons" directly but not
>> additionally "children" to explicitly separate them.
>> Vice versa the "Child" is associated to its "father", and as "Girl" and
>> "Boy" inherit from "Child", each also has a "father".
>>
>> Now I want to set "daughters" to EOpposite of "father". And for "sons"
>> respectively. This is not possible... why?
>>
>> Cheers,
>> Hauke
>
Previous Topic:rool back on resource creation
Next Topic:ecore2xml using XMLMap created in the ecore2xml model
Goto Forum:
  


Current Time: Sun Nov 09 21:31:38 EST 2025

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

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

Back to the top