Presentation is loading. Please wait.

Presentation is loading. Please wait.

Approximate XML Joins Huang-Chun Yu Li Xu. Introduction XML is widely used to integrate data from different sources. Perform join operation for XML documents:

Similar presentations


Presentation on theme: "Approximate XML Joins Huang-Chun Yu Li Xu. Introduction XML is widely used to integrate data from different sources. Perform join operation for XML documents:"— Presentation transcript:

1 Approximate XML Joins Huang-Chun Yu Li Xu

2 Introduction XML is widely used to integrate data from different sources. Perform join operation for XML documents: –Two documents may convey approximately or exactly the same information but may be different on structure. –Even when two documents have the same DTD, the structures may be different due to optional elements or attributes.

3 Introduction Example: paper conferencetitleauthors VLDBXML for the masses author AliceBob paper conferencetitleauthors VLDBXML for the masses author Alice publication typetitle conferenceXML for the masses name AliceRobVLDB author We need approximately matching of XML documents!

4 Introduction We also need a distance metric to quantify the differences between XML documents. Tree edit distance is used in this paper for its generality and simplicity when quantifying the distance between trees. Other distance metrics can be used as well.

5 Tree Edit Distance Tree edit distance: the minimum number of tree edit operations (node insertion, deletion, label substitution) required to transform one tree to another. Given two trees T 1 and T 2, there is a well known algorithm to compute the tree edit distance in O(|T 1 | |T 2 | h(T 1 ) h(T 2 )).

6 Tree Edit Distance Find a mapping M between T 1 and T 2 such that the editing cost is minimized. The mapping consists pairs of integers (i, j) such that: –1≤ i ≤ |T 1 | and 1≤ j ≤ |T 2 | –For any (i 1, j 1 ), (i 2, j 2 ) in M i 1 = i 2 iff j 1 = j 2 t 1 [i 1 ] is to the left of t 1 [i 2 ] iff t 2 [j 1 ] is to the left of t 2 [j 2 ] (sibling order preserving) t 1 [i 1 ] is an ancestor of t 1 [i 2 ] iff t 2 [j 1 ] is an ancestor of t 2 [j 2 ] (ancestor order preserving)

7 Tree Edit Distance Example: tree edit distance is 3 (delete B, insert H, relabel C to I) A BC DEFG A DH EI FG T1:T1: T2:T2: BH

8 Problem Definition Given two XML data source S 1 and S 2, and a distance threshold τ. TDist(d 1, d 2 ): a function that assesses the tree edit distance between two documents d 1 S 1 and d 2 S 2. Approximate join: return all pairs of documents (d 1, d 2 ) S 1 S 2 such that TDist(d 1, d 2 ) ≤ τ.

9 Challenges Evaluation of TDist function between two documents is a very expensive operation. (worst case: O(n 4 ), for trees of size O(n) ) Traditional techniques in join algorithms (sort merge, hash join, etc) cannot be used.

