slides15 (1) - Schedule Today: Feb. 28 (TH) x x Datalog and...

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

View Full Document Right Arrow Icon
Winter 2002 Arthur Keller – CS 180 15–1 Schedule Today: 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. Mar. 12 (T) Semistructured Data, XML, XQuery. Read Sections 4.6-4.7. Assignment 8 due.
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 15–2 SQL Recursion WITH stuff that looks like Datalog rules an SQL query about EDB, IDB Rule = [RECURSIVE] R (<arguments>) AS SQL query
Background image of page 2
Winter 2002 Arthur Keller – CS 180 15–3 Example Find Sally’s cousins, using EDB Par(child, parent) . WITH Sib(x,y) AS SELECT p1.child, p2,child FROM Par p1, Par p2 WHERE p1.parent = p2.parent AND p1.child <> p2.child, RECURSIVE Cousin(x,y) AS Sib UNION (SELECT p1.child, p2.child FROM Par p1, Par p2, Cousin WHERE p1.parent = Cousin.x AND p2.parent = Cousin.y ) SELECT y FROM Cousin WHERE x = 'Sally';
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 15–4 Plan for Describing Legal SQL Recursion 1. Define “monotonicity,” a property that generalizes “stratification.” 2. Generalize stratum graph to apply to SQL queries instead of Datalog rules. (Non)monotonicity replaces NOT in subgoals. 3. Define semantically correct SQL recursions in terms of stratum graph. Monotonicity If relation P is a function of relation Q (and perhaps other things), we say P is monotone in Q if adding tuples to Q cannot cause any tuple of P to be deleted.
Background image of page 4
Winter 2002 Arthur Keller – CS 180 15–5 Monotonicity Example In addition to certain negations, an aggregation can cause nonmonotonicity. Sells(bar , beer , price) SELECT AVG(price) FROM Sells WHERE bar = 'Joe''s Bar'; Adding to Sells a tuple that gives a new beer Joe sells will usually change the average price of beer at Joe’s. Thus, the former result, which might be a single tuple like (2.78) becomes another single tuple like (2.81), and the old tuple is lost.
Background image of page 5

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 15–6 Generalizing Stratum Graph to SQL Node for each relation defined by a “rule.” Node for each subquery in the “body” of a rule. Arc
Background image of page 6
Image of page 7
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 / 20

slides15 (1) - Schedule Today: Feb. 28 (TH) x x Datalog and...

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

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