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 Muhtaroglu is currently offline ilke MuhtarogluFriend
Messages: 44
Registered: September 2015
I tried to apply the example stated in this emf link as attachment :

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:element name="x" type="xsd:string"/>
<xsd:element ref="one:x"/>
<xsd:element ref="two:x"/>

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 :

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=""/>
<contents xsi:type="ecore:EAnnotation" source="#b"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="a" lowerBound="1" eType="ecore:EClass"
containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="a"/>

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: 31352
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:
Previous Topic:CopyToClipboardCommand makes editor dirty
Next Topic:Is it possible to change the return type of EObjectContainmentEList?
Goto Forum:

Current Time: Wed Aug 05 19:53:55 GMT 2020

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

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

Back to the top