Conjunctive Queries
Conjunctive Queries
Conjunctive Queries
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
BCQ = HOM<br />
View query Q as a relational structure<br />
Universe: Variables of the query<br />
Relations: sets of query-atoms for<br />
each database relation.<br />
Non-Boolean CQs<br />
Q:r(x) r 1 (x 1 ) r 2 (x 2 )… r m (x m )<br />
The database D is itself a relational structure.<br />
By the definition of the semantics of FO queries, the<br />
Boolean conjunctive query evaluates to true iff there is a<br />
homomorphism h: QD.<br />
R1<br />
R1<br />
DatabaseD<br />
…..<br />
R1<br />
D=QiffHOM(Q,D)<br />
HowdoweformallydefineQ(D)<br />
Vive-versa, every HOM instance can be reformulated as a Boolean conjunctive query. 14<br />
Non-Boolean CQs<br />
head(Q)<br />
body(Q)<br />
r(x) r 1 (x 1 ) r 2 (x 2 )… r m (x m )<br />
h<br />
h homomorphismh h<br />
R1<br />
R1 ….. R1<br />
DatabaseD<br />
Problems Equivalent to BCQ<br />
• <strong>Conjunctive</strong> Query Containment<br />
Q<br />
( 1<br />
Q2<br />
db<br />
Q1 db)<br />
Q2<br />
( db)<br />
• Query of Tuple Problem<br />
t Q(db) <br />
• Constraint Satisfaction in AI<br />
CSP BCQ<br />
• Clause Subsumption in Theorem Proving<br />
Q(D)={h(head(Q))|h HOM(body(Q),D)}<br />
<br />
s.t.<br />
C<br />
D<br />
<br />
15