Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [XPAND] Define EMF metamodel From XML with XPand
[XPAND] Define EMF metamodel From XML with XPand [message #1071176] Fri, 19 July 2013 13:54 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 242
Registered: January 2013
Location: Izmir
Senior Member
Hi all,

I want to ask u how can i define an emf metamodel from given xml with Xpand?

there is any sample or a helper extension file?

and i want to ask u can i use XPand as M2M ?

Regards

[Updated on: Fri, 19 July 2013 14:09]

Report message to a moderator

Re: Define EMF metamodel From XPand [message #1071184 is a reply to message #1071176] Fri, 19 July 2013 14:05 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26287
Registered: July 2009
Senior Member
Serhat,

Comments below.

On 19/07/2013 3:54 PM, serhat gezgin wrote:
> Hi all,
>
> I want to ask u how can i define an emf metamodel from Xpand ?
I'm not sure I understand the question. You define metamodels using Ecore.
>
> there is any sample or a helper extension file?
>
> and i want to ask u can i use XPand as M2M ?
I don't think so. It's a template language designed to produce textual
results.
>
> Regards
Re: Define EMF metamodel From XPand [message #1071188 is a reply to message #1071184] Fri, 19 July 2013 14:19 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 242
Registered: January 2013
Location: Izmir
Senior Member
Hi Ed,

i have a xml file as input model and i want to generate emf metamodel from this
xml file. I generate this as M2T with XPAND and now i want to refactore this XPAND file. And if i can do M2M with XPAND i want to use this feature.

And i want to ask u another question;

on XPAND documentation i saw a function as;

create Entity this duplicate(Entity old):
attribute.addAll(old.attribute.duplicate()) ->
reference.addAll(old.reference.duplicate()) ->
setName(old.name);


What does this code ? i dont understand. (I thought this is M2M function)


Regards,

[Updated on: Fri, 19 July 2013 14:22]

Report message to a moderator

Re: Define EMF metamodel From XPand [message #1071213 is a reply to message #1071188] Fri, 19 July 2013 15:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26287
Registered: July 2009
Senior Member
Serhat,

Comments below.

On 19/07/2013 4:19 PM, serhat gezgin wrote:
> Hi Ed,
>
> i have a xml file as input model
What's in this XML file?
> and i want to generate emf metamodel from this
> xml file.
You want to convert the XML into an Ecore model?
> I generate this as M2T with XPAND and now i want to refactore this
> XPAND file. And if i can do M2M with XPAND i want to use this feature.
I'm quite confused.
>
> And i want to ask u another question;
>
> on XPAND documentation i saw as;
>
>
> create Entity this duplicate(Entity old):
> attribute.addAll(old.attribute.duplicate()) ->
> reference.addAll(old.reference.duplicate()) ->
> setName(old.name);
>
>
> What does this code ? i dont understand. (I thought this is M2M function)
This is the part of the Xtend language used by Xpand?
>
>
> Regards,
Re: Define EMF metamodel From XPand [message #1071270 is a reply to message #1071213] Fri, 19 July 2013 17:44 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 242
Registered: January 2013
Location: Izmir
Senior Member
Hi,

(My xml is clafer feature model xml.)

I am writing feture model with clafer and then i generate it's xml by clafer program.

clafer is quite simple feature model language like;

abstract date : string

abstract Person
    Name : string
    Surname : string
    DateOfBirth : date
    or Gender
        Male
        Female
    xor MaritalStatus
        NeverMarried
        Married
        Divorced
      Address
        Street : string
              UnitNo : string ?
        City : string
	 Country : string
        PostalCode : string


when i use clafer program to generate this code, it gives me a modeled xml file. (and i have clafer's xsd file too)

After that, i want to pass emf for generate java code of my domain model from this xml file. (more specifically for product line)

Hımm then i can M2M with .ext file. am i rigth ?
cause i can call .ext functions on .xpt file ?
This is true ?

Regards.
Re: Define EMF metamodel From XPand [message #1071493 is a reply to message #1071270] Sat, 20 July 2013 08:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26287
Registered: July 2009
Senior Member
Serhat,

Comments below.

On 19/07/2013 7:44 PM, serhat gezgin wrote:
> Hi,
>
> (My xml is clafer feature model xml.)
Eclipse has a feature model project. I wonder if that helps:
http://www.eclipse.org/featuremodel/
>
> I am writing feture model with clafer and then i generate it's xml by
> clafer program.
>
> clafer is quite simple feature model language like;
>
>
> abstract date : string
>
> abstract Person
> Name : string
> Surname : string
> DateOfBirth : date
> or Gender
> Male
> Female
> xor MaritalStatus
> NeverMarried
> Married
> Divorced
> Address
> Street : string
> UnitNo : string ?
> City : string
> Country : string
> PostalCode : string
>
>
> when i use clafer program to generate this code, it gives me a modeled
> xml file. (and i have clafer's xsd file too)
So you could also produce an Ecore model from the XSD in order to read
the XML as an EMF instance:

http://help.eclipse.org/kepler/index.jsp?topic=/org.eclipse.emf.doc/tutorials/xlibmod/xlibmod.html

Is that what you're doing?
>
> After that, i want to pass emf for generate java code of my domain
> model from this xml file. (more specifically for product line)
So for that you want to use Xpand. You might also use
http://www.eclipse.org/acceleo/ or http://www.eclipse.org/xtend/
>
> Hımm then i can M2M with .ext file. am i rigth ?
I believe so.
> cause i can call .ext functions on .xpt file ?
Yes.
> This is true ?
>
> Regards.
Previous Topic:use Generated file in memory directly
Next Topic:[acceleo] org.eclipse.acceleo.feature.group
Goto Forum:
  


Current Time: Mon Dec 22 05:53:13 GMT 2014

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

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