30.08.2014 Views

url - Universität zu Lübeck

url - Universität zu Lübeck

url - Universität zu Lübeck

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

134 CHAPTER 7. THE XML INDEX UPDATE PROBLEM<br />

like<br />

p 3 = /a[b];<br />

p 4 = /a[NOT(b)].<br />

Expression p 3 selects all a nodes that have a b child while p 4 selects a nodes that<br />

have no b child. Although both expressions select a nodes they are mutually exclusive.<br />

This implies that p 3 and p 4 can never share one same node.<br />

Theorem 3 The XPath Intersection Problem for the fragment XIP NOT is NP-complete. <br />

PROOF First, we show that XIP NOT is NP-hard, i.e. every NP-complete problem can<br />

be reduced on XIP NOT in polynomial time. We show the NP-hardness by reducing<br />

3-SATISFIABILITY (3SAT) [3, 21]. It was proven in 1971, by Cook, that 3SAT is<br />

NP-complete.<br />

Definition 31 3SAT is defined as follows: Given a Boolean formula F = F 1 ∧...∧F k ,<br />

F j = z j,1 ∨ z j,2 ∨ z j,3 and the literals z i,j ∈ {x 1 , x 1 , x 2 , x 2 , ..., x r , x r , }.<br />

Question: Is there an assignment of true/false values to the r variables x 1 , ..., x r<br />

so that F can be satisfied?<br />

<br />

F is in 3-conjunctive normal form (3-CNF) because each clause has exactly three<br />

distinct literals. The basic idea of the reduction is to create two formulas F A and<br />

F B that are always satisfiable independently. By the construction of F A and F B<br />

we guarantee that they are only satisfiable simultaneously if and only if F is satisfiable.<br />

Having the two formulas we create two expressions p, p ′ ∈ XP {[],∗,//,NOT }<br />

that have an intersection if and only if F is satisfiable. The reduction is done in<br />

polynomial time. We build F A and F B as follows:<br />

1) We take r new variables a 1 , a 2 , ...a r . F A is structured like F with the difference<br />

that all negated x i s are replaced by a corresponding negated a i variable.<br />

Formally, this means that F A = ˜F 1 ∧ ... ∧ ˜F k with ˜F j = z j,1 ˜ ∨ z˜<br />

j,2 ∨ z˜<br />

j,3 and<br />

z˜<br />

i,j =<br />

{<br />

x l if z i,j = x l or<br />

a l if z i,j = x l<br />

This way, F A is trivially satisfiable by assigning true to all remaining (non-negated)<br />

x-variables and false to all (negated) a-variables.<br />

2) The second formula F B is created as follows:<br />

(<br />

) (<br />

)<br />

F B = (x 1 ∧ a 1 ) ∨ (x 1 ∧ a 1 ) ∧ ... ∧ (x r ∧ a r ) ∨ (x r ∧ a r )<br />

F B is satisfiable if and only if every x i = a i independent of whether they are both<br />

true or both false.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!