-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M2M transformation for Xtext Cps model #17
Comments
As discussed in https://www.eclipse.org/forums/index.php/t/1088118/ you cannot use VIATRA Query (and therefore incr.expl) reliably on a model edited directly in an Xtext editor. The most reliable approach would be to use a batch transformation that is either executed manually or triggered through some event (e.g. workspace resource change or Eclipse builder) and if you want to use VIATRA Queries, you must initialize the transformation at the beginning of each execution and dispose of the engine at the end of the execution. |
(1). For my understanding, I can use the "viatra batch transformation" or "BatchTransformationEiq" to operate m2m transformation with the xtext cps model , am I right? (2). If (1) is right, both the "viatra batch transformation" and "BatchTransformationEiq" use the traceability model, the cps model and deployment model will be added in the traceability model through the "load resouces" operation. When I edit the xtext cps file in the xtext editor, I must switch the xtext editor to the traceability editor to operate the m2m transformation. Can I have a way to operate the m2m transformation with the xtext cps model by "viatra batch transformation" or "BatchTransformationEiq" without switching editor? Can you give me some references? |
Yes.
You should load/create the traceability model and the deployment model root as part of the execution of the transformation. E.g.:
|
For "6. set the traceability model to CPS root reference", do you mean the operation of seting CPS and Deployment references of traceability model in the properties viewin in https://github.com/viatra/viatra-docs/blob/master/Viatra-batch-transformations.adoc? |
Yes, you should set these references from code. See the CPSModelBuilderUtil used by the tests for example. CyberPhysicalSystem cps = /* your model root */;
Deployment dep = DeploymentFactory.eINSTANCE.createDeployment();
CPSToDeployment c2d = TraceabilityFactory.eINSTANCE.createCPSToDeployment();
c2d.setCPS(cps);
c2d.setDeployment(dep); |
Thanks for your reply. Here are my main codes: // create deployment and traceability model are written as your comments above and add the related // save (1). In the above codes, I used the URI.createFileURI(traceFile) and URI.createFileURI(deploymentFile), it do operate the save operation, but no files generated upon linux operation. On windows operation system it works well, and I load the generated model files both the deployment model and traceability model are normal. (2). If I change the createFileURI() to createPlatformResourceURI(traceFile, true) and createPlatformResourceURI(deploymentFile, true), save operation will generate model files, but if I load the generated files, the deployment model is null, the traceability is normal. This happens both on linux operation system and windows operation system. If the model files are generated by createPlatformResourceURI(), why I can not load them? can you give me some explaination? |
In general, if you have different behaviour on Linux and Windows, you probably have some Windows specific detail in the code that prepares the URIs. |
Hi,
Good afternoon, sorry to disturb you.
I generate the xtext cps model file which can be edited in the xtext editor and I want to operate M2M transformation with it.
Can I use the "Explicit traceability (id = incr.expl)" of m2m transformation?
or I must use a batch transformation?
Do you have an example of it?
Thanks and hope for your reply.
The text was updated successfully, but these errors were encountered: