Only recognise the first model type [message #1847144] |
Fri, 15 October 2021 14:25  |
Eclipse User |
|
|
|
Hi all,
I am using QVTo for model to model transformations and I want to transform from A TO B.
In order to be able to use them I write:
modeltype a "strict" uses A('http://....'); //just an example that why I am not putting the URI here
modeltype b "strict" uses B('http://....');
However, QVTo only recognises, one of them, the one that is defined first. In this case A works, and if I change the order B works.
Any ideas on why this is happening?
Thank you!
|
|
|
|
|
Re: Only recognise the first model type [message #1847167 is a reply to message #1847151] |
Sun, 17 October 2021 16:47   |
Eclipse User |
|
|
|
Hi Ed,
So I tried out somethings, and apparently the issue was not with the "strict" keyword, but because the two metamodels, have concepts with the same names. So I have the following:
modeltype A "strict" uses A('http://....');
modeltype B "strict" uses B('http://....');
transformation test(in srcModel:A out trgModel:B;
main() {
srcModel.rootObjects()[Root] -> map R2R();
}
mapping Root :: R2R() : Root{
name:=self.name;
}
When I hover above the first and second Root, I get
Quote:
A::Root
in both cases. When I check the possible alternatives, I only get one Root. So if the metamodels have concepts with same name, the only alternative I get, is the concept that is part of the metamodel that is defined first as a model type. For now the only way I could find around this was to change the names of the concepts in one of the metamodels, so they are not the same, but I was wondering if there is another solution to it, as it is not feasible to change the names of the model elements (I just tried that to see if that is the issue).
Than you in advance!
[Updated on: Sun, 17 October 2021 16:48] by Moderator
|
|
|
|
Re: Only recognise the first model type [message #1847174 is a reply to message #1847167] |
Mon, 18 October 2021 03:22  |
Eclipse User |
|
|
|
Hi John
John Henbergs wrote on Sun, 17 October 2021 16:47So if the metamodels have concepts with same name, the only alternative I get, is the concept that is part of the metamodel that is defined first as a model type.
If I understand you correctly, both metamodels A and B have a class called Root? In that case, you should use fully qualified names to access Root. Basically, you've already given the solution yourself:
Quote:
A::Root
If you want to access Root from the first metamodel, write A::Root. For the second metamodel, write B::Root.
I agree with Ed that a repro would be helpful, especially if the problem is something completely different than what I expect.
Kind regards
Christopher
|
|
|
Powered by
FUDForum. Page generated in 0.06943 seconds