One source multiple targets [message #1842229] |
Sun, 13 June 2021 18:49  |
Eclipse User |
|
|
|
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 #1842252 is a reply to message #1842236] |
Mon, 14 June 2021 14:38   |
Eclipse User |
|
|
|
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 109 times)
|
|
|
Re: One source multiple targets [message #1842267 is a reply to message #1842252] |
Tue, 15 June 2021 05:46   |
Eclipse User |
|
|
|
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 #1842361 is a reply to message #1842307] |
Thu, 17 June 2021 07:28   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04630 seconds