viatra / EMF-IncQuery

This repository is only kept for historic reasons. All development happens on eclipse.org
http://eclipse.org/viatra
13 stars 4 forks source link

Validator for "cartesian product" (isolated constraint) problems #294

Closed istvanrath closed 11 years ago

istvanrath commented 11 years ago

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.

pattern MyBadPattern(X,Y) {
  Type1(X);
  Type2(Y);
}
ujhelyiz commented 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).

okrosa commented 11 years ago

Proposed warning messages:

istvanrath commented 11 years ago

I suggest minor refinements:

ujhelyiz commented 11 years ago

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.

ujhelyiz commented 11 years ago

As the issue is fixed already, it would make sense to include it in 0.6.6.

istvanrath commented 11 years ago

@ujhelyiz please check whether this works correctly.

okrosa commented 11 years ago

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.

okrosa commented 11 years ago

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.

ujhelyiz commented 11 years ago

This issue is already merged and seems to be working without issues. Closing this ticket.