Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EOpposite and Containment Property
EOpposite and Containment Property [message #646013] Tue, 21 December 2010 15:03 Go to next message
Arun  is currently offline Arun Friend
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

Re: EOpposite and Containment Property [message #646026 is a reply to message #646013] Tue, 21 December 2010 16:14 Go to previous message
Arun  is currently offline Arun Friend
Messages: 16
Registered: October 2010
Junior Member
I found the problem and solved it.

it was an error that Model2 cannot be contained by both ModelX and Model1 at the same time.
Previous Topic:[CDO] using non-sql backend
Next Topic:URI Mapper example - resolve proxy: platform:/model
Goto Forum:
  


Current Time: Sat May 04 02:17:06 GMT 2024

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

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

Back to the top