Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Read my DSL model "as a whole"
Read my DSL model "as a whole" [message #1321425] Tue, 29 April 2014 09:20 Go to next message
Markus Duft is currently offline Markus DuftFriend
Messages: 148
Registered: February 2013
Senior Member
Hey!

Suppose i have a quite cool DSL by now (yay Wink). Now I have some existing generator operating on a large single MagicDraw model currently. What I want to do is swapping the MagicDraw based model implementation with the EMF based for my DSL. For this I need a way to somehow "read all the model files, merge them into one big EMF model", and possibly also save the model for later use.

Now, how (and when) should i best do this? Should i use the xtend generator to update a model when saving one of the files? It's also ok if I have a separate transformation step for this...

Sorry for the noobishness Wink and thanks for the help!

Cheers,
Markus
Re: Read my DSL model "as a whole" [message #1321433 is a reply to message #1321425] Tue, 29 April 2014 09:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13314
Registered: July 2009
Senior Member
Hi,

i am not sure that you mean by read as a whole.
"the model" is the collection of all resources in the resourceset.
maybe you mean something like http://kthoms.wordpress.com/2011/07/12/xtend-generating-from-multiple-input-models/

so that is the reason you need a single physical resource?
of course you could move the contents of all resources to a single resource


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Read my DSL model "as a whole" [message #1321511 is a reply to message #1321433] Tue, 29 April 2014 10:26 Go to previous messageGo to next message
Markus Duft is currently offline Markus DuftFriend
Messages: 148
Registered: February 2013
Senior Member
Hi,

The term "model" is used too often here i think Smile I have a DSL to model my DB, and each table is in a separate file (simplified). Now i need to have all of them on one big pile...

One question would be how to find all of them (xtext does this already through the classpath, right? how could i re-use this?). Another one is how to get to an EMF model that has all of them instead of only the objects for one file (is there code to do it already?)
Re: Read my DSL model "as a whole" [message #1321518 is a reply to message #1321511] Tue, 29 April 2014 10:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13314
Registered: July 2009
Senior Member
yes and no,

it does it by the resourceset (standalone) and the project(in ecllipse)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Read my DSL model "as a whole" [message #1321519 is a reply to message #1321511] Tue, 29 April 2014 10:33 Go to previous messageGo to next message
Markus Duft is currently offline Markus DuftFriend
Messages: 148
Registered: February 2013
Senior Member
And, yes, thanks for the link, this looks at least near of what i intend to do. only that i will not have the possibility to use xtend there (existing infrastructure). I need to load the model into memory and map all elements to a different type of model. Ideally thre loading of the model should be /fast/, so a "compiled" (serialized, whatever) version of all the single files would be great (a dump of a combined EMF model...?).
Re: Read my DSL model "as a whole" [message #1321533 is a reply to message #1321519] Tue, 29 April 2014 10:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13314
Registered: July 2009
Senior Member
hi i still dont get what you want to do with "the model"

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Read my DSL model "as a whole" [message #1321578 is a reply to message #1321533] Tue, 29 April 2014 11:19 Go to previous messageGo to next message
Markus Duft is currently offline Markus DuftFriend
Messages: 148
Registered: February 2013
Senior Member
i want to convert the DSL model files to a (non-EMF, handwritten) java-based in-memory model (i.e. instantiate some java classes for each element in the model). For the sake of speed i don't want to read each of the DSL model files each time i need the other model, but want to cache some EMF model as base for the conversion.

what i though about already was reading all of the Resources separately and somehow copying the contents into one single (initially empty) EMF model. This could then be persisted, and re-read if i need the "other model" in different applications.

another approach i was thinking about was having an EMF model on disk and only "updating" (i.e. exchange the whole subtree representing the DSL file's contents) the relevant model parts when saving the DSL file on disk (would that be a viable approach?)

i hope it's clear now - i know that it is a little confusing. we have another 4 "models" somewhere in this game (irrelevant for this), so i myself also have a big brain knot already Wink
Re: Read my DSL model "as a whole" [message #1321593 is a reply to message #1321578] Tue, 29 April 2014 11:28 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13314
Registered: July 2009
Senior Member
hi,

this is what carstens blog post is about


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Reference elements from a different file
Next Topic:how to enforce resource generation when having deep cross-reference over multiple resources
Goto Forum:
  


Current Time: Thu Jan 23 01:50:26 GMT 2020

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

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

Back to the top