Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Only recognise the first model type
Only recognise the first model type [message #1847144] Fri, 15 October 2021 18:25 Go to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
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 #1847146 is a reply to message #1847144] Sat, 16 October 2021 05:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Seems unlikely. Just looked at one of my own txes; it has four modeltype declarations all of which work. However none of them use "strict".

Searching my workspace, which includes the QVTo JUnit tests, I find only many examples with "strict" and a single modeltype, but three with multiple "strict" modeltype so it seem to be tested.

As a quick experiment; just delete the strict altogether, or at least on the output. But I suspect that your problem is something rather different that it is impossible to comment on from your minimal repro.

"works" is very rarely an adequate description of a problem. Did your computer catch fire, hang, was there a popup, an error message?

Regards

Ed Willink

Re: Only recognise the first model type [message #1847151 is a reply to message #1847146] Sat, 16 October 2021 08:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Since I have never deliberately used the distinction between "strict" and "effective", I had a look at what the specification says and implementation does.

It appears that Eclipse QVTo has no distinct support; so presumably everything is always "strict".

https://bugs.eclipse.org/bugs/show_bug.cgi?id=576662 raised.

Regards

Ed Willink
Re: Only recognise the first model type [message #1847167 is a reply to message #1847151] Sun, 17 October 2021 20:47 Go to previous messageGo to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
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 20:48]

Report message to a moderator

Re: Only recognise the first model type [message #1847168 is a reply to message #1847167] Mon, 18 October 2021 04:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You conceded that you jumped to a conclusion and so provided a minimal report without a repro.

Now you jump to another conclusion and again provide no repro.

If you want help provide some substantiation for your problem so that it can be reproduced.

You may find that https://wiki.eclipse.org/OCL/ForumNetiquette helps you formulate your query.

Regards

Ed Willink
Re: Only recognise the first model type [message #1847174 is a reply to message #1847167] Mon, 18 October 2021 07:22 Go to previous message
Christopher Gerking is currently offline Christopher GerkingFriend
Messages: 115
Registered: April 2011
Senior Member
Hi John

John Henbergs wrote on Sun, 17 October 2021 16:47
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.

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
Previous Topic:Support of metamodels referencing other metamodels
Next Topic:Can we map two abstract classes?
Goto Forum:
  


Current Time: Fri Apr 26 13:40:16 GMT 2024

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

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

Back to the top