|
Re: modeling probem - opposite relation [message #1017568 is a reply to message #1017158] |
Tue, 12 March 2013 05:13 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Inor,
Comments below.
On 11/03/2013 7:30 PM, Inor Nerokstein wrote:
> I want bidirectionality between the contained object and its
> container. I have this model:
>
> /** @model abstract="true" */
> public interface ContainedObject {
> /** @model */
> public Container getContainer();
> }
>
> /** @model abstract="true" */
> public interface Container extends ContainedObject { }
>
> /* @model */
> public interface Category extends Container {
> /** @model containment="true" opposite="container" */
> public List<Category> getCategories(); /** @model
> containment="true" opposite="container" */
> public List<Variable> getVariables();
There can't be one "container" feature that has both this "variables"
feature and the above "categories" feature as it's opposite. The
"container" feature can have at most one opposite (which typically will
be a feature defined in "Container" in this example).
> }
>
> /** @model */
> public interface Variable extends ContainedObject { }
>
> For the above model i'm getting the following error message when i try
> to create the .genmodel:
>
>
> "the opposite 'container' already has attribute 'categories' of
> 'Category' as its opposite"
>
> what's wrong with this model?
You could define getContainer as just an EOperation and implement it to
derive from EObject.eContainer().
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03594 seconds