Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Using QVTo with Xtext
Using QVTo with Xtext [message #1786036] Tue, 24 April 2018 14:36 Go to next message
Daniel Strueber is currently offline Daniel StrueberFriend
Messages: 11
Registered: April 2014
Junior Member
Hello,

I have two meta-models, A and B. B is based on an Xtext grammar, and instances of B are supposed to be saved using the Xtext syntax.

I also have two QVTo transformations, one from A to B, one from B to A. The plug-ins for A and B are deployed to the Eclipse instance in which I have defined the transformations. I'm using the Eclipse Neon release with the corresponding versions of QVTo and Xtext.

I execute both transformations using Run Configurations.

The execution of the B-to-A transformation works smoothly. Apparently, QVTo is able to use the Xtext loading mechanism for loading the textual instances of B.

The execution of the A-to-B transformation fails with the following stack trace. I even get the trace when I remove all actual transformation logic from A-to-B (which in the case of B-to-A doesn't lead to an error).


!ENTRY org.eclipse.m2m.qvt.oml 4 0 2018-04-24 16:19:22.781
!MESSAGE Operational QVT Interpreter
!STACK 0
org.eclipse.m2m.internal.qvt.oml.common.MdaException: Save model param extents diagnostic [Failed to save model extent uri=platform:/resource/path/to/example/output.B]
at org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchUtil.doLaunch(QvtLaunchUtil.java:271)
at org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchUtil.doLaunch(QvtLaunchUtil.java:211)
at org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchConfigurationDelegate$1.run(QvtLaunchConfigurationDelegate.java:60)
at org.eclipse.m2m.internal.qvt.oml.common.launch.SafeRunner$SameThreadRunner.run(SafeRunner.java:33)
at org.eclipse.m2m.internal.qvt.oml.common.launch.SafeRunner$1.run(SafeRunner.java:26)
at org.eclipse.m2m.internal.qvt.oml.common.launch.ShallowProcess.run(ShallowProcess.java:45)
at org.eclipse.m2m.internal.qvt.oml.common.launch.ShallowProcess.run(ShallowProcess.java:36)
at org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchConfigurationDelegate$3.run(QvtLaunchConfigurationDelegate.java:95)
at java.lang.Thread.run(Thread.java:745)


Am I missing something here?

Best regards,
Daniel
Re: Using QVTo with Xtext [message #1786040 is a reply to message #1786036] Tue, 24 April 2018 15:50 Go to previous messageGo to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 30
Registered: April 2012
Member
First I would try to save to an '.xmi' serialization, to get the Xtext serialization out of the way. Such you can debug if the model has the expected structure.

If the model has the correct structure you can test the serialization to Xtext. Open the .xmi file with the sample-reflective-model editor, and use the 'save as' to serialize it as a '.B' syntax.

Serialization to xtext can be tricky, for instance with respect to white-space. Check the Xtext documentation, https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#serialization

[Updated on: Tue, 24 April 2018 15:51]

Report message to a moderator

Re: Using QVTo with Xtext [message #1786046 is a reply to message #1786040] Tue, 24 April 2018 17:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

I do Xtext2... QVTo transformations as part of the XText2LPG transformation chain. See GIT\org.eclipse.ocl\examples\org.eclipse.ocl.examples.xtext2lpg. But in order to reason with Xext I start with an Xtext to XBNF (XText-like BNF) and then refine the XBNF before emitting LPG.

There is no need to worry about Xtext serialization. If you create a valid Xtext AS model, the Xtext serialization will format automatically, it may not look nice but that's a limitation of the Xtext formatting of Xtext.

My guess is that you have a configuration bug in invoking QVTo but without a repro I cannot comment further. Ensuring that it goes direct to Xtext may be tricky.

Rolf's advice to save as XMI will help once you get the standard Xtext serialization failure. Quite possibly this is what you had but it has been superseded by a simple "failed to save". If there is missing QVTo stack trace please raise a Bugzilla.

Regards

Ed Willink
Re: Using QVTo with Xtext [message #1786067 is a reply to message #1786046] Wed, 25 April 2018 07:07 Go to previous messageGo to next message
Daniel Strueber is currently offline Daniel StrueberFriend
Messages: 11
Registered: April 2014
Junior Member
Thanks, Rolf and Ed!

Saving the transformation result as .xmi was a good idea: When I do this, the transformation works. Since I get the stack trace only when I set the output file to have the .B file extension, the problem must come from the Xtext serialization.

The problem may indeed come from a mis-configuration, but unfortunately I don't find any choice in the "Run Configuration" dialog that would allow me to specify how the Xtext serialization should be used. I only changed three settings in the dialog: the paths to the transformation module, the IN file, and the OUT file.

For now, one workaround for my use-case would be to chain the transformation to XMI with some additional code that loads the XMI and persists it to the Xtext serialization. But I wonder if there's a less cumbersome way to do it.

[Updated on: Wed, 25 April 2018 07:17]

Report message to a moderator

Re: Using QVTo with Xtext [message #1786073 is a reply to message #1786067] Wed, 25 April 2018 08:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

For OCLinEcore and QVTd, I make extensive use of the Xtext serialization and my experience has been that it is a bit fragile but generally correct. (If I was using Xtext-generated metamodels the fragility might vanish). But as I understand it, you have code (Java/QVTo) that produces an Xtext AS that, if perfect, Xtext serialization will render as nicely formatted text. The problem is "if perfect". Any multiplicity error, e.g. a null name, or unset feature is an imperfection for which the serialization gives you a fairly gory diagnostic with considerable detail. It takes time to get your eye in on these diagnostics, but I think I pretty much always agreed with them in the end. On just one occasion the alternatives in my grammar were too complex and I had to adjust it slightly. Once you have fixed your code so that it produces a valid Xtext AS, you will probably find that QVTo no longer has a save problem. Please provide a repro of QVTo failing to save.

(https://bugs.eclipse.org/bugs/show_bug.cgi?id=463877 provides an example gory detail.)

Regards

Ed Willink
Re: Using QVTo with Xtext [message #1786081 is a reply to message #1786073] Wed, 25 April 2018 10:06 Go to previous messageGo to next message
Daniel Strueber is currently offline Daniel StrueberFriend
Messages: 11
Registered: April 2014
Junior Member
Thanks again! Ed, I think you're on the right track by pointing out that the serialization is a bit fragile. I now found out that I can get the "gory-detail" error messages by converting the generated XMI to the Xtext format using "Save as", as suggested by Rolf. And there it seems that the serialization struggles with finding an appropriate way for dealing with certain cross-references that I need in my B files. This is then more of a Xtext problem than a QVTo problem, so I will look further into that direction.

[Updated on: Wed, 25 April 2018 10:06]

Report message to a moderator

Re: Using QVTo with Xtext [message #1786083 is a reply to message #1786081] Wed, 25 April 2018 10:55 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

The gory-detail messages are a bit depressing, because nothing works till it all works. It is therefore worth building up construct by construct, so that you start with successes for Grammar, Grammar+MetamodelDeclaration, Grammar+MetamodelDeclaration+trivial Rule ... You then know that your latest expansion is the broken one.

(You still need the QVTo stack trace fix so that once you have it working you get sensible insight into your next more complicated problem.)

Regards

Ed Willink
Previous Topic:How to use an external class as a black-box library?
Next Topic:About Family2Person Transformation
Goto Forum:
  


Current Time: Fri Nov 16 13:28:10 GMT 2018

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

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

Back to the top