Bug 578265 - Serializing workspace blackboxes to executable XMI (*.qvtox)
Summary: Serializing workspace blackboxes to executable XMI (*.qvtox)
Status: NEW
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-18 14:42 EST by Christopher Gerking CLA
Modified: 2022-02-28 15:53 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Gerking CLA 2022-01-18 14:42:29 EST
If a transformation includes workspace blackboxes, serializing and reloading that transformation to/from *.qvtox fails with an IllegalArgumentException "imported module must be in a resource". The failure is due to a bad choice of the artificial URIs used by QVTo to reference blackbox units. These blackbox URIs have the following form:

qvto://blackbox/org.eclipse.m2m.qvt.oml.MyBlackboxUnit?jdt#MyJavaProject

What are they used for? To indicate that BlackboxResourceFactory must be used when resolving a blackbox unit referenced by a *.qvtox file. BlackboxResourceFactory registers a parser for the qvto:// protocol, which then delegates the creation and loading of units to the blackbox mechanism.

The problem is the use of the fragment to encode the Java project in which a blackbox unit resides. A fragment usually represents a specific model element inside a unit, not the unit itself. Thus fragments are trimmed during EMF's default XMI serialization, so that URIs are serialized incompletely in the following form:

qvto://blackbox/org.eclipse.m2m.qvt.oml.MyBlackboxUnit?jdt

Obviously the above URI lacks an indication of the project and thus can't be resolved to a blackbox unit. Adjusting the *.qvtox serialization to our needs is possible but relatively cumbersome. Instead, the form of the URIs should be changed so that the Java project is encoded by the query:

qvto://blackbox/org.eclipse.m2m.qvt.oml.MyBlackboxUnit?jdt=MyJavaProject

This way, the fragment no longer encodes the project, so the URIs are intact using the default XMI serialization.
Comment 1 Christopher Gerking CLA 2022-01-18 14:53:15 EST
One could say that *.qvtox does not play a role in daily business, but it's heavily used by QVTo's test infrastructure. Therefore, this bug blocks the reproduction or repair of several other blackbox-related bugs and should be fixed immediately.
Comment 2 Ed Willink CLA 2022-01-19 00:58:29 EST
Obviously the use of fragments is broken. Queries seem a little perverse. But since it's broken you have a clean slate.

You don't provide an example of the invocation.

If the XMI invocation is for a reference then to make the Sample Ecore Model Editor work there must be a registration of the qvto: scheme. For which //blackbox seems like bloat.

If the XMI invocation is of a String, then there is no problem for other XMI loaders and you may emulate the Pivot OCL's duality of name / quoted string identifier which allows an import to be encoded as a quoted-string name.

I suggest ensuring that a String is used and that when its value is something like 'java:my.project.MyJavaProject' it is a directive to use a Java blackbox. This is much shorter, avoids problems for other tools and provides a potential opening for other languages; even ada:.
Comment 3 Eclipse Genie CLA 2022-01-28 18:26:46 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190146
Comment 4 Eclipse Genie CLA 2022-01-28 18:26:48 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190147
Comment 5 Eclipse Genie CLA 2022-01-28 19:33:06 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190148
Comment 6 Eclipse Genie CLA 2022-02-04 14:32:50 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190474
Comment 7 Eclipse Genie CLA 2022-02-04 14:32:53 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190475
Comment 8 Eclipse Genie CLA 2022-02-04 14:32:55 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190476
Comment 9 Eclipse Genie CLA 2022-02-17 06:08:55 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190901
Comment 10 Eclipse Genie CLA 2022-02-17 06:08:57 EST
New Gerrit change created: https://git.eclipse.org/r/c/mmt/org.eclipse.qvto/+/190900