Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Problems with opposite references.
Problems with opposite references. [message #237035] Tue, 21 July 2009 09:04 Go to next message
Anthony is currently offline AnthonyFriend
Messages: 10
Registered: July 2009
Junior Member
Hello,

I'm using GMF 2.1.2 and I have a problem and I don't know if I am doing
something bad.

I have two nodes: Node A and Node B. Node B can be created alone or as a
child of Node A.

Node A have a 0..* reference (nodesB) with containment true to Node B.
Node B have a 0..1 reference (nodeContainer) which value in EOpposite is
"nodesB : NodeA". So the value in Container is "true". The value of
Containment of this reference is "false". This reference references to
Node A.

I need this last reference because I want to create an OCL constraint that
needs to know if NodeB is alone or is as a part of Node A.

An example of OCL constraint:

context: Node B
invariant: self.nodeContainer <> null


When I draw a NodeB in the Eclipse instance, in properties view doesn't
appear the nodeContainer reference. And when I click on Diagram/Validate
it says me that the OCL constraint is disabled(this last information is
because the OCL constraint can't be evaluated (there is an error on OCL
constraint).)

Thanks for your time.

PS: In the Dynamic Instance of Ecore the nodeContainer reference works
fine.
Re: Problems with opposite references. [message #237077 is a reply to message #237035] Tue, 21 July 2009 10:57 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Anthony,

Try regenerating EMF model/edit/editor code from .genmodel.

-----------------
Alex Shatalin
Re: Problems with opposite references. [message #237088 is a reply to message #237077] Tue, 21 July 2009 11:26 Go to previous messageGo to next message
Anthony is currently offline AnthonyFriend
Messages: 10
Registered: July 2009
Junior Member
Hello,
I always regenerate from zero when I change the ecore. I delete the
diagram code, the gmfgen, the genmodel, the model code and the edit code;
then I generate .genmodel, the model code, the edit code, the gmfgen model
and the diagram model.
Re: Problems with opposite references. [message #237386 is a reply to message #237088] Fri, 24 July 2009 08:24 Go to previous message
Anthony is currently offline AnthonyFriend
Messages: 10
Registered: July 2009
Junior Member
Hello,
here is the ecore in text format. Node A is the class Team, and node B
is the class Player. If you need more information, please tell me it.

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org
2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="prueba1"
nsURI="prueba1" nsPrefix="prueba1">
<eClassifiers xsi:type="ecore:EClass" name="Root">
<eStructuralFeatures xsi:type="ecore:EReference" name="players"
upperBound="-1"
eType="#//Player" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="teams"
upperBound="-1"
eType="#//Team" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Player">
<eStructuralFeatures xsi:type="ecore:EReference" name="team"
eType="#//Team" eOpposite="#//Team/members"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Team">
<eStructuralFeatures xsi:type="ecore:EReference" name="members"
upperBound="-1"
eType="#//Player" containment="true" eOpposite="#//Player/team"/>
</eClassifiers>
</ecore:EPackage>

Thanks.
Previous Topic:java.lang.IllegalStateException: Cannot modify,resource set without a write transaction
Next Topic:layout connections
Goto Forum:
  


Current Time: Fri Apr 26 11:13:17 GMT 2024

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

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

Back to the top