Relational Encodings

 

Storing XML in relational databases

 

biblio (entry, position, paraID) /* entry is a sequence of paragraphs */
para (paraID, position, type, text, refID) /* each position has a text or a ref (indicated by type) */
ref (refID, position, type, text, citeID) /* same for refs */
cite (citeID, type, author, title, edition, date)

 

doc (docID, position, nodeID)

elements (nodeID, type, namespace, ...)

attributes (nodeID, attr, value)

children (nodeID, position, childNodeID)

 

 

 node (type, start, end, level)

 “Publishing” relations as XML

Simultaneous use of SQL and XQuery

Waterloo’s Text ADT extensions to SQL

 

 

<biblio>

 {

  for $r in doc(“eb-bib.xml”)//cite

  where $r/author

  return

    <citation>{$r}</citation>

 }

 </biblio>

 

Assume a table

documents (URI, content)

 

project( select(documents, URI=“eb-bib.xml”) , content) -> R1(content)

extract( R1, content, “//cite#/author#”) -> R2(content,cite,author)

project( select(R2, not null(author)), cite) -> R3(cite)

elem-constr( R3, {cite},{}, citation ) -> R4(cite,citation)

project( sort( R4, {cite}), citation) ->R5(citation) /* assumes doc-order */

agg-constr( group(R5,{}), biblio)

Mixed SQL/XQuery processing in SilkRoute 2

Occursi(TupleIDi, Path, Data, Position)

References and related reading

Querying XML, Chapters 8, 15, B.4, C.3

Shanmugasundaram99

Shanmugasundaram01

Tatarinov02

Ng97

DeHaan03

Brown98

 Zhang04

Zhang03

Kadiyska04