One source multiple targets [message #1842229] |
Sun, 13 June 2021 18:49 |
Tomas Wall 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 #1842252 is a reply to message #1842236] |
Mon, 14 June 2021 14:38 |
Tomas Wall 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 101 times)
|
|
|
Re: One source multiple targets [message #1842267 is a reply to message #1842252] |
Tue, 15 June 2021 05:46 |
|
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 #1842362 is a reply to message #1842361] |
Thu, 17 June 2021 07:34 |
|
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 #1842821 is a reply to message #1842819] |
Fri, 02 July 2021 07:52 |
|
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
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04478 seconds