Presentation is loading. Please wait.

Presentation is loading. Please wait.

TREECHOP: A Tree- based Query-able Compressor for XML Gregory Leighton, Tomasz Müldner, James Diamond Acadia University June 6, 2005.

Similar presentations


Presentation on theme: "TREECHOP: A Tree- based Query-able Compressor for XML Gregory Leighton, Tomasz Müldner, James Diamond Acadia University June 6, 2005."— Presentation transcript:

1 TREECHOP: A Tree- based Query-able Compressor for XML Gregory Leighton, Tomasz Müldner, James Diamond Acadia University June 6, 2005

2 Outline XML TREECHOP  Compression Strategy  Decompression Strategy  Querying Strategy Experimental Results Conclusions

3 Extensible Markup Language (XML) What is it?  A standard for semi-structured data representation introduced in 1998  Data is surrounded by markup tokens (elements and attributes) used to indicate semantic meaning Characteristics?  Verbose (often 5 – 10 times larger than alternative formats like CSV)  Lots of repetition… plenty of opportunities for data compression

4 Example XML Document root element attribute data value comment

5 TREECHOP: Compression Strategy Parsing splits document into three segments:  Prologue: stores text occurring before document’s root element  Document Tree: contains all document contents between and including root element start and end tags  Epilogue: stores text occurring after document’s root element

6 Example XML Document Prologue Epilogue Document Tree

7 Document Tree Root node corresponds to document’s root element Character data segments are represented using leaf nodes XML markup represented using non-leaf nodes; 5 types of non-leaf nodes:  Element, attribute, CDATA, comment, processing instruction

8 Document Tree Generation Get next token from XML parser Construct tree node from token Write tree node to compression stream 12 3

9 Document Tree Nodes Each node in the tree has an associated label value, L  Element node  name of the element  Attribute node  + name of the attribute  Comment, CDATA, processing instruction nodes  all text between delimiting section markers The path for a node v n consists of /L 1 /L 2 …/L n where a route connecting the root node v 1 with v n consists of nodes v 1, v 2, …, v n and L i is the label for node v i

10 Codeword Generation A binary codeword is assigned to each non-leaf node, based on node path  Multiple nodes with identical path are assigned same codeword Codeword is used during decompression and querying operations to identify the value and type of each node

11 Codeword Generation The codeword C(v) assigned to a non-leaf node v with parent node p is formed by the concatenation of three codes  C(p): the codeword assigned to p  G(v): Golomb code assigned to v based on its ordering relative to p.  T(v): a sequence of 3 bits used to indicate node type

12 Example XML Document

13 Example Document Tree

14 Node PathC(v)C(v) /PurchaseOrder /PurchaseOrder/Date /PurchaseOrder/CustomerID /PurchaseOrder/Order /PurchaseOrder/Order/Item /PurchaseOrder/Order/Item/ProductNo /PurchaseOrder/Order/Item/Quantity Codeword Assignment C(p) – portion inherited from parent node G(v) – portion assigned based on Golomb code T(v) – portion used to indicate node type

15 TREECHOP: Writing the Tree Encoded tree is written to compression stream in depth-first order; gzip is applied to further compress the encoded tree Non-leaf nodes: written as 3-tuple (L, C, D)  L is a byte indicating bit length of code word  C is a sequence of  L / 8  bytes containing code word  D is the node’s label (e.g. element/attribute name) - reserved byte values are used to signal beginning/end of sequence of raw character data

16 TREECHOP: Writing the Tree On second and subsequent occurrences of a particular codeword, only the 2-tuple (L, C) is written (decoder is able to infer associated D) Leaf nodes are transmitted in same manner as D value for non-leaf nodes Each node encoding is transmitted immediately after node construction – avoids necessity of building entire tree in memory

17 TREECHOP: Decompression Strategy Decoder operates by reading node data from compression stream. For each non-leaf node: 1. Determine D value 2. Determine node type 3. Surround D with XML syntax appropriate to the node type and immediately emit to the decompression stream

18 TREECHOP: Querying Strategy An individual query handler is registered with the decoder for each query Single scan of compression stream is carried out, using a stack to keep track of current path When query predicate path is matched, the current codeword is recorded and remainder of compression stream is scanned for future occurrences Each time a query match is encountered, the associated D value is extracted from the compression stream and passed to the query handler for processing

19 Experimental Results: Compression Rates FileSize(KB)ElementsAttributesData (A) Baseball (B) Macbeth (C) 150emp (D) emp

20 Experimental Results: Compression/Decompression Speed Distance between sender/receiver: 20 km / 12 miles

21 Experimental Results: Querying Distance between sender/receiver: 20 km / 12 miles

22 Conclusions TREECHOP compresses at rates comparable to gzip, while also providing query-friendly annotations to the compression stream Using TREECHOP querying in place of alternative methods like XSLT yields a significant performance advantage on medium- to large-sized XML documents; advantage increases with document size


Download ppt "TREECHOP: A Tree- based Query-able Compressor for XML Gregory Leighton, Tomasz Müldner, James Diamond Acadia University June 6, 2005."

Similar presentations


Ads by Google