{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs345-9 - DatalogPrograms InverseRules DuschkasAlgorithm 1...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Using Views to Implement  Datalog Programs Inverse Rules Duschka’s Algorithm
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Inverting Rules Idea: “invert” the view definitions to give  the global predicates definitions in terms of  views and function symbols. Plug the globals’ definitions into the body  of the query to get a direct expansion of  the query into views. Even works when the query is a program.
Background image of page 2
3 Inverting Rules --- (2) But the query may have function  symbols in its solution, and these  symbols actually have no meaning. We therefore need to get rid of them. Trick comes from Huyn -> Qian ->  Duschka.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Skolem Functions Logical trick for getting rid of  existentially quantified variables. In terms of safe Datalog rules: For each local (nondistinguished) variable  X , pick a new function symbol  f   (the  Skolem constant ). Replace  X   by  f  (head variables).
Background image of page 4
5 Example v(X,Y) :- p(X,Z) & p(Z,Y) Replace Z  by f(X,Y) to get: v(X,Y) :- p(X,f(X,Y)) & p(f(X,Y),Y) Intuition: for v(X,Y) to be true, there must  be some value, depending on X and Y,  that makes the above body true.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 HQD Rule Inversion Replace a Skolemized view definition  by rules with: 1. A subgoal as the head, and 2. The view itself as the only subgoal of the  body.
Background image of page 6
7 Example v(X,Y) :- p(X,f(X,Y)) & p(f(X,Y),Y) becomes: p(X,f(X,Y)) :- v(X,Y) p(f(X,Y),Y) :- v(X,Y)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
8 Running Example: Maternal  Ancestors Global predicates: m(X,Y) = “ Y   is the mother of  X .” f(X,Y) = “ Y   is the father of  X .” manc rules: 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)
Background image of page 8
9 Example --- Continued The views: v1(X,Y) :- f(X,Z) & m(Z,Y) v2(X,Y) :- m(X,Y) Inverse rules: 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)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
10 Evaluating the Rules Treat views as EDB.
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}