Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358814 - non-deterministic behaviour of transformation
Summary: non-deterministic behaviour of transformation
Status: NEW
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-25 06:13 EDT by Philipp Kalb CLA
Modified: 2016-12-27 12:18 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 Philipp Kalb CLA 2011-09-25 06:13:46 EDT
Build Identifier: 20110615-0604

To put it in a nutshell: My transformation works if I debug it but it does not if I run it (with the same configuration and nothing in parallel).

The basic idea of the transformation-script is to transform two models(UML metamodel) into a common one (UML metamodel). I developed the script using the QVT editor and used it as shown in the "javaInvoke" example that I found in the m2m newsgroup. It actually works fine but the problem is that sometimes my transformed objects "forget" their classifiers.
So I changed the script and tried to run it via the "QVTEditor Eclipse plugin(s)". When I run it with "Run As..." I have classifiers in every 2 - 5 run, If I debug it they are always there.

I even added an "if" in the end of the transformation to check if the classifiers are null but the "if" is never true. When I run the transformation in a while loop that checks if the results are ok and if not run everything again, I get the right results after 2-5 runs. Its very random and time consuming..

So the problem appears when invoking it with java and when using the provided editor. 

This problem was described in the m2m newsgroup with title "[QVT] undeterministic behaviour". A similar problem was reported in the same newsgroup with the title "Invoke QVT In JAVA"


Reproducible: Sometimes

Steps to Reproduce:
1. create a transformation
2. write a simple application that invokes the script similar to the javaInvoke example. Such as:
/******************************************************************************/
//transformationURI link to qvt file
TransformationExecutor executor = new TransformationExecutor(transformationURI);

//inResource have the vaule of inModel
ModelExtent input = new BasicModelExtent(inResource.getContents());
ModelExtent output = new BasicModelExtent();

ExecutionContextImpl context = new ExecutionContextImpl();

ExecutionDiagnostic diagnostic = executor.execute(context, input, output);

/******************************************************************************/
3. run in several times in a loop
Comment 1 Ed Willink CLA 2015-11-11 01:30:48 EST
There is no repro for this, but a likely scenario is that anything that involves a Set has a non-deterministic order.

In principle this is just tough, but it is a nuisance.

An incremental execution requires an input model comparison and an update execution requires a model output comparison. If these comparisons are based on stable hashes, the hashes could be re-used to define a stable execution order for currently indeterminate activities.

Perhaps needs an execution option
- indeterminate order
- determinate order
- reversed determinate order
- random determinate order subject to a given random number key

Much of this functionality can be shared by QVTd and may need to originate in OCL.
Comment 2 Ed Willink CLA 2016-12-27 12:18:29 EST
(In reply to Ed Willink from comment #1)
> Much of this functionality can be shared by QVTd and may need to originate
> in OCL.

(Pivot) OCL Bug 509726 suggests that indeterminacy is not in accord with the OCL specification and outlines an approach whereby Pivot OCL will become determinate.