Download XML Algebra: Understanding the Concepts, Operations, and Optimization and more Slides Database Management Systems (DBMS) in PDF only on Docsity!
Introduction to XML Algebra
Data Model
- data model ~ core data structures and data types supported by DBMS
- relational database is a table (set-oriented) data model
- XML format is a tree-structured hierarchical model
NIAGARA
- Title : Following the paths of XML Data: An algebraic framework for XML query evaluation
By : Leonidas Galanis, Efstratios Viglas, David J. DeWitt, Jeffrey. F. Naughton, and David Maier.
Univ. of Wisconsin
Outline
- Concepts of Niagara Algebra
- Operations
- Optimization
Example: XML Source Documents
Customer.xml <Customer_Document> 1 Tom 2 George </Customer _Document>
8
Invoice.xml <Invoice_Document> <account_number>2 </account_number> AT&T $0.25 <account_number>1 </account_number> Sprint $1.20 <account_number>1 </account_number> AT&T $0.75 </Invoice_Document>
XML Data Model and Tree Graph
Example:
9
Invoice_Document Invoice Invoice …
numbercarrier (^) total number carrier total (^2) AT&T $0.25 (^1) Sprint $1.
<Invoice_Document> < invoice> 2 Sprint $0.25 1 < carrier>Sprint $1.20 </Invoice_Document>
Ordered Tree Graph, Semi structured Data
XML Data Model [GVDNM01]
- Collection of bags of vertices.
- Vertices in a bag have no order.
- Example:
11
Root invoice.xml invoice invoice.account_number Invoice-element-content^
< account_number > element-content </ account_number >
[ Root “invoice.xml ” , invoice, invoice. account_number ]
Data Model
- Bag elements are reachable by path expressions.
- Path expression consists of two parts:
- An entry point
- A relative forward part
- Example: account_number:invoice
Operators
- Source S , Follow φ, Expose ε, Vertex ν,
- Source S , Select σ, Join , Rename ρ, Group γ, Union ∪, Intersection ∩, Difference - , Cartesian Product ×.
Source Operator S
- Input : a list of documents
- Output :a collection of singleton bags
- Examples :
S () All known XML documents S (invoice.xml) All XML documents whose filename match “invoice.xml S (,schema.dtd) All known XML documents that conform to schema.dtd
Follow operator (Example*)
17
Root invoice.xml invoice Invoice-element-content^
Root invoice.xml invoice invoice.carrier
Invoice-element-content^ carrier -element-content^
φ(carrier:invoice)
*Unnesting Follow
{[Root invoice.xml , invoice]}
{[Root invoice.xml , invoice, invoice.carrier]}
Docsity.com
Select operator σ
- Input : a set of bags
- Functionality : filters the bags of a collection using a predicate
- Output : a set of bags that conform to the predicate
- Predicate : Logical operator (¬,∧,∨), or simple qualifications (=,≠,>,<,≤,≥)
Join operator
- Input: two collections of bags
- Functionality: Joins the two collections based on a predicate
- Output: the concatenation of pairs of pages that satisfy the predicate
Join operator (Example)
21
Root invoice.xml invoice Invoice-element-content^
Root customer.xml customer customer-element-content^
account_number: invoice =number:customer
Root invoice.xml invoice Root customer.xml customer Invoice-element-content^ customer-element-content^
{[Root invoice.xml , invoice]} {[Root customer.xml , customer]}
{[Root invoice.xml , invoice, Root customer.xml , customer]}