cs345-9

Notethecase mancgistaken careofbyr8 29 exampler2andr3

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ction­symbol pattern. 2. Replace EDB predicates (m and f in our example) by their definition in terms of views, but only if no function symbols are introduced. 26 Justification for (2) x A function symbol in a view is useless, since the source (stored) data has no tuples with function symbols. x A function symbol in an IDB predicate has already been taken care of by expanding the rules using all function­ symbol patterns we can construct. 27 New IDB Predicates x In our example, we only need manc1 to represent the pattern manc(g(.,.),.). x That is: manc1(X,Y,Z) = manc(g(X,Y),Z). 28 Example ­­­ r1 r1: manc(X,Y) :- m(X,Y) r5: m(g(X,Y),Y) :- v1(X,Y) r6: m(X,Y) :- v2(X,Y) Substitution OK; yields manc(X,Y) :- v2(X,Y) Illegal ­­­ yields g in head. Note the case manc(g(.,.),.) is taken care of by r8. 29 Example ­­­ r2 and r3 r2: manc(X,Y) :- f(X,Z) & manc(Z,Y) r3: manc(X,Y) :- m(X,Z) & manc(Z,Y) r4: f(X,g(X,Y)) :- v1(X,Y) r5: m(g(X,Y),Y) :- v1(X,Y) r6: m(X,Y) :- v2(X,Y) Illegal ­­­ put function symbol g in manc. OK; yields manc(X,Y) :- v2(X,Z) & manc(Z,Y) 30 Example ­­­ r4, r5, r6 x The inverse rules have played their role and do not appear in the final rules. 31 Example ­­­ r7 r7: manc(X,Y) :- f(X,g(B,C)) & manc(g(B,C),Y) r4: f(X,g(X,Y)) :- v1(X,Y) Unify. Note no function symbols are introduced, but X =B. Replace by manc1(B,C,Y). r7: manc(X,Y) :- v1(X,C) & manc1(X,C,Y) 32 Example ­­­ r8 and r9 r8: manc(g(A,B),Y) :- m(g(A,B),Y) r9:manc(g(A,B),Y) :- m(g(A,B...
View Full Document

This document was uploaded on 01/06/2012.

Ask a homework question - tutors are online