Closed istvanrath closed 11 years ago
Use a union-find algorithm.
Two ways to check: one that relies on every kind of constraint; and one that only regards "positive" constraints (e.g. excluding neg/check).
Proposed warning messages:
I suggest minor refinements:
Two cases with incorrect warnings (at least according to me and @bergmanngabor):
Case 1: The pattern body contains constraints which are only loosely connected. This may negatively impact performance. The weakly dependent partitions are: [C ][_O ][_P ]
pattern emptyClass(C : Class) {
neg find hasOperation(C, _O);
neg find hasProperty(C, _P);
}
Case 2: The pattern body contains constraints which are only loosely connected. This may negatively impact performance. The weakly dependent partitions are: [P C ][No ][_<0> ]
pattern propertyNumberOfClassInPackage(P: Package, C : Class, No) {
Package.packagedElement(P, C);
No == count find hasProperty(C, _);
}
Both cases seems related to the incorrect handling of running variables.
As the issue is fixed already, it would make sense to include it in 0.6.6.
@ujhelyiz please check whether this works correctly.
I have seen failing a testcase (testGood8 from the cartesian tests) in my pc once more today. After restarting the eclipse the error was gone again. So I recommend that we should leave the bug open for a bit more. I'll try to make a testcase which fails or passes more deterministically.
2012/10/16 Istvan Rath notifications@github.com
@ujhelyiz https://github.com/ujhelyiz please check whether this works correctly.
— Reply to this email directly or view it on GitHubhttps://github.com/ujhelyiz/EMF-IncQuery/issues/294#issuecomment-9483890.
I just found the bug in the validator, commited in, seems to be working reliably. Some minor tweak needed to handle the unnamed variables in the union-find algorithm correctly. It was undeterministical, only come out when a set started with an unnamed variable. I set the bug to resolved now.
This issue is already merged and seems to be working without issues. Closing this ticket.
A nice usability improvement would be to warn the user if the cartesian product (isolated constraint) problem can be detected inside a pattern body.
E.g.