cs345-9

X thesearelikeedbasfarasthequery

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: m(X,Y) :- v2(X,Y) 9 Evaluating the Rules x Treat views as EDB. x Apply seminaïve evaluation to query (Datalog program). x In general, function symbols ­> no convergence. 10 Evaluating the Rules x But here, all function symbols are in the heads of global predicates. x These are like EDB as far as the query is concerned, so no nested function symbols occur. x One level of function symbols assures convergence. 11 Example r1: manc(X,Y) :- m(X,Y) 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) x Assume v1(a,b). 12 Example ­­­ (2) r1: manc(X,Y) :- m(X,Y) r2: manc(X,Y) :- f(X,Z) & manc(Z,Y) r3: manc(X,Y) :- m(X,Z) & manc(Z,Y) r4: f(a,g(a,b)) :- v1(a,b) r5: m(g(a,b),b) :- v1(a,b) r6: m(X,Y) :- v2(X,Y) x Assume v1(a,b). 13 Example ­­­ (3) r1: manc(g(a,b),b) :- m(g(a,b),b) r2: manc(X,Y) :- f(X,Z) & manc(Z,Y) r3: manc(X,Y) :- m(X,Z) & manc(Z,Y) r4: f(a,g(a,b)) :- v1(a,b) r5: m(g(X,Y),Y) :- v1(X,Y) r6: m(X,Y) :- v2(X,Y) x Assume v1(a,b). 14 Example ­­­ (4) r1: manc(X,Y) :- m(X,Y) r2: manc(a,b) :- f(a,g(a,b)) & manc(g(a,b),b) 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) x Assume v1(a,b). 15 Example ­­­ Concluded x Notice that given v1(a,b), we were able to infer manc(a,b), even though we never found out what the value of g(a,b) [the father of a ] is. 16 Rule­Rewriting x Duschka’s approach moves the function symbols out of the seminaïve evaluation and into a rule­rewriting step. x In effect, the function symbols combine with the predicates.  Possible only because there are never any nested function symbols. 17 Ne...
View Full Document

This document was uploaded on 01/06/2012.

Ask a homework question - tutors are online