Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Non-containment for a child reference
Non-containment for a child reference [message #504574] Mon, 21 December 2009 15:12
gabriele Mising name is currently offline gabriele Mising nameFriend
Messages: 19
Registered: December 2009
Junior Member
how can I define containment based on reference?
For example, "Diagram" contains "Group" and "Box", "Group" refers to "Box".
I want to show "Group"s as nodes (Top Node Reference), containing inside "Box"s
(Child Reference).
The problem is, "Group" does not contain "Box", but only
refers to it- how do I specify the Containment Feature of Child Reference
"Box"?


Description Model:
Diagram
- boxs : Box (multiplicity="0..N", containment="true")
- groups : Group (multiplicity="0..N", containment="true")

Group
- boxRefs : Box (multiplicity="0..N", containment="false")

Box



XMI MODEL:


<?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="model" nsURI="http://test" nsPrefix="test.containment">

<eClassifiers xsi:type="ecore:EClass" name="Diagram">
<eStructuralFeatures xsi:type="ecore:EReference" name="boxs" upperBound="-1" eType="#//Box"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1"
eType="#//Group" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Group">
<eStructuralFeatures xsi:type="ecore:EReference" name="boxRefs" upperBound="-1"
eType="#//Box"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Box"/>
</ecore:EPackage>



------------------------------------------------------------ --------------------------------------------

I tried mapping the elements in this way but it does not validate:
"'Containment Feature' must be owned by 'Domain Meta Element' or its super type of this reference parent Node Mapping".


Here are the mappings: ('Diagram' is domain element in CanvasMapping):
TopNodeReference for 'Group'
NodeMapping for 'Group'
ChildReference for 'Box'
NodeMapping for 'Box'

Properties of ChildReference for 'Box':
childrenFeature: the reference from Group to box
containmentFeature: the containment Diagram contains Box


<?xml version="1.0" encoding="UTF-8"?>
<gmfmap:Mapping xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmfmap="http://www.eclipse.org/gmf/2008/mappings"
xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
<nodes>
<containmentFeature href="model.ecore#//Diagram/groups"/>
<ownedChild>
<domainMetaElement href="model.ecore#//Group"/>
<toolxsi:type="gmftool:CreationTool"
href="model.gmftool#//@palette/@tools.0/@tools.1"/>
<diagramNode href="model.gmfgraph#Group"/>
<children>
<containmentFeature href="model.ecore#//Diagram/boxs"/>
<childrenFeature href="model.ecore#//Group/boxRefs"/>
<ownedChild>
<domainMetaElement href="model.ecore#//Box"/>
<tool xsi:type="gmftool:CreationTool"
href="model.gmftool#//@palette/@tools.0/@tools.1"/>
<diagramNode href="model.gmfgraph#Box"/>
</ownedChild>
</children>
</ownedChild>
</nodes>
<diagram>
<diagramCanvas href="model.gmfgraph#model"/>
<domainModel href="model.ecore#/"/>
<domainMetaElement href="model.ecore#//Diagram"/>
<palette href="model.gmftool#//@palette"/>
</diagram>
</gmfmap:Mapping>




I used these GMF versions
Version: 1.2.1.v20090729-2029-7d8D7CFXwnKwGb_GGuSCBqELpPk0
Version: 2.3.0.v20091216-1748-7C7J-BLxloAuwMCHwhHYp62jjROb



Thank you in advance,
Gabriele
Previous Topic:Create a Node with a Connection
Next Topic:Routing Style settings lost after reloading diagram
Goto Forum:
  


Current Time: Thu Apr 22 15:35:32 GMT 2021

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

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

Back to the top