Fi ST Scalable XML Document Filtering by Sequencing
Fi. ST: Scalable XML Document Filtering by Sequencing Twig Patterns Joonho Kwon, Praveen Rao, Bongki Moon, Sukho Lee School of Electrical Engineering Department of Computer Science, and Computer Science, Seoul University of Arizona National University VLDB 2005, Trondheim, Norway -1 -
Roadmap • Introduction § Background and Motivations • Index Structure § Profile Sequences § Sequence Index • Filtering Algorithm § Progressive Subsequence Matching § Refinement for Branch Node Verification • Experimental Results • Conclusions VLDB 2005, Trondheim, Norway -2 -
Introduction • Publish-subscribe systems § Selective dissemination of information (SDI) § User profiles (or standing queries) § New content is matched against the user profiles and is delivered to interested users • XML document filtering § User profiles (or twig patterns) are specified in the XPath language § Incoming XML document is delivered to users whose profiles have a match in the document § Reversal in the roles of twig patterns and XML documents • Challenges: § To minimize the filtering cost by effectively organizing a large number of user profiles § To achieve good scalability VLDB 2005, Trondheim, Norway -3 -
Introduction • XFilter (VLDB’ 00) and YFilter (TODS’ 03) § XFilter – each path expression is mapped to a FSM § YFilter – a single NFA for XPath expressions with shared processing • Motivations § To develop a scalable XML filtering system that supports processing of twig patterns § To support holistic matching of twig patterns without first matching the linear paths in the patterns and then merging these matches during post-processing § To inherently support ordered matching where the nodes in the twig pattern follow the document order in XML VLDB 2005, Trondheim, Norway -4 -
Tree to Sequence Transformation • Extended Prüfer Sequences (PRIX, ICDE’ 04) § Extend leaf nodes of the tree with dummy child nodes (A, 9) (C, 8) (B, 5) (B, 2) (D, 4) (C, 7) (d, 1) (d, 3) (d, 6) Tree T LPS(T): B B D B A VLDB 2005, Trondheim, Norway -5 - C C A
Sequence Representation XML Document User Profile A A C B B D E B D C G F Twig Pattern Tree T Q 1: /A[B//D]//E[G]/F LPS(T): B B D B A C C A LPS(Q 1): D B A G E F E A VLDB 2005, Trondheim, Norway -6 -
Fi. ST XML documents User profiles Filtering Algorithm Profile sequences Sequence Index VLDB 2005, Trondheim, Norway -7 -
Index Structure: Profile Sequence • Each twig pattern is mapped to a profile sequence § Profile sequence is an ordered list of nodes § Each node has four attributes Q 1: /A[B//D]//E[G]/F LPS(Q 1) = D B A G E F E A Label D B A G E F E A Qid 1 1 1 1 Pos 1 2 3 4 5 6 7 8 Sym // / $ / $// $# Ancestor-Descendant Parent-Child Branch VLDB 2005, Trondheim, Norway -8 - Branch + Ancestor-Descendant Branch + Root node
Index Structure: Sequence Index Dynamic hash based index Q 1: /A[B//D]//E[G]/F A D 1 B 1 // C Q 2: //B[E]/C D E Q 1, 1 2 E 1 / VLDB 2005, Trondheim, Norway -9 - Q 2, 1 Pointers to nodes in the profile sequences
Our Filtering Algorithm • Progressive Subsequence Matching § Property: If tree Q is a subtree of tree T, then LPS(Q) is a subsequence of LPS(T) • Praveen Rao and Bongki Moon. PRIX: Indexing and Querying XML using Prüfer sequences (ICDE’ 04) § Identify those profile sequences that have a matching subsequence in the document sequence § Necessary but not a sufficient condition • Refinement for Branch Node Verification § Progressive subsequence matching phase is followed by a refinement phase to discard false matches § The connectivity of the branch nodes in the candidates (twig patterns) is verified VLDB 2005, Trondheim, Norway -10 -
Progressive Subsequence Matching • The sequence representation of the document can be constructed as the document is parsed (e. g. , SAX parser) • The subsequence matching phase is progressive § The sequence representation of the document is generated incrementally and the profile sequences (of twig patterns) that are subsequences are identified in steps • Runtime global stack § The stack stores node labels from the current node of the document being processed to the root § Elements are pushed and popped from the stack in document traversal order § Stack size is upper bound by the depth of the document VLDB 2005, Trondheim, Norway -11 -
Incremental Generation of LPS A E D B B B E A Stack D E C G F F LPS(T): DB EBA CBA GE FE FEA VLDB 2005, Trondheim, Norway -12 - <A> push <B> push <D> push </D> leaf, o/p, pop, o/p <E> push </E> leaf, o/p, pop, o/p </B> non-leaf, pop, o/p </A> non-leaf, pop
Progressive Subsequence Matching • Sequence Index is used to simultaneously find the matching profiles by parsing the document only once • The Prüfer sequence label of the document is used as the hash key in the Sequence Index • Additional tasks are performed based on the Sym attribute value (e. g. , ‘/’, ‘//’, ‘$’) in profile sequence nodes to eliminate most false matches by using the runtime stack § The remaining false matches are eventually removed during the refinement phase VLDB 2005, Trondheim, Norway -13 -
Conceptual View • The matching process progresses by copying nodes in the profile sequences into the Sequence Index (denotes transitions in a state machine) Sequence Index A Q 1, 3 B Q 1, 2 C D Q 1, 1 Profile Sequence of Q 1 D B A G E F E A 1 1 1 1 1 2 3 4 5 6 7 8 // / $ / $// $# G Last node - match VLDB 2005, Trondheim, Norway -14 -
Progressive Subsequence Matching • Runtime stack contains a section of document LPS up to the nearest branch node XML document T A E D C B A stack B B C C D LPS(T): …. E D C B A … E VLDB 2005, Trondheim, Norway -15 -
Progressive Subsequence Matching • Benefits of the runtime stack § Testing relationships during subsequence matching based on the Sym attribute ‘/’ and ‘//’. Let q and q’ denote two consecutive nodes in the profile sequence • Test. PC(q, q’) - tests parent-child relationship (/) between q’ and q in the document • Test. AD(q, q’) - tests ancestor-descendant relationship (//) between q’ and q in the document § Avoiding frequent node copys to the Sequence Index § Limiting the range of subsequence matching VLDB 2005, Trondheim, Norway -16 -
Testing Relationships between Nodes XML document T A E D C B A B C Sym E C B F B 2 2 2 1 2 3 4 5 // / $# B C F E Test. AD Test. PC Sequence Index D Twig pattern Q 2 A stack E E Q 2, 1 F VLDB 2005, Trondheim, Norway -17 - Recursively test till the nearest branch node without a ‘/’ or ‘//’
Avoiding Frequent Node Copys XML document T Twig pattern Q 2 A E D C B A B B Sym C C E C B F B 2 2 2 1 2 3 4 5 // / $# B C E Not copied Sequence Index D A A stack E E Q 2, 1 F VLDB 2005, Trondheim, Norway -18 - E Q 2, 1 F Q 2, 4 F
Limiting the Range of Subsequence Matching Twig pattern Q 2 XML document T B A F C E D C B A B B E C D C C and E do not share an ancestor descendant relation stack E LPS(T): … E D C B A … C B … VLDB 2005, Trondheim, Norway -19 - E C B F B 2 2 2 1 2 3 4 5 // / $# LPS(Q 2): E C B F B
Refinement Phase • The connectedness property of branch nodes in the candidates (twig patterns) should be tested to identify true matches • To enable the refinement process § Branch node processing – branch nodes in the profile sequences during subsequence matching • The refinement phase § Root node processing - last node in the profile sequence § Uses the information collected during branch node processing VLDB 2005, Trondheim, Norway -20 -
Branch and Root Node Processing XML document T Twig pattern Q 3 //B[E]/C B (A, 1) C E B E (B, 2) (B, 5) (E, 7) A stack (D, 3) (E, 4) (C, 6) (G, 8) (F, 9) (F, 10) E B C B 3 3 1 2 3 4 / $# 2 LPS(T): D B E B A C B A G E F E A C 5 LPS(Q 3): E B C B Root node processing: The intersection of Branch. ID sets for each branch node in the candidate twig pattern is tested VLDB 2005, Trondheim, Norway -21 - Branch. ID sets store node ids
Fi. ST: Architecture Overview XPath Twig Patterns (User Profiles) XPath Parser XML Document SAX Parser Sequence Transformation Sequence Index + Profile Sequences Filtering Algorithm Filtering Engine VLDB 2005, Trondheim, Norway -22 - Send filtered document Users
Experimental Results • We measured the performance of Fi. ST and YFilter for a variety of XML document sizes and twig patterns. • Experimental setup § 2. 4 GHz Pentium IV with 512 MB RAM running Linux • Datasets § § Synthetic Treebank data using IBM’s XML data generator 1000 documents were generated using Treebank DTD Recursion of elements, maximum document depth was 36 Dataset sizes • • [1 KB, 10 KB) – 1 k [10 KB, 20 KB) – 10 k [20 KB, 30 KB) – 20 k [30 KB, 123 KB) – 30 k VLDB 2005, Trondheim, Norway -23 -
Experimental Results • User profiles (twig patterns) were generated using the XPath Generator in YFilter § § § Uniform – (z = 0) Skewed – (z = 0. 9) Maximum depth – 10 # of branches – 3 to 7 # of twig patterns – 50000 to 150000 • For each twig set and document set, we measured the average filtering cost per document § filtering time + document parsing time VLDB 2005, Trondheim, Norway -24 -
Experimental Results • We compared YFilter and Fi. ST by observing the trends in filtering cost for three different aspects of scalability size of input documents # of twig patterns # of branches VLDB 2005, Trondheim, Norway -25 -
Experimental Results • Fi. ST was implemented in C++ and YFilter was developed in Java • For fairness of comparison, we chose the following evaluation metric § scaleup = (observed – base) base • Wall clock time (document parsing + filtering) • We observed that Fi. ST scaled better than YFilter under various situations § Fi. ST’s filtering cost decreased with decrease in the number of matching user profiles § YFilter’s filtering cost increased as the size of the twig patterns increased VLDB 2005, Trondheim, Norway -26 -
Varying XML Document Sizes • We measured the scaleup for Fi. ST and YFilter • Fi. ST’s filtering cost grew slower than YFilter skewed uniform VLDB 2005, Trondheim, Norway -27 -
Varying Number of Branches • We measured the scaleup for Fi. ST and YFilter • Increase in the branch size reduced the number of matched profiles YFilter (uniform, 20 k) Fi. ST (uniform, 20 k) VLDB 2005, Trondheim, Norway -28 -
Varying Number of Twig Patterns • We measured the wall clock time for Fi. ST and YFilter • Fi. ST was significantly faster than YFilter for 20 k and 30 k uniform skewed VLDB 2005, Trondheim, Norway -29 -
Conclusions • We have developed an XML filtering system called Fi. ST that supports holistic matching of twig patterns § Avoids first matching the linear paths in the twigs and then merging the matches during post-processing § Transform twig patterns into profile sequences • Inherent support for ordered matching of twig patterns • Runtime stack § Stack size is upper bound by the depth of the document • Holistic matching yielded good scalability for our filtering system under various situations VLDB 2005, Trondheim, Norway -30 -
Questions? For more information, www. cs. arizona. edu/~bkmoon VLDB 2005, Trondheim, Norway -31 -
- Slides: 31