Non-containment for a child reference [message #504574] |
Mon, 21 December 2009 15:12 |
gabriele Mising name 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
|
|
|
Powered by
FUDForum. Page generated in 0.03385 seconds