Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » References in EMF
References in EMF [message #1068042] Thu, 11 July 2013 19:17 Go to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi,

I'm wondering how references are handled in EMF. I've got the following metamodel witht he according emf code:

index.php/fa/15571/0/

class Platform{
  	unsettable attr EString name = "Platform";
  	attr EString reference = "";
  	attr EString identifier = "";
  	
  	val Variationpoint[*] variationpoints;
}

class Variationpoint{
	unsettable attr EString name = "Variationpoint"; 
	attr EString description = "";
}


Normally I would expect that this reference is bidirectional. So that Platform has an arbitrary number of Variationpoints and a Variationpoint knows its paltform. But this doesn't seems to be the case? I'm not able to acces the according Platform with an Variationpoint object.

Re: References in EMF [message #1068046 is a reply to message #1068042] Thu, 11 July 2013 19:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Phil,

Comments below.

On 11/07/2013 9:17 PM, Phil H wrote:
> Hi,
>
> I'm wondering how references are handled in EMF. I've got the following metamodel witht he according emf code:
>
>
>
>
> class Platform{
> unsettable attr EString name = "Platform";
> attr EString reference = "";
> attr EString identifier = "";
>
> val Variationpoint[*] variationpoints;
> }
>
> class Variationpoint{
> unsettable attr EString name = "Variationpoint";
> attr EString description = "";
> }
>
>
> Normally I would expect that this reference is bidirectional.
Is this Emfatic syntax? Is variationpointsa containment reference?
> So that Platform has an arbitrary number of Variationpoints and a Variationpoint knows its paltform.
Where? I don't see a reference to Platform from Variationpoint.
> But this doesn't seems to be the case? I'm not able to acces the according Platform with an Variationpoint object.
I don't see two references only one unidirectional reference.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: References in EMF [message #1068139 is a reply to message #1068046] Fri, 12 July 2013 11:52 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi Ed,

yes it's emfatic syntax. The keyword val means a "by value" EReference (EReference.containment = true).

I thought a aggregation is handled bidirectional, but indeed it's unidirectional. So to overcome this, I tried to use an additional reference:

index.php/fa/15578/0/

But when I create a Platform and add a Variationpoint to this Platform, the Variationpoint don't know it's platform. The user has to assign the reference in the property view manually.

How can I define a bidirectional aggregation in EMF?:

index.php/fa/15579/0/

Re: References in EMF [message #1068144 is a reply to message #1068139] Fri, 12 July 2013 12:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Phil,

I don't know the Emfatic syntax. In the structured editor you set the
opposite feature of one of the references to point at the other in the
properties view.


On 12/07/2013 1:52 PM, Phil H wrote:
> Hi Ed,
>
> yes it's emfatic syntax. The keyword val means a "by value" EReference (EReference.containment = true).
>
> I thought a aggregation is handled bidirectional, but indeed it's unidirectional. So to overcome this, I tried to use an additional reference:
>
>
>
> But when I create a Platform and add a Variationpoint to this Platform, the Variationpoint don't know it's platform. The user has to assign the reference in the property view manually.
>
> How can I define a bidirectional aggregation in EMF?:
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:restriction of child elements
Next Topic:Traversing all resources from XMI-file
Goto Forum:
  


Current Time: Thu Apr 25 17:42:34 GMT 2024

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

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

Back to the top