1 / 36

針對XML資料之結構化合併的查詢處理與研究 Query Processing for Structural Join against XML Data

針對XML資料之結構化合併的查詢處理與研究 Query Processing for Structural Join against XML Data. 國立台灣海洋大學資訊科學系 指導教授:張雅惠 教授 研 究 生:謝璨隆. 大綱. 動機 問題描述 資料結構與索引 查詢處理 實驗數據 結論與未來工作. 動機. XML 一種樹狀結構的文字資料模型 可自定標籤來描述自身的資料內容 目的 索引內容與結構,以期能加速查詢處理 支援 W3C 所提出的 XPath 以及 XQuery 查詢句. 問題描述. XML 文件 文字檔案 樹狀結構

john-mckee
Download Presentation

針對XML資料之結構化合併的查詢處理與研究 Query Processing for Structural Join against XML Data

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 針對XML資料之結構化合併的查詢處理與研究Query Processing for Structural Join against XML Data 國立台灣海洋大學資訊科學系 指導教授:張雅惠 教授 研 究 生:謝璨隆 DBLAB @ NTOU

  2. 大綱 • 動機 • 問題描述 • 資料結構與索引 • 查詢處理 • 實驗數據 • 結論與未來工作 DBLAB @ NTOU

  3. 動機 • XML • 一種樹狀結構的文字資料模型 • 可自定標籤來描述自身的資料內容 • 目的 • 索引內容與結構,以期能加速查詢處理 • 支援W3C所提出的XPath以及XQuery查詢句 DBLAB @ NTOU

  4. 問題描述 • XML文件 • 文字檔案 • 樹狀結構 • DTD (Document Type Definition) • DTD Tree DBLAB @ NTOU

  5. 範例XML文件 <OIP> <Volume>27</volume> <Number>4</Number> <Section> <SectionName>join</SectionName> <Article> <Title>Twig Joins</Title> <Author>Bruno</Author> <Author>Koudas</Author> <Keyword>twig</Keyword> </Article> <Article> <Title>Structural Joins</Title> <Author>Chien</Author> <Keyword>Numbering Scheme</Keyword> </Article> </Section> <Section> <SectionName>encode</SectionName> <Article> <Title>Storing and Querying</Title> <Author>Viglas</Author> <Keyword>Dewey</Keyword> </Article> </Section> </OIP> Article對Section來說是可重複

  6. 範例XML文件樹狀結構 OIP Section Section Volume Number 4 SectionName 27 Article encode SectionName Article Article Title Author Keyword join Title Author Keyword Viglas Title Author Author Keyword Chien Dewey Bruno Structural Joins Storing and Querying Koudas Twig Joins twig Numbering Scheme DBLAB @ NTOU

  7. 問題描述(cont.)DTD Tree DTD Mapping Table OIP Section* Volume Number Article* SectionName Title Author* Keyword* /OIP/Section/Article/Title 其XPath編碼路徑為1.-3.-2.1 DBLAB @ NTOU

  8. 問題描述 (cont.)XPath查詢句 OIP • XPath • 找出會議名稱是join的所有文章標題 Section* /OIP/Section[SectionName = ‘join’]/Article/Title SectionName Article* join 篩選元素 Title <Title>Twig Joins</Title> <Title>Structural Joins</Title> 投射元素 DBLAB @ NTOU

  9. 範例XML文件 <Section> <SectionName>join</SectionName> <Article> <Title>Twig Joins</Title> <Author>Bruno</Author> <Author>Koudas</Author> <Keyword>twig</Keyword> </Article> <Article> <Title>Structural Joins</Title> <Author>Chien</Author> <Keyword>Numbering Scheme</Keyword> </Article> </Section>

  10. 問題描述 (cont.)XQuery查詢句 • XQuery • 找出會議名稱是join的所有文章標題與作者配對 OIP Section* For $s in input()/OIP/Section, $a in $s/Article Let $sn = $s/SectionName Where $sn/text() = 'join' Return <Title-Author-Pair> $a/Title $a/Author </Title-Author-Pair> SectionName Article* join Title Author 篩選元素 投射元素 DBLAB @ NTOU

  11. 問題描述 (cont.) <Title-Author-Pair> <Title>Twig Joins</Title> <Author>Bruno</Author> </Title-Author-Pair> <Title-Author-Pair> <Title>Twig Joins</Title> <Author>Koudas</Author> </Title-Author-Pair> <Title-Author-Pair> <Title>Structural Joins</Title> <Author>Chien</Author> </Title-Author-Pair> <Article> <Title>Twig Joins</Title> <Author>Bruno</Author> <Author>Koudas</Author> </Article> <Article> <Title>Structural Joins</Title> <Author>Chien</Author> </Article> DBLAB @ NTOU

  12. 問題描述 (cont.) • XML查詢句 • 元素值的限定 • 元素間的樹狀關係(結構化合併) • 找出內容與結構上符合的節點元素,將會是XML資料庫查詢處理的核心。 • 目標:從多份XML文件中,找出符合XPath限制的元素,或是建構出符合XQuery中查詢句的XML文件。對於聚集或巢狀限制的XQuery,則不在本論文的處理範圍內。 DBLAB @ NTOU

  13. 問題描述 (cont.)結構化合併 Article* Title Author* Article Article Article Title Author Title Author Title Author Author Chien Viglas Bruno Structural Joins Koudas Twig Joins Storing and Querying DBLAB @ NTOU

  14. 問題描述 (cont.)結構化合併 (cont.) • 結構化合併 • 找出DTD Tree中的第一個共同可重複祖先元素 • 判斷在XML文件中這兩個元素是否在同一個可重複元素之下 • 在同一個可重複元素之下則結構化合併成功,否則失敗 DBLAB @ NTOU

  15. 資料結構與索引 • XML文件 • 給予元素唯一的編碼數字,稱做元素編碼(Element ID),簡稱Eid • 以Element Tuple來表示元素間的父子關係 • 以父元素的Eid來辨識 • Element Tuple紀錄子元素的Eid以及父元素的Sibling Eid DBLAB @ NTOU

  16. 0 14 3 1 2 16 15 10 4 5 17 18 19 6 7 8 9 12 13 11 OIP Section Volume Number Section 4 27 SectionName Article SectionName Article Article encode join Title Author Keyword Title Author Author Keyword Title Author Keyword Viglas Bruno twig Dewey Koudas Chien Twig Joins Storing and Querying Structural Joins Numbering Scheme

  17. Tid | 內容 0 | [1, 2, 3, (-1)] 3 | [4, 5, (14)] 5 | [6, 7, 9, (10)] 7 | [(8)] 8 | [(-1)] 9 | [(-1)] 10 | [11, 12, 13, (-1)] 12 | [(-1)] 13 | [(-1)] 14 | [15, 16, (-1)] 16 | [17, 18, 19, (-1)] 18 | [(-1)] 19 | [(-1)] 0 3(Section) 1 2 14(Section) 15 4 5(Article) 10(Article) 16 6 9 17 18 19 11 12 13 8 (Author) 7(Author)

  18. Element Tuple Index • Element Tuple Index • 紀錄XML文件內的結構關係 • 查詢特定元素的Element Tuple • GetTuple(DocID, Tid) • GetTuple(0, 3) = [4, 5, (14)] Tid | 內容 0 | [1, 2, 3, (-1)] 3 | [4, 5, (14)] 5 | [6, 7, 9, (10)] 7 | [(8)] 8 | [(-1)] 9 | [(-1)] 10 | [11, 12, 13, (-1)] 12 | [(-1)] 13 | [(-1)] 14 | [15, 16, (-1)] 16 | [17, 18, 19, (-1)] 18 | [(-1)] 19 | [(-1)] DBLAB @ NTOU

  19. Multiple Element Index • Multiple Element Index • 第一個可重複祖先元素的Eid(不包括自己) • 結構化合併的依據 • GetME(DocID, Eid) • GetME(0, 4) = 3 • GetME(0, 8) = 5 0 14 3 1 2 15 4 5 10 16 17 18 19 6 7 8 9 11 12 13 DBLAB @ NTOU

  20. Pos Index • Pos Index • 建立Eid在XML文件內的開始與結束位置 • 快速取得Eid的內容以及其下的所有子元素 • PI(DocId, Eid) • PI(0, 1) = [9, 27],則從XML文件中,抓取區間9到27,便是Eid為1的元素內容 • <Volume>27</volume> DBLAB @ NTOU

  21. Document Index • 建立XML文件內,值與元素編碼Eid的對應 • DocIndex(ElementName, Keyword) • DocIndex(SectionName, ‘join’) = {4} 3(Section) 4(SectionName) join DBLAB @ NTOU

  22. 查詢處理 • XML查詢句 • 值的限定:利用Document Index找出符合篩選元素的Eid集合 • 樹狀關係:結構化合併的對象為可重複元素 Result XML Doc Query Pos index Retrieval DTD Mapping Table Decomposition Element Tuple Index Projection RetrFromDocIndex Multiple Element Index Document Index METBuild DBLAB @ NTOU

  23. 查詢處理 (cont.) • Supra Gluing Element (SGE) OIP /OIP/Section/Article/Title = 1.-3.-2.1 /OIP/Section/Section = 1.-3.1 共同SGE為/OIP/Section/ = 1.-3 SGE Section* Article* SectionName Title DBLAB @ NTOU

  24. XPath ExampleDecomposition 篩選路徑 1.-3.1 投射路徑 1.-3.-2.1 OIP OIP OIP Section*  Section* SGE Section* SectionName Article* SectionName Article* Title join join Title 投射元素 篩選元素 DBLAB @ NTOU

  25. XPath Example cont.RetrFromDocIndex & METBuild 篩選路徑 Step 2 OIP Step 3 SGE GetME(0, 4) = 3 3 Section* SectionName 4 Step 1 join DocIndex(SectionName, ‘join’) DBLAB @ NTOU

  26. XPath Example cont.Projection 14(Section) 3(Section) 4(SectionName) 15(SectionName) Init 投射路徑 join encode SGE:/OIP/Section = 1.-3 投射元素:/OIP/Section/Article/Title = 1.-3.-2.1 MapPtr = -2, 1 OIP SGE 3 Section* Step 1 5 GetTuple(0, 3) = [4, 5, (14)] Article* Step 2 Title GetTuple(0, 5) = [6, 7, 9, (10)] GetTuple(0, 10) = [11, 12, 13, (-1)] 6, 11 DBLAB @ NTOU

  27. XPath Example cont.Retrieval XMLDocs title 6, 11 PI(0, 6) = [129, 153] PI(0, 11) = [297, 327] <Title>Twig Joins</Title> <Title>Structural Joins</Title> DBLAB @ NTOU

  28. XQuery ExampleDecomposition 投射路徑 篩選路徑 OIP OIP OIP OIP SGE Section*  Section* Section* Section* Article* Article* SectionName SectionName Article* Title Author join Title Author join 投射元素 篩選元素 DBLAB @ NTOU

  29. XQuery Example cont.RetrFromDocIndex & METBuild 篩選路徑 Step 2 OIP Step 3 SGE GetME(0, 4) = 3 3 Section* SectionName 4 Step 1 join DocIndex(SectionName, ‘join’) DBLAB @ NTOU

  30. XQuery Example cont.Projection Section = 1.-3 Article = 1.-3.-2 Title = 1.-3.-2.1 Author = 1.-3.-2.-2 投射 3 3 5 OIP 3 10 3 3 | [4, 5, (14)] 5 | [6, 7, 9, (10)] 7 | [(8)] 8 | [(-1)] 10 | [11, 12, 13, (-1)] 12 | [(-1)] 14 | [15, 16, (-1)] Section* 3 5 6 3 10 11 Article* 3 5 6 7 Title Author 3 5 6 8 3 10 11 12 DBLAB @ NTOU

  31. XQuery Example cont.Retrieval XMLDocs PI(0, 6) = [129, 153] PI(0, 8) = [164, 185] PI(0, 9) = [196, 218] PI(0, 11) = [297, 327] PI(0, 12) = [338, 359] 3 5 6 8 3 5 6 9 3 10 11 12 <Title>Twig Joins</Title> <Author>Bruno</Author> <Author>Koudas</Author> <Title>Structural Joins</Title> <Author>Chien</Author> DBLAB @ NTOU

  32. 實驗數據不同 DTD Tree DTD Tree中越多的父子關係產生越多的Element Tuple DBLAB @ NTOU

  33. 實驗數據 (cont.)SGE 隨著距離越來越遠,所花費的時間也隨之增加 DBLAB @ NTOU

  34. 結論與未來工作 • 結論 • 以Element Tuple來表示XML文件 • 專注在可重複元素做結構化合併有助於XML查詢處理 • 未來工作 • 降低XML文件所產生的Element Tuple個數 • 可以處理路徑表示法中的//(子孫) • 能處理聚集與巢狀XQuery DBLAB @ NTOU

  35. Related Work • Shu-Yao Chien, Zografoula Vagena, Donghui Zhang, Vassilis J. Tsotras, Carlo Zaniolo, "Efficient Structural Joins on Indexed XML Documents", In Proceedings of the 28th VLDB Conference, Hong Kong, China, 2002 • 來源資料都去做結構化合併,耗費時間並沒有過濾,常使得儲存空間或是記憶體的限制而無法完成結構化合併。 • 利用Numbering Scheme將XML文件內的元素建立編碼並索引,可快速取得元素並透過Sibling Pointer與編碼來略過元素。 DBLAB @ NTOU

  36. Related Work continue • Nicolas Bruno, Nick Koudas, Divesh Srivastava, "Holistic Twig Joins: Optimal XML Pattern Matching", In Proceedings of ACM SIGMOD, Madison,Wisconsin, USA, 2002. • 利用Numbering Scheme編碼XML文件 • 使用串列與堆疊來存放結構化合併後的結果 • 利用編碼上節點間關係的限制,略過節點,並使用XB-tree來加速結構化合併。 • Parent:[8,20], Child_1:[9, 12], Child_2:[29, 36] DBLAB @ NTOU

More Related