slides14 - Schedule Today: Feb. 26 (T) x x Datalog. Read...

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

View Full Document Right Arrow Icon
Winter 2002 Arthur Keller – CS 180 14–1 Schedule Today: Feb. 26 (T) Datalog. Read Sections 10.1-10.2. Assignment 6 due. Feb. 28 (TH) Datalog and SQL Recursion, ODL. Read Sections 10.3-10.4, 4.1-4.4. Project Part 6 due. Mar. 5 (T) More ODL, OQL. Read Sections 9.1. Assignment 7 due. Mar. 7 (TH) More OQL. Read Sections 9.2-9.3.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Winter 2002 Arthur Keller – CS 180 14–2 Logical Query Languages Motivation: 1. Logical rules extend more naturally to recursive queries than does relational algebra. Used in SQL recursion. 2. Logical rules form the basis for many information-integration systems and applications.
Background image of page 2
Winter 2002 Arthur Keller – CS 180 14–3 Datalog Example Likes(drinker , beer ) Sells(bar , beer , price) Frequents(drinker , bar ) Happy(d) <- Frequents(d,bar) AND Likes(d,beer) AND Sells(bar,beer,p) Above is a rule . Left side = head . Right side = body = AND of subgoals . Head and subgoals are atoms . Atom = predicate and arguments. Predicate = relation name or arithmetic predicate, e.g . <. Arguments are variables or constants. Subgoals (not head) may optionally be negated by NOT .
Background image of page 3

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

View Full DocumentRight Arrow Icon
Winter 2002 Arthur Keller – CS 180 14–4 Meaning of Rules Head is true of its arguments if there exist values for local variables (those in body, not in head) that make all of the subgoals true. If no negation or arithmetic comparisons, just natural join the subgoals and project onto the head variables. Example Above rule equivalent to Happy(d) = π drinker (Frequents Likes Sells)
Background image of page 4
Arthur Keller – CS 180 14–5 Evaluation of Rules Two, dual, approaches: 1. Variable-based : Consider all possible assignments of values to variables. If all subgoals are true, add the head to the result relation. 2. Tuple-based : Consider all assignments of tuples to subgoals that make each subgoal true. If the variables are assigned consistent values, add the head to the result. Example: Variable-Based Assignment
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/21/2011 for the course CS CS 180 taught by Professor Dr.arthur during the Fall '01 term at The University of Akron.

Page1 / 22

slides14 - Schedule Today: Feb. 26 (T) x x Datalog. Read...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online