Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How Can I apply xsd:choice element to my emf model editor.( xsd:choice does not appear in ecore after generating it)
How Can I apply xsd:choice element to my emf model editor. [message #1814860] Fri, 20 September 2019 13:45 Go to next message
ilke Muhtar is currently offline ilke MuhtarFriend
Messages: 47
Registered: September 2015
Member
I tried to apply the example stated in this emf link as attachment :

https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210

Examples showing how the new stuff can be used. I downloaded and tried to apply exampleOne / model / ExampleOne.xsd ... So I have a xsd file similar to this.

<xsd:complexType name="RealChoice">
<xsd:choice>
<xsd:element name="x" type="xsd:string"/>
<xsd:element ref="one:x"/>
<xsd:element ref="two:x"/>
</xsd:choice>
</xsd:complexType>

In my eclipse emf (Which has EMF Common Version 2.10.1.v20150123-0348 and has EMF Ecore Version 2.10.1.v20150123-0348 ) when I try to generate ecore from xsd file according to this link :

https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.emf.doc%2Ftutorials%2Fxlibmod%2Fxlibmod.html


I don't get any word as "choice" in my generated ecore file as it exists in one.ecore file :


<eClassifiers xsi:type="ecore:EClass" name="RealChoice">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="RealChoice"/>
<details key="kind" value="elementOnly"/>
<contents xsi:type="ecore:EAnnotation" source="sequence">
<contents xsi:type="ecore:EAnnotation" source="#a"/>
<contents xsi:type="ecore:EAnnotation" source="choice">
<contents xsi:type="ecore:EAnnotation" source="#x"/>
<contents xsi:type="ecore:EAnnotation" source="x"/>
<contents xsi:type="ecore:EAnnotation" source="http://www.example.org/two#x"/>
</contents>
<contents xsi:type="ecore:EAnnotation" source="#b"/>
</contents>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="a" lowerBound="1" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"
containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="a"/>
</eAnnotations>


Therefore in my EMF Project Eclipse Application that I generated from genmodel I cant add only once the elements. They don't appear as a choice... After adding one of these choice elements I can still add (choose) the second.

Any Help ? How Can I apply xsd:choice element to my emf model editor.
Re: How Can I apply xsd:choice element to my emf model editor. [message #1814861 is a reply to message #1814860] Fri, 20 September 2019 15:02 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
The Bugzilla you reference is a very old one. That work was never completed/commited so there is no support available for that. A choice will map to the same thing as would a sequence, except all the elements will be optional (lower bound 0). The mutual exclusiveness of a choice is not modeled and cannot be modeled in Ecore; you'd have to implement a constraint that will diagnose and instance as being invalid if more than one of the "choice" features is set in any given instance.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:CopyToClipboardCommand makes editor dirty
Next Topic:Is it possible to change the return type of EObjectContainmentEList?
Goto Forum:
  


Current Time: Tue Apr 30 02:42:37 GMT 2024

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

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

Back to the top