Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » XSD 2 Ecore with Xpand(XSD 2 Ecore with Xpand)
XSD 2 Ecore with Xpand [message #1005918] Tue, 29 January 2013 10:02 Go to next message
serhat gezgin is currently offline serhat gezgin
Messages: 240
Registered: January 2013
Location: Izmir
Senior Member
Hi,

I want to use xpand for xsd 2 ecore.

But i have problem because my xsd metamodel is larger meaning of ecore.

Ecore dont support inner class system. But my XSD metamodel have inner

class hierarchy. Because of these i must convert inner class to 2 different classes.

Problem is start here. When i see inner class i must write

this class out of its parent and must be reference to its parent. So i have list of

inner classes and later when parent class text finished i must implement these

clases. But this approach is complex. Question is;

How can i use ecore api or something to create ecore simple ?

Not: I dont want to create .ecore file with text(xml)value i just need to use library or somethink else to create ecore can u help me with this ?

my template sample;

«DEFINE Root FOR ir::IModule»
	«FILE moduleName(name) + ".ecore"»<?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= "«moduleName(name)»" nsURI="http://«moduleName(name)»/1.0" nsPrefix="«moduleName(name)»">
    «EXPAND EClass FOREACH clafers()»
</ecore:EPackage>
	«ENDFILE»
«ENDDEFINE»


[Updated on: Tue, 29 January 2013 11:29]

Report message to a moderator

Re: XSD 2 Ecore with Xpand [message #1006396 is a reply to message #1005918] Thu, 31 January 2013 09:00 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten Thoms
Messages: 354
Registered: July 2009
Location: Dortmund
Senior Member

No Message Body

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: XSD 2 Ecore with Xpand [message #1006398 is a reply to message #1005918] Thu, 31 January 2013 09:08 Go to previous message
Karsten Thoms is currently offline Karsten Thoms
Messages: 354
Registered: July 2009
Location: Dortmund
Senior Member

Serhat,

I don't really understand what you wrote, sorry.

Your task is to map an XSD to Ecore, right? For this task you would not need Xpand, there is a standard mapping implementation in EMF XSD, see class org.eclipse.xsd.ecore.XSDEcoreBuilder.XSDEcoreBuilder.

Xpand's XSD typesystem uses this class to derive types from XSD, it might be worth at the sources in the plugin org.eclipse.xtend.typesystem.xsd, especially class OawXSDEcoreBuilder, XSDMetaModel.

Note also this blog entry: http://www.svenlange.co.za/2013/01/avoid-name-collision-in-ecore-generated-from-xsd/

Hope this helps,
~Karsten



Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Previous Topic:[ACCELEO] maven repo for juno ?
Next Topic:org.eclipse.emf.mwe.utils.Reader is not reading stereotype
Goto Forum:
  


Current Time: Sat Oct 25 11:23:05 GMT 2014

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

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