






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of xml-relational mapping, a technique used to process xml data in relational databases. Various approaches to xml processing, including text files, specialized xml dbms, object-oriented dbms, and relational dbms. It also discusses mapping xml to relational databases using node/edge-based and interval-based schema, and the advantages and disadvantages of each approach. The document also touches upon xquery and its evaluation in relational databases.
Typology: Slides
1 / 10
This page cannot be seen from the preview
Don't miss anything!







2
3
Simple, compact Full-text indexing can help (often provided by DBMS vendors as object-relational “extensions”)
Schema-oblivious mapping: well-formed XML → generic relational schema
5
Attribute order does not matter
pos specifies the ordering of children child references either Element ( eid ) or Text ( tid )
tid cannot be the same as any eid
6
eid tag e0 bibliography e1 book e2 title e3 author e4 author e5 author e6 publisher e7 year
eid pos child e0 1 e e1 1 e e1 2 e e1 3 e e1 4 e e1 5 e e1 6 e e2 1 t e3 1 t e4 1 t e5 1 t e6 1 t e7 1 t
eid attrName attrValue e1 ISBN ISBN- e1 price 80
tid value t0 Foundations of Databases t1 Abiteboul t2 Hull t3 Vianu t4 Addison Wesley t5 1995
left is the start position of the element right is the end position of the element level is the nesting depth of the element (strictly speaking, unnecessary) Key is left
11
1
book
title author author author publisher year
1,999,
2,21,
3,5,3 6,8,3 9,11,3 12,14,3 15,17,3 18,20,
12
SELECT e2.left FROM Element e1, Element e WHERE e1.tag = ‘section’ AND e2.tag = ‘title’ AND e1.left < e2.left AND e2.right < e1.right AND e1.level = e2.level-1;
SELECT e2.left FROM Element e1, Element e WHERE e1.tag = ‘book’ AND e2.tag = ‘section’ AND e1.left < e2.left AND e2.right < e1.right;
An environment E maps each query variable v to its value: a forest of XML trees (a node-set) fv
Table I : increasing sequence of integers, one per environment For each query variable v , create a table Tv ( s (tring) , l (eft) , r (ight) ) representing the value of v in all environments
14
15
pathid left right … 1 1 999 … 2 2 21 … 3 3 5 … 4 6 8 … 4 9 11 … 4 12 14 … … … … …
pathid path 1 /bibliography 2 /bibliography/book 3 /bibliography/book/title 4 /bibliography/book/author … …
20
Perform string matching on Path Join qualified pathid ’s with Element
Evaluate //book Evaluate //book/title Evaluate //book/publisher[text()=‘Prentice Hall’] Join to ensure title and publisher belong to the same book
21
bibliography
book
title author author author publisher year
1
1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.
23
Tag name → table name Attributes → columns
book ( ISBN , price , title_id , …) title ( id , PCDATA_id ) PCDATA ( id , value )
24
book ( ISBN , price , title_id , author_id , publisher_id , year_id )? )BCNF?
book ( ISBN , price , title_id , publisher_id , year_id ) book_author ( ISBN , author_id ) )BCNF decomposition in action! )A further optimization: merge book_author into author
book_author ( ISBN , author_pos , author_id )
29
Each tuple returned by SQL gets converted to an element
Tuples can be returned by SQL in sorted order; adjacent tuples are grouped into an element
E.g., books with multiple authors and multiple references
30
Flexible and adaptable; no DTD needed Queries are easy to formulate
Less flexible and adaptable Need to know DTD to design the relational schema Query formulation requires knowing DTD and schema Queries are more efficient XQuery is tougher to formulate because of result restructuring