Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to model undirected references?
How to model undirected references? [message #426068] Mon, 15 December 2008 15:55 Go to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 15
Registered: July 2009
Junior Member
Hi,
If I have a class "Person", how to model a non-containment reference "friends"? In other words, if Person A has friends
B and C, then B and C should also have A as a friend. Can this be solved using EOpposite?

Regards,
Hao
Re: How to model undirected references? [message #426072 is a reply to message #426068] Mon, 15 December 2008 16:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Hao,

Unfortunately a reference can't be its own opposite. Even UML doesn't
support this since an association has to have two different ends. I
could imagine outgoing-friends and incoming-friends pairs and a derived
references that's a union of the two, but that seems not so totally
satisfying...


Hao Zhang wrote:
> Hi,
> If I have a class "Person", how to model a non-containment reference "friends"? In other words, if Person A has friends
> B and C, then B and C should also have A as a friend. Can this be solved using EOpposite?
>
> Regards,
> Hao
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to model undirected references? [message #426075 is a reply to message #426068] Mon, 15 December 2008 17:11 Go to previous message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hi Hao,

What about a "FriendRelationship" class having a many
(2...2) "persons"-reference with a "Person.friendRelations"-opposite. This
would allow the navigation "Person.friendRelations.persons" but this list
would also contain the Person object you have startet with. A derived
feature "Person.friends" may return a set of friendRelations.persons
without it's owner.

Regards

Enrico

with Hao Zhang wrote:

> Hi,
> If I have a class "Person", how to model a non-containment reference
> "friends"? In other words, if Person A has friends B and C, then B and C
> should also have A as a friend. Can this be solved using EOpposite?
>
> Regards,
> Hao
Previous Topic:DnD in Sample Ecore Editor
Next Topic:Problem using generated dynamic instances
Goto Forum:
  


Current Time: Fri Apr 19 21:23:12 GMT 2024

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

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

Back to the top