Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Create new objects in transformation
Create new objects in transformation [message #1735947] Thu, 23 June 2016 21:58 Go to next message
Gunnar Sörens is currently offline Gunnar SörensFriend
Messages: 1
Registered: June 2016
Junior Member
Hi! Razz
I'm fairly new to Epsilon so I face a (probably simple) problem.
To demonstrate this, assume the following meta-model:
There are three classes A, B and C, where many Bs may be contained by A and C holds some additional information.

Now some instances of B could be derived by a "base instance" of B and additional information from instances of C.
I want to reduce the work and only require one instance of B to be modeled and the other ones to be auto-generated with the information of C.

So before I start with my actual transformation, I want to use a small transformation to auto-generate the missing instances of B.

As an example, consider the following:
pre {
        var all_bs = MyModel.getAllOfKind("B");
	for (b in all_bs) {
		var b2 = new B;
                //use some information from C to assemble b2
	}
}


However, this creates the new B object at the topmost level of the resulting model; i.e., the new instances of B are at the same level as A and no longer contained by the original instance of A.

How could i insert the new instances at the same level as the original instance of B?
Should I use pre-blocks to do this work, or could actual rules be used? (Consider that I want a dynamic number of instances to be created)
Or should I take a completely different approach?

I hope you understand my question.
Looking forward to answers,
Gunnar
Re: Create new objects in transformation [message #1736024 is a reply to message #1735947] Fri, 24 June 2016 13:11 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Gunnar,

Could you please provide a minimal example [1] I can use to reproduce this and advise further?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples
Previous Topic:[EVL live validation not done]
Next Topic:Another Minor Epsilon Book Bug (p. 52)
Goto Forum:
  


Current Time: Wed Apr 24 23:28:33 GMT 2024

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

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

Back to the top