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

Cartesian product validator ignores check conditions #367

Closed ujhelyiz closed 11 years ago

ujhelyiz commented 11 years ago

The cartesian product validator does not connect variables used in check expressions. E.g. in the moreFriendsThan pattern from the school demo it reports that the two students are in different partition.

    pattern moreFriendsThan(S1 : Student, S2 : Student) {
        N == count find inTheCircleOfFriends(S1, _Sx1);
        M == count find inTheCircleOfFriends(S2, _Sx2);
        check(N > M);
    }

As a solution, the variable set of the check expression (a method in CorePatternLanguageHelper returns these variables) might be considered connected.

I'm not sure whether this issue needs to be fixed, but I believe it is - but it is enough to do it for 0.7 (in other words, we should not delay 0.6.9 for this).

istvanrath commented 11 years ago

As per @bergmanngabor 's recommendations detailed on http://viatra.inf.mit.bme.hu/performance#Optimizing_queries_and_transformations , I'm not convinced that connecting variables inside check() expressions should be considered good practice in general. In special cases, such as the example above, the warning (as currently generated by the validator) might be confusing/misleading though.

okrosa commented 11 years ago

It works like this by design. Actually the validator does connect them in a loose way, hence the error message (The pattern body contains constraints which are only loosely connected.).

istvanrath commented 11 years ago

Closing - WONTFIX.