Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » model instances (.xmi)
model instances (.xmi) [message #1799870] Sat, 15 December 2018 19:48 Go to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hi all
I have two models: ("targetv1.xmi "and "targetv2.xmi" ). I want to add one "column" from a "Table" in model "Taargetv1.xmi" to a "Table" in model "Targetv2.xmi" programmatically. Can you guide me?
For example I want to add "column phone" from "Table student" in the model "targetv1.xmi"
To "Table Student" in the model "targetv2.xmi". The Targetv1 Model's picture and Targetv2 Model's picture are attached. [1]

Best Regards
Marzieh
Re: model instances (.xmi) [message #1799911 is a reply to message #1799870] Mon, 17 December 2018 10:58 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2172
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

What have you tried so far?

Cheers,
Dimitris
Re: model instances (.xmi) [message #1799933 is a reply to message #1799911] Mon, 17 December 2018 16:14 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hi Dimitris
I Compare each individual model's element of "Targetv1.xmi"with each element of model "Targetv2.xmi". If there is no element in the "Targetv2.xmi" model, add that element to the "Targetv2.xmi" model. I using the "Resource" and "ResourceSet".[1]
But the problem is that the element has not been added correctly and other elements have been deleted. please see pictures.[1]

2) An other work do:
I use Transform() method and execute "SingelValue2Attribute" rule for "Attribute phone". Then I save the transformation's output in to "Targetv2.xmi" by using "store()" method. But as the picture shows, the column "phone" and the Table "Student" have been duplicated. please see minimal Example.[2]

Best Regards
Marzieh

[Updated on: Tue, 18 December 2018 15:39]

Report message to a moderator

Re: model instances (.xmi) [message #1799989 is a reply to message #1799933] Tue, 18 December 2018 14:19 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2172
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

Your minimal example has grown to over 500 lines of code and running EtlStandaloneExample produces no errors so I'm having trouble understanding the problem you're facing. Could I please also ask you to upload zip instead of rar archives in the future as Eclipse provides a built-in facility for importing zipped projects.

Taking a step back and considering all the issues you've had with Epsilon recently - many of which are related to the nature of your use-case (essentially incremental transformation) - I'm wondering if Epsilon is the right tool for the job or if you'd be better off either using an existing incremental M2M language instead (e.g. ATL) or even just the EMF API and Java for manipulating your models.

Cheers,
Dimitris
Re: model instances (.xmi) [message #1799991 is a reply to message #1799933] Tue, 18 December 2018 15:40 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hi Dimitris
Thank you for your answer.

Best Regards
Marzieh

[Updated on: Tue, 18 December 2018 15:47]

Report message to a moderator

Re: model instances (.xmi) [message #1800011 is a reply to message #1799991] Wed, 19 December 2018 00:23 Go to previous message
Sina MadaniFriend
Messages: 160
Registered: November 2015
Location: York, UK
Senior Member
Hi Marzieh,

If I understand your initial question correctly perhaps the following may be a useful starting point if you are to use EOL:
var sourceColumn = selectOne(c : Targetv1!Column |  c.name == "phone");
transaction {
    var targetTable = selectOne(t : Targetv2!Table | t.name == "Student");
    targetTable.add(sourceColumn);
}

I haven't tested the above code as I do not have a minimal example to work with. As I do not know in what context this problem fits, I cannot advise on suitable alternatives; though for such a fine-grained task it seems Epsilon may not be the best tool.

Thanks,
Sina
Previous Topic:Epsilon as a Service
Next Topic:Copying elements of EPackage to another EPackage
Goto Forum:
  


Current Time: Tue Apr 30 15:43:53 GMT 2024

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

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

Back to the top