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

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

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



<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="" xmlns:xsi=""xmlns: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"
<eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1"
eType="#//Group" containment="true"/>
<eClassifiers xsi:type="ecore:EClass" name="Group">
<eStructuralFeatures xsi:type="ecore:EReference" name="boxRefs" upperBound="-1"
<eClassifiers xsi:type="ecore:EClass" name="Box"/>

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

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"
<containmentFeature href="model.ecore#//Diagram/groups"/>
<domainMetaElement href="model.ecore#//Group"/>
<diagramNode href="model.gmfgraph#Group"/>
<containmentFeature href="model.ecore#//Diagram/boxs"/>
<childrenFeature href="model.ecore#//Group/boxRefs"/>
<domainMetaElement href="model.ecore#//Box"/>
<tool xsi:type="gmftool:CreationTool"
<diagramNode href="model.gmfgraph#Box"/>
<diagramCanvas href="model.gmfgraph#model"/>
<domainModel href="model.ecore#/"/>
<domainMetaElement href="model.ecore#//Diagram"/>
<palette href="model.gmftool#//@palette"/>

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,
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