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.

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

7.6.1 Update Algorithm<br />

The first step of the algorithm checks if an index affection has happened or not<br />

and calls the corresponding sub-routines. The intersection is analyzed for p and<br />

all path expressions that define the established indexes. If the operations is an<br />

insert or delete, the keys, qualifiers and the return value of each index must be<br />

checked because these two operations change the structure and the content of<br />

the XML data. A change operation changes only the content, therefore only the<br />

keys have to be checked whether an existing value has been modified. The pseudo<br />

code in listing 7.8 shows the first step:<br />

1 f o r a l l i in indexes{ //check a l l indexes<br />

2 K = i . getKeyPaths ( ) ; //extract the path expressions<br />

3 Q = i . getQualiferPaths ( ) ; //that define an index<br />

4 v = i . getReturnPath ( ) ;<br />

6 i f ( type==insert | | type == delete ) {<br />

8 i f ( type == insert )<br />

9 execute o on XML data ; // modify the XML data<br />

11 f o r a l l key in K{ //check a l l keys<br />

12 i f intersection ( key , p ) !=ø<br />

13 maintain ( type , i , p , ” keyAff ” ) ;<br />

14 }<br />

15 f o r a l l qual in Q{ //check a l l q u a l i f i e r s<br />

16 i f intersection ( qual , p ) !=ø<br />

17 maintain ( type , i , p , ” qualAff ” ) ;<br />

18 }<br />

19 i f intersection ( v , p ) !=ø //check the return value<br />

20 maintain ( type , i , p, ” r e t A f f ” ) ;<br />

22 i f ( type==delete )<br />

23 execute o on XML data ; // modify the XML data<br />

24 }<br />

26 else i f type==change ) {<br />

27 f o r a l l key in K{ //check a l l keys<br />

28 i f intersection ( key , p ) !=ø<br />

29 maintain ( type , i , p , , ” keyAff ” ) ;<br />

30 }<br />

31 execute o on XML data ; // modify the XML data<br />

32 }<br />

33 }<br />

Figure 7.8: Pseudocode of the update algorithm<br />

Besides maintaining the indexes the modifying database operation must be performed<br />

on the underlying XML data as well. If o is a delete or a change this<br />

operation is performed after maintaining the indexes because we need access to<br />

the information that is going to be deleted/changed. For an insert o is performed<br />

before maintaining the indexes because we need the context of the new node.

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

Saved successfully!

Ooh no, something went wrong!