cs345-3

cs345-3 - 1 Conjunctive Queries Containment Mappings...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 1 Conjunctive Queries Containment Mappings Canonical Databases Sariaya’s Algorithm 2 Conjunctive Queries ¡ A CQ is a single Datalog rule, with all subgoals assumed to be EDB. ¡ Meaning of a CQ is the mapping from databases (the EDB) to the relation produced for the head predicate by applying that rule to the EDB. 3 Containment of CQ’s ¡ Q1 ⊆ Q2 iff for all databases D, Q1(D) ⊆ Q2(D). ¡ Example: ¢ Q1: p(X,Y) :-arc(X,Z) & arc(Z,Y) ¢ Q2: p(X,Y) :-arc(X,Z) & arc(W,Y) ¡ DB is a graph; Q1 produces paths of length 2, Q2 produces pairs of nodes with an arc out and in, respectively. 4 Example --- Continued ¡ Whenever there is a path from X to Y, it must be that X has an arc out, and Y an arc in. ¡ Thus, every fact (tuple) produced by Q1 is also produced by Q2. ¡ That is, Q1 ⊆ Q2. 5 Why Care About CQ Containment? ¡ Important optimization: if we can break a query into terms that are CQ’s, we can eliminate those terms contained in another. ¢ Especially important when we deal with integration of information: CQ containment is almost the only way to tell what information from sources we don’t need. 6 Why Care? --- Continued ¡ Containment tests imply equivalence-of-programs tests. ¢ Any theory of program (query) design or optimization requires us to know when programs are equivalent. ¢ CQ’s, and some generalizations to be discussed, are the most powerful class of programs for which equivalence is known to be decidable. 7 Why Care --- Concluded ¡ Although CQ theory first appeared at a database conference, the AI community has taken CQ’s to heart. ¡ CQ’s, or similar logics like description logic, are used in a number of AI applications. ¢ Again --- their design theory is really containment and equivalence. 8 Testing Containment ¡ Two approaches: 1. Containment mappings. 2. Canonical databases. ¡ Really the same in the simple CQ case covered so far. ¡ Containment is NP-complete, but CQ’s tend to be small so here is one case where intractability doesn’t hurt you. 9 Containment Mappings ¡ A mapping from the variables of CQ Q2 to the variables of CQ Q1, such that: 1. The head of Q2 is mapped to the head of Q1....
View Full Document

This document was uploaded on 01/06/2012.

Page1 / 37

cs345-3 - 1 Conjunctive Queries Containment Mappings...

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

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