Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » One source multiple targets
One source multiple targets [message #1842229] Sun, 13 June 2021 18:49 Go to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi Dimitris,

I am encountering an issue with my metamodels (they are quite big), which I actually cannot reproduce with a minimal example, but I will try to explain it.

In the source metamodel I have a "Path", while in the target metamodel, I have "FirstPath" and "IntermediatePath". Paths are contained in "City" in both metamodels.

I write two transformations rules:

Path2FirstPath
Path2IntermediatePath


The difference is what locations they connect and I added that in their guards. However, when I add them to the City2City transformation rule like this:
rule City2City
transform s:Source!City
to t:Target!City {
t.name=s.name;
t.firstPath::=s.path;
t.intermediatePath::=s.path;
}


I get

An internal error occurred during: "Launching transformation".
java.lang.NullPointerException

And in the console I get

Quote:

org.xtext.example.test.Test.impl.IntermediatePathImpl


If I switch places of the firstPath and intermediatePath inside the City transformations rule as follows:

rule City2City
transform s:Source!City
to t:Target!City {
t.name=s.name;
t.intermediatePath::=s.path;
t.firstPath::=s.path;
}


I get

An internal error occurred during: "Launching transformation".
java.lang.NullPointerException

And in the console I get

Quote:

org.xtext.example.test.Test.impl.FirstPathImpl


So I get issues with the second one always.

I truly cannot find what is wrong, and I was wondering, maybe it is not allowed to have two of these statements, where the source is the same?
Quote:

t.intermediatePath::=s.path;
t.firstPath::=s.path;


PS. The target metamodel, is generated, from a grammar written in Xtext.

Would appreciate any help you could give me.

Many thanks,
Tomas!
Re: One source multiple targets [message #1842236 is a reply to message #1842229] Mon, 14 June 2021 05:24 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

Hi Tomas,

It's hard to tell what might be going wrong if I can't reproduce this locally I'm afraid.

Best,
Dimitris
Re: One source multiple targets [message #1842252 is a reply to message #1842236] Mon, 14 June 2021 14:38 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi Dimitris,

I tried as much as possible to create a minimal example, so that I can get the same mistake and you can reproduce it locally and I do here.

So attached I am sending you the Zip files (didn't do this through the Epsilon playground, as some things that work there do not work in Eclipse).

The zip file contains FirstInstance, in which the XText files (target metamodel) are located, and the SecondInstance, where the source metamodel, the models and the transformation is located.

I start getting errors as soon as I add paths in the source model.
This is the error that I am getting now, with the files that I am sending you.

org.xtext.example.textual.textual.impl.PathImpl


Many thanks,
Best Tomas
  • Attachment: Forest.zip
    (Size: 1.75MB, Downloaded 34 times)
Re: One source multiple targets [message #1842267 is a reply to message #1842252] Tue, 15 June 2021 05:46 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

Hi Tomas,

The problem seems to be occurring when you're adding Path elements to "t.initialpath" (but interestingly enough adding InitialPath elements works fine). To verify this, if you replace "t.initialpath ::= s.paths;" with "t.initialpath.add(new Target!Path);" you'll see that the problem still persists. I can't see a reason for this from an EMF point of view so I suspect that the problem you're encountering has to do with Xtext. My recommendation would be to try to write a small Java program (without Epsilon) that creates a model conforming to your textual DSL and if this fails too, post a message to the Xtext forum to see if anyone there can help.

Best,
Dimitris
Re: One source multiple targets [message #1842287 is a reply to message #1842267] Tue, 15 June 2021 13:49 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi Dimitris,

I created a thread in the Xtext forum and this is the link to it: https://www.eclipse.org/forums/index.php/m/1842283/#msg_1842283
I am mostly interested in the last answer by Ed, but I am not really sure where should I add that in my project.
Do you have information on such topic? And do you think that could be it?

Best,
Tomas
Re: One source multiple targets [message #1842307 is a reply to message #1842287] Wed, 16 June 2021 08:00 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

Hi Tomas,

Sorry - my knowledge of Xtext is too superficial to be able to help with this.

Best,
Dimitris
Re: One source multiple targets [message #1842361 is a reply to message #1842307] Thu, 17 June 2021 07:28 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi Dimitris,

Regarding what we were discussing here I noticed the following error:

Caused by: java.lang.ArrayStoreException: org.xtext.example.textual.textual.impl.PathImpl


When I checked online about this it said:

Quote:
Java throws an ArrayStoreException when we try to store a different type of object in an array instead of the declared type.

Suppose we instantiated an array with String type and later tried to store Integer in it. In this case, during runtime, ArrayStoreException is thrown:


As I mentioned before if my transformations are like:

t.intermediatePath::=s.path;
t.firstPath::=s.path;


I get this error for firstpath, while if the firstpath is first and intermediate path is second I get it for intermediate path. So I always get it for the second one. Could it be that in one case I am trying to store the first path, and the the intermediate path which are different?

Thank you!

Tomas
Re: One source multiple targets [message #1842362 is a reply to message #1842361] Thu, 17 June 2021 07:34 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

Hi Tomas,

If you replace "t.initialpath ::= s.paths;" with "t.initialpath.add(new Target!Path);" the problem still persists so it seems to be related to the type of the element you're trying to add (Path). This is perfectly fine EMF-wise but Xtext doesn't seem to like it for some reason.

Best,
Dimitris
Re: One source multiple targets [message #1842819 is a reply to message #1842362] Fri, 02 July 2021 07:16 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi Dimitris,

I am still stuck on this problem that we were discussing a while ago.
Talking to the guys from Xtext they suggest it is a bad transformation because an incompatible path is assigned to an InitialPath collection, but run-time type checking by Epsilon lets the bad assignment slide.

This is the link of this discussion. https://www.eclipse.org/forums/index.php/t/1108232/

What do you think about this? Could the issue be related to the transformation for this reason?

Thanks,
Tomas
Re: One source multiple targets [message #1842821 is a reply to message #1842819] Fri, 02 July 2021 07:52 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

Hi Tomas,

I'm sorry to hear that you're still struggling with this. Epsilon relies on the underlying modelling framework (EMF/Xtext) for run-time type checking so it's unlikely that it is the source of the problem.

Have you tried this to reproduce this without Epsilon as suggested in a previous message?

Best,
Dimitris
Re: One source multiple targets [message #1842822 is a reply to message #1842821] Fri, 02 July 2021 07:59 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi Dimitris,

No I haven't been able to do that. I am not really sure what I should do there and how should I do it, cause I haven't done anything like that before. Is there a tutorial for that or...?

Thank you!

Best,
Tomas
Re: One source multiple targets [message #1842826 is a reply to message #1842822] Fri, 02 July 2021 09:29 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

> Is there a tutorial for that or...?

This is a question for the Xtext forum, I guess.

Best,
Dimitris
Re: One source multiple targets [message #1842828 is a reply to message #1842826] Fri, 02 July 2021 09:34 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
This is the response that I am getting from them :/
https://www.eclipse.org/forums/index.php/t/1108232/

Best,
Tomas
Re: One source multiple targets [message #1842829 is a reply to message #1842828] Fri, 02 July 2021 09:39 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

I believe that the question you should ask is how to construct an Xtext-based model programmatically from Java (without Epsilon).

A quick Google search for "xtext standalone" returns a few promising results, including https://github.com/echebbi/standalone-xtext-example, but the good people at the Xtext forum should be better positioned to advise on this.

Best,
Dimitris
Re: One source multiple targets [message #1842830 is a reply to message #1842829] Fri, 02 July 2021 09:40 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi Dimitris,

Thanks, I will check on that. But how about their last answer, that this is actually an Epsilon thing because it does not type check the transformations?

Best,
Tomas
Re: One source multiple targets [message #1842831 is a reply to message #1842830] Fri, 02 July 2021 09:47 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2032
Registered: July 2009
Location: York, UK
Senior Member

I don't think that continuing this discussion cross-forum is a good idea. If you can get your code to work in Java, please let me know.

Best,
Dimitris

[Updated on: Fri, 02 July 2021 09:53]

Report message to a moderator

Previous Topic:Awesome MDE GitHub repo - help needed
Next Topic:Multiple object type assignment to one object type
Goto Forum:
  


Current Time: Fri May 27 03:22:42 GMT 2022

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

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

Back to the top