eclipse-viatra / org.eclipse.viatra

Main components of the VIATRA framework
https://eclipse.dev/viatra
Eclipse Public License 2.0
0 stars 1 forks source link

Set dangling edge assumption to false #107

Open eclipse-viatra-bot opened 4 months ago

eclipse-viatra-bot commented 4 months ago

| --- | --- | | Bugzilla Link | 547015 | | Status | UNCONFIRMED | | Importance | P3 normal | | Reported | May 06, 2019 11:15 EDT | | Modified | May 20, 2019 15:29 EDT | | Version | 2.2.0 | | Reporter | Geza Kulcsar |

Description

During the development of a new transformation for the CPS Demonstrator, the following pattern was behaving strangely:

pattern cps2depTrace(cps2dep : CPSToDeployment, trace : CPS2DeploymentTrace, cpsElement : Identifiable, depElement : DeploymentElement) {\ CPSToDeployment.traces(cps2dep, trace);\ CPS2DeploymentTrace.cpsElements(trace, cpsElement);\ CPS2DeploymentTrace.deploymentElements(trace, depElement);\ }

In particular, after removing model element 'instance' of type 'HostInstance' from the containment tree, we've found that base index does not contain it anymore as expected; however, the Rete pattern matcher still returns it as part of a match, see the last line below:

assertTrue(EMFScope.extractUnderlyingEMFIndex(engine).getAllInstances(CyberPhysicalSystemPackage.Literals.HOST_INSTANCE).contains(instance))\ assertTrue(Cps2depTrace.Matcher.on(engine).hasMatch(null, null, instance, null))

host.instances -= instance //instances is a containment edge\ assertFalse(EMFScope.extractUnderlyingEMFIndex(engine).getAllInstances(CyberPhysicalSystemPackage.Literals.HOST_INSTANCE).contains(instance))\ assertFalse(Cps2depTrace.Matcher.on(engine).hasMatch(null, null, instance, null)) //this should be false, but the test failed here

We could not reproduce the bug outside of this transformation, but the transformation consistently behaves this way.

eclipse-viatra-bot commented 4 months ago

By Zoltan Ujhelyi on May 20, 2019 15:29

We had a discussion with Gábor Bergmann, and he correctly pointed out that the issue was caused by the fact that the dangling edge assumption is on by default.

I strictly remember that we wanted to change this default behavior for VIATRA 2.0, as it is quite surprising (as in the current case). However, changing this counts as an API break (and it also might have an effect on memory consumption), so we should postpone this until 3.0. In the meantime, I have reworded the issue description to consistently describe what we want to do in the future.