Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Meta-Model Relatoionship
Meta-Model Relatoionship [message #421130] Mon, 28 July 2008 02:35 Go to next message
Raphael is currently offline RaphaelFriend
Messages: 47
Registered: July 2009
Member
Hello!

In my meta-model (ecore), I have two classes wich have relationships, like:

:situation:

Class1
Eattribute=> Class1Attribute:Class2 (Eopposite=> Class2Attribute, Lower
Bound=> 0, Upper Bound=> -1, Containment=> true)

Class2
Eattribute=> Class2Attribute:Class1 (Eopposite=> Class1Attribute, Lower
Bound=> 0, Upper Bound=> -1, Containment=> false)

I've got an error message ("A container reference must have upper bound of
1 not -1") when I try to generate my genmodel. If I change the Class2
upper bound to 1, it works fine and I can generate my genmodel. However, I
need the :situation: discribed above. Is there anyway to do this?!

Thanks,
Raphael
Re: Meta-Model Relatoionship [message #421131 is a reply to message #421130] Mon, 28 July 2008 03:18 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Rafael,

First, note that you are describing EReferences, not EAttributes.
EAttributes store the values of data types only, not references to other
EObjects.

EMF (and MOF-like modeling in general) allows an object to be contained
only by at most one other object. Objects that are not contained are
root elements. Being contained by multiple objects doesn't make sense
in EMF's hierarchical data model.

EMF thinks that you want instances of Class2 to be contained by multiple
Class1 instances because your EReference in Class1 is indicated as a
containment reference (isContainment == true), and your EReference in
Class2 is set as its opposite but has multiplicity many.

EMF allows a pair of opposite EReferences that both have multiplicity
many, but neither of them may be a containment. I suspect that you
marked the first one as a containment by mistake. Just set its
isContainment to false and you should be OK. Note, however, that this
means that you will need some other objects than Class1s to contain your
Class2s, unless of course you define an additional EReference in Class1
to contain your Class2s.

HTH,

Christian


Raphael wrote:
> Hello!
>
> In my meta-model (ecore), I have two classes wich have relationships, like:
>
> :situation:
>
> Class1
> Eattribute=> Class1Attribute:Class2 (Eopposite=> Class2Attribute, Lower
> Bound=> 0, Upper Bound=> -1, Containment=> true)
>
> Class2
> Eattribute=> Class2Attribute:Class1 (Eopposite=> Class1Attribute, Lower
> Bound=> 0, Upper Bound=> -1, Containment=> false)
>
> I've got an error message ("A container reference must have upper bound
> of 1 not -1") when I try to generate my genmodel. If I change the Class2
> upper bound to 1, it works fine and I can generate my genmodel. However,
> I need the :situation: discribed above. Is there anyway to do this?!
>
> Thanks,
> Raphael
>
Previous Topic:Can I register 2 different EMF packages to a single ResourceSet ?
Next Topic:Need to update application schema, Please help.
Goto Forum:
  


Current Time: Tue Apr 23 08:04:56 GMT 2024

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

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

Back to the top