Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Emfatic] bidirectional aggregation
[Emfatic] bidirectional aggregation [message #1068156] Fri, 12 July 2013 12:55 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 with Emfatic. I've got the following metamodel with the according emfatic syntax:

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 Platform. But this doesn't seems to be the case? I'm not able to acces the according Platform with an Variationpoint object.

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 with Emfatic?:

index.php/fa/15579/0/
Re: [Emfatic] bidirectional aggregation [message #1068159 is a reply to message #1068156] Fri, 12 July 2013 13:06 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Phil,

You can use opposite references to do this [1].

class Platform{
unsettable attr EString name = "Platform";
attr EString reference = "";
attr EString identifier = "";

val Variationpoint[*]#platform variationpoints;
}

class Variationpoint{
unsettable attr EString name = "Variationpoint";
attr EString description = "";
ref Platform#variationpoints platform;
}

Cheers,
Dimitris

[1] http://refcardz.dzone.com/refcardz/essential-emf
Re: [Emfatic] bidirectional aggregation [message #1068199 is a reply to message #1068159] Fri, 12 July 2013 16:28 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Thx Dimitris, that work like a charm.
Re: [Emfatic] bidirectional aggregation [message #1070186 is a reply to message #1068199] Wed, 17 July 2013 12:22 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hmm while it worked for the most cases, I get a warning for the following model:

class Pl{

  	unsettable attr EString name = "ProductLine";

  	val Fm[*]#pl fms; 
}

@gmf.node(label="name", label.icon="false", color="238,233,233", border.color="0,0,0")
class Fm{
  	unsettable attr EString name = "Fm";
  	
  	ref Pl[1]#fms pl;

  	@gmf.compartment(layout="list")
  	val Vc[*]#fm internalVc;
}

@gmf.node(label="expression", label.icon="true", figure="rectangle", border.color="0,0,0", color="238,233,233")
class Vc{
  	unsettable attr EString expression = "Vc"; 
  	 
        ref Fm[1]#internalVc fm; 
}


I get the following warning, which is caused of the bidriectional reference between the classes Fm and Vc:

- A containment reference of a type with a container feature org.eclipse.emf.ecore.impl.EReferenceImpl@59e38a{platform:/resource/dummy#//Vc/fm} that requires instances to be contained elsewhere cannot be populated


I've no idea what is the problem in this case? Have I missed something?

Cheers,
Phil
Re: [Emfatic] bidirectional aggregation [message #1070272 is a reply to message #1070186] Wed, 17 July 2013 15:55 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Phil,

What happens if your remove the [1] multiplicities? If memory serves, containment references, opposites and multiplicities with a lower bound > 0 don't always play well together.

Cheers,
Dimitris
Re: [Emfatic] bidirectional aggregation [message #1070309 is a reply to message #1070272] Wed, 17 July 2013 17:46 Go to previous message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi Dimitris,

the [1] multiplicities from ref Fm[1]#internalVc fm; was exactly the reason for this warning. It's working now anyway.

Cheers,
Phil
Previous Topic:[ETL] same metamodel
Next Topic:EOL polishing script setup
Goto Forum:
  


Current Time: Thu Apr 25 02:24:51 GMT 2024

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

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

Back to the top