%
% LargeJoinTest2.dlv
% 

#import (mor_10,"postgres","ps","SELECT * FROM c2", c2).
#import (mor_10,"postgres","ps","SELECT * FROM c3", c3).
#import (mor_10,"postgres","ps","SELECT * FROM c4", c4).
#import (mor_10,"postgres","ps","SELECT * FROM d1", d1).
#import (mor_10,"postgres","ps","SELECT * FROM d2", d2).
#import (mor_10,"postgres","ps","SELECT * FROM ex", ex).

a(X,Y) :- b1(X,Z), b2(Z,Y).
b1(X,Y) :- c1(X,Z), c2(Z,Y), not ex(Y).
b2(X,Y) :- c3(X,Z), c4(Z,Y), not ex(Y).
c1(X,Y) :- d1(X,Z), d2(Z,Y), not ex(X).