10 Lower Bounds Let T be an ordered labeled tree. Let pre(T) denote the preorder traversal of T and post(T) denote the postorder traversal of T. Let T 1, T 2 be ordered labeled trees. max{ed(pre(T 1 ), pre(T 2 )), ed(post(T 1 ), post(T 2 )} ≤ TDist(T 1, T 2 ) This can be computed in O(n 2 ) time.

11 Upper Bounds Additional constraint is imposed on the original TDist algorithm. The search space is reduced and a faster algorithm is proposed. For any triple (t 1 [i 1 ], t 2 [j 1 ]), (t 1 [i 2 ], t 2 [j 2 ]), (t 1 [i 3 ], t 2 [j 3 ]) M, let lca( ) be the lowest common ancestor function. –t 1 [lca(t 1 [i 1 ], t 1 [i 2 ])] is a proper ancestor of t 1 [i 3 ] iff t 2 [lca(t 2 [j 1 ], t 2 [j 2 ])] is a proper ancestor of t 2 [j 3 ] Two distinct subtrees of T 1 will be mapped to two distinct subtrees of T 2. It can be calculated in O(|T 1 ||T 2 |) time.

12 Upper Bounds Example: the upper bound is 5 (delete B, delete E, insert H, insert E, relabel C to I ) A BC DEFG A DH EI FG T1:T1: T2:T2:

13 Upper Bounds Algorithm for Upper Bound:

14 Outline Reference set Choosing reference set Approximate join algorithms

15 Outline Reference set Choosing reference set Approximate join algorithms

16 Reference Set S 1, S 2 : two sets of XML documents Reference set K S 1 ∪ S 2 – a chosen set of XML documents v i : a vector for document d i S 1 ∪ S 2 –dimensionality = |K| –v it = TDist(d i, k t ), k t K, 1 ≤ t ≤ |K|

17 Reference Set | v i t - v j t | ≤ TDist(d i, d j ) ≤ v i t + v j t, 1 ≤ t ≤ |K| –Essentially the above procedure “projects” documents d i, d j onto the reference set K τ : distance threshold u ij = min t,1 ≤ t ≤ |k| v i t + v j t –u ij ≤ τ : the pair is certainly within distance τ l ij = max t,1 ≤ t ≤ |k| |v i t – v j t | – l ij > τ : the pair can’t be within distance τ

18 Outline Reference set Choosing reference set Approximate join algorithms

19 Choosing Reference Set S = S 1 ∪ S 2 S is well separated, if –S can be divided into k clusters s.t. Documents within a cluster have small distance (say less than τ/2) Documents in different clusters have large distance (say larger than 3τ/2)

20 Choosing Reference Set S is well separated –choose a single point from each of the k ( the size of the reference set ) largest clusters to be in the reference set –If k is not known f i : the fraction of points in the first i clusters Choose k ≥ i ≥ 2, such that

21 Choosing Reference Set choose d C 1 in the reference set K –(d i C 1, d j C 1 ) should be in the output TDist(d i, d j ) ≤ TDist(d i, d) + TDist(d j, d) ≤ τ/2 + τ/2 = τ –C 1 containing n 1 documents Saving n 1 *(n 1 - 1)/2 evaluations of TDist() – (d i C 1, d j C 2 ) should not be in the output TDist(d i, d j ) ≥ |TDist(d i, d) - TDist(d j, d)| > 3τ/2 - τ/2 = τ –Saving n 1 *(|S| - n 1 ) evaluations of TDist()

22 Algorithm 1.do{ 1.1 randomly pick a point d from the data set S 1.2 put all the points within τ/2 distance with d in one cluster } until (all documents in S belong to some cluster ) 2. choose the k largest clusters 3. pick a random point from each cluster to be in the reference set K

23 Outline Reference set Choosing reference set Approximate join algorithms

24 Bounds Algorithm Naïve algorithm –Nested loop join + TDist algorithm Bounds algorithm for each d i S 1 { for each d j S 2 { if (UBDist(d i, d j ) ≤ τ ) output (d i, d j ); if (LBDist(d i, d j ) ≤ τ ) if (TDist(d i, d j ) ≤ τ ) output(d i, d j ); }

25 Pruning with a Reference Set for each pair (d i S 1, d j S 2 ) –u ij = min t,1 ≤ t ≤ |k| v i t + v j t –l ij = max t,1 ≤ t ≤ |k| |v i t – v j t | u ij ≤ τ : the pair belongs to the output l ij > τ : the pair can be pruned away l ij ≤ τ < u ij : apply TDist(d i, d j ) to identify the distance between d i and d j refer to this algorithm as RS (ReferenceSets) Drawback –need to perform (| S 1 | + |S 2 |) * |K| invocations of TDist() to compute vectors

26 Applying Both Optimizations if RS algorithm indicates that TDist() should be invoked between a pair –can be possibly avoid by applying the computational cheaper LBDist() and UBDist() refer to this algorithm as RSB (RSBounds)

27 RSC Algorithm potentially more evaluation of TDist() –because of the construction of vectors two vectors for document d i S 1 ∪ S 2 –vector v l i : v l it = LBDist(d i, k t ), k t K, 1 ≤ t ≤ |K| –vector v u i : v u it = UBDist(d i, k t ), k t K, 1 ≤ t ≤ |K| | v l i t - v u j t | ≤ TDist(d i, d j ) ≤ v u i t + v u j t, 1 ≤ t ≤ |K| u ij = min t,1 ≤ t ≤ |k| v u i t + v u j t l ij = max t,1 ≤ t ≤ |k| |v l i t – v u j t | Refer to this algorithm as RSCombined(RSC) Drawback: double the size of vectors

28 Performance Evaluation Run time vs. number of nodes

29 Performance Evaluation Run time vs. distance threshold (XMark) Run time vs. distance threshold (DBLP)

30 Performance Evaluation Run time vs. distance threshold (XMark) Number of TDist calculation vs. distance threshold (XMark)

31 Conclusion & Future Work The algorithms are not scalable for huge data sets. The performance of these algorithms has a strong correlation with the data itself. The performance of the reference set depends on the clustering algorithm chosen. Try to incorporate other distance matrices into the algorithms. Try to explore the various indexing schemes which can be used in the algorithms.

32 References S. Guda, H. V. Jagadish, N. Koudas, D. Srivastava, and T. Yu, Approximate XML Joins, Proceedings of ACM SIGMID, 2002. K. Zhang and D. Shasha, Tree Pattern Matching, Oxford University Press, 1997. S. Guha, R. Rastogi, and K. Shim, CURE: An Efficient Clustering Algorithm for Large Databases, Proceedings of ACM SIGMOD, 1998. T. Zhang, R. Ramakrishnan, and M. Livny, BIRCH: An Efficient Data Clustering Method for Very Large Databases, Proceedings of ACM SIGMOD, 1996.


Download ppt "Approximate XML Joins Huang-Chun Yu Li Xu. Introduction XML is widely used to integrate data from different sources. Perform join operation for XML documents:"

Similar presentations


Ads by Google