CS345 Assignment #7

Due Wednesday, June 2, 1999

Class Project

Because of the holiday on 5/31, we have to make both the project and the last problem set due on the last day of class. Thus, you should hand in with HW7 a 2-3 page description of what you have done for your project. We'll leave the format flexible, but it is important that you explain:
  1. What problem you have attacked?

  2. What restrictions on input or what special cases you handle?

  3. What was the essential idea(s) of your project; that is, what have you done to improve running time for your special case, compared with the most straightforward algorithm for solving the general case?

  4. What is the running time of your algorithm; either a theoretical (big-oh) analysis, or some measurements of running time is OK.

We realize that some projects may not fit this mold, so other discussions that are more appropriate will also be acceptable. Check with Jeff or Edwina if you are concerned about what to write.

Problem Set

  1. (25 pts.) In class (end of slides on REFER) we saw some examples where we could eliminate subgoals of a CQ one-at-a-time. More precisely, we could find a sequence of containment mappings such that each mapping applied to the current CQ with k subgoals mapped it to a set of exactly k-1 of those subgoals.

    Is this phenomenon true in general? That is, can we always minimize by finding a sequence of containment mappings each of which eliminates exactly one of the subgoals? Either prove informally but clearly, or provide a counterexample.

    Is it always possible to find a sequence of reductions of a CQ that eliminates one subgoal at a time, leading to a minimal equivalent? More precisely, if
         H :- G1 & G2 & ... Gn

    is a CQ Q, and

         H :- G1 & G2 & ... Gk

    is a minimal equivalent formed from its own subgoals, can we order the subgoals Gk+1 through Gn so that each of the queries

         H :- G1 & G2 & ... Gi

    for k <= i <= n is equivalent to Q? Either prove informally but clearly, or provide a counterexample.

  2. (25 pts.) Consider the following rules:

    Draw the rule/goal graph for the query p^bbf, assuming that subgoals are handled in the order shown.

    Split predicates to get unique binding patterns, and give the rules for these new predicates.

    Rectify subgoals, and give the resulting rules.

  3. (25 pts.) Consider the rules:

    and the EDB facts: a(0,1), a(1,2), a(1,3), a(2,3), a(3,4), a(4,5), a(5,2), and a(5,6).

    Suppose we wish to compute the query p(0,X).

    Use seminaive evaluation on the original program to compute the query p(0,X), listing the facts derived at each step.

    Construct the rule/goal graph for the query.

    Rewrite the query using the basic magic sets algorithm, listing the rules in each of the five groups.

    Simplify the magic rules derived in part (c), using the procedure described in the notes.

    Use seminaive evaluation on the new program to compute p(0,X). How is this different from the evaluation done in part (a)?

  4. (25 pts.) Consider the following two sets of relations:

    ACH, BF, BG, CF, CI, EFG, and EGJ

    ABG, AGH, BFG, CDJ, CDI, DF, and EI

    Represent each schema as a hypergraph, and use GYO reduction to determine if the hypergraph is acyclic. If it is an acyclic hypergraph, give a full reducer for the set of relations.