Reusing Materialized Views
q (A, E) :- r(A, B) & r(B, C) & s(C, D) & s(D, E)
Suppose all we have are results of previous queries:
v(F, G) :- r(F, H) & r(H, G) & s(G, I)
u(J, K) :- r(M, J) & s(J, N) & s(N, K)
Yes! q'(X, Y) :- v(X, Z) & u(Z, Y)
Let q” denote expansion of q’
q”(X, Y) :- r(X, H) & r(H, Y) & s(Y, I) &
r(M, Z) & s(Z, N) & s(N, Y)
Equivalence chain: q ? q” ? q’
I.e. prove q ? q’ ? q” ? q