EOpposite and Containment Property [message #646013] |
Tue, 21 December 2010 15:03 |
Arun Messages: 16 Registered: October 2010 |
Junior Member |
|
|
Hi All,
I was playing around with the properties of EReferences to learn the EOpposite concept when i stumbled upon this issue.
I have the following ecore meta-model with the root model element as ModelX.
<?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="EOppositeConcept"
nsURI="http://eoc" nsPrefix="eoc">
<eClassifiers xsi:type="ecore:EClass" name="ModelX">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="m1" upperBound="-1" eType="#//Model1"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="m2" upperBound="-1" eType="#//Model2"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Model1">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="REF_X" eType="#//Model2"
containment="true" eOpposite="#//Model2/REF_Y"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Model2">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="REF_Y" lowerBound="1" eType="#//Model1"
eOpposite="#//Model1/REF_X"/>
</eClassifiers>
</ecore:EPackage>
This meta-model gets validated without any problems (right click on the ecore package and click Validate) and all the generaters work without any errors.
When the model is built in the generated editor environment, the children of Model1 can be inserted as Model2 elements. However, the REF_Y property of Model2 is not visible for setting.
When the model is validated, it throws an error that REF_Y of Model2 is not set.
Is this an error in emf or am i missing something?
Regards
Arun
[Updated on: Tue, 21 December 2010 15:03] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02729 seconds