XML in Databases
Yoonjoon Lee (Li Yun Jun)
Korea Science and Technology Institute
Contents
• What is xml?
• XML Data VS Documents
• Store and Retrieve XML in RDB
• GML
What is xml?
- a Markup Language That You Can Use to create your OWN TAGS
- Created by w3c to overcome the limitations of html
- Based on SGML (Standard Generalized Markup Language - "Sounds Great, Maybe Later, Used In Publishing Industry
- Designed with the Web in Mind
ORIGINS OF XML
- in 1996, Jon Bosak Convinced That W3c To Let Him Form A Committee ON Using SGML ON The Web.
- November, The Committee Has Created The Beginning of A Simplified Form of SGML, this Was XML.
- In March 1997, Bosak Released a Paper "XML, Java and The Future of the Web."
- SGML WAS CREATED for General Document Structuring, HTML AS An Application SGML for Web Document, XML IS A Simplification of SGML for General Web USE.
A Sample XML Document
name>
address>
Tags, Elements and Attributes
DTD (1/2)
- Document Type Definition
- EXTENSIBLE IN XML, A DIALECT OF XML
• RDF, HL7 SGML / XML, Mathml, XML / EDI, FDX
- Describes What Tags The Markup Language Has, What Tags' Attribute May Be, and how the year becombined.
- Specifies Very Clearly What Information May or May Not Be include in Markup Language.
- DTD Syntax is Different from Ordinary XML Syntax.
DTD (2/2)
IS XML A DB?
• "Collection of Data"
• Advantages: Self-Describing, Portable, Data in Tree Or Graph Structure
• Disadvantages: Verbose, Slow Access
Storage, Schemas, Query Languages, Programming Interfaces, ...
- Efficient Storage, INDEXES, Security, Transactions and Data Integrity, Multi-User Access. Trigger Queries Across Multiple Documents, ...
Why db?
• Want To Expose Legacy Data
• Looking for a place to Store Web Pages
• Database Used by An E-Commerce Application In Which XML IS Used As a Data TRANSFER
• INTERESTED IN DATA or Documents
Data vs. Documents
• Used SIMPLY AS A DATA TRANSPORT BETWEEN THE DATABASE AND A Application?
• Integral USE AS IN THE CASE OF XHTML AND DOCBOOK DOCUMENTS?
Data-centric documents (1/2)
• for machine consumption
EX) Sales Orders, Flight Schedules, ...
• Fairly Regular Structure, Fine-grained Data and Little or No Mixed Content, No Significant Order In Sibling
Data-centric documents (2/2)
Flight>
Flight>
Flight>
Flights>
Document-centric documents (1/2)
• for Human Consumption
EX) Books, Email, Advertisement, ...
• Less Regular or Irregular Structure, Larger Graped Data, Lots of Mixed Contents, Almost Significant Order In Sibling
Document-centric documents (2/2)
The
Intro>
List>
Description>
Product>
Store & Retrieve XML
• File
• RDBMS
• Oodbms
• Special Purpose Systems for SEMI-STRUCTURE DATA
Storing XML Data In Rdbmss
RDBMS: a Matured Technology
RDBMS WIDELY AVAILABLE
Less Investment To Adopt The New Technology
Easy to Be Integrated with Other EXISTING APPLICATIONS
- Impedance mismatch
- Two Level Nature of Relational Schema (tuples and attributes) vs. arbitrary Nesting of XML DTD
- FLAT STRUCTURE VS. Recursion
- structure-based and content-based query
Storing XML Data In Rdbms: Architecture
Storing XML Data In Rdbms: Issues
• Schema / Data Mapping:
- Automate Storage of XML in rdbms
• query mapping:
- Provide XML Views of Relational Sources
• Result Construction:
- Export EXISTING DATA AS XMLXML-RELATIONAL MAPPING
• Model mapping
- Database Schemas represent constructs of the xml document model.
• DTD Independent
[Florescu & Kossmann 99, Yoshikawa, et. Al. Toit01]
• structure mapping
- Database Schemas Represent The Logical Strument of Target XML Documents
• DTD Dependent
[Shanmugasundaram et. Al. VDLB 99]
Model mapping: Edge, Xrel, And XParent
• Edge: a Single Large Table for Handing Any Structures.
• Xrel and XParent: Four Tables
- The structure handling:
• Xrel: The Structure IS Coded in The Data Using Region Codes (Start, End).
• XParent: The Structure IN A Separated "Parent" Table (PARENT-ID, Child-ID). (Can Be Extended To Support An Additional Table)
- Partitioning:
• Xrel: Partition Edge by Content (Element, Data, Attribute)
• XParent: Partition Edge by Content and "Structure VS NON-STRUCTURE)
- Label-path Handling: Explicitly As Data
Edge (1/3)
• Mapping Edges - Edge Approach
Edge (2/3)
Edge (3/3)
XREL (1/6)
XREL (2/6)
XREL (3/6)
XREL (4/6)
XREL (5/6)
XREL (6/6)
XParent (1/4)
XParent (2/4)
XParent (3/4)
XParent (4/4)
GML (1/2)
• GML (Geographic Markup Language) = GIS XML
• GML IS An XML-BASED LANGUAGE for Encoding Geographic Information in Order To Be Stored and Transport over The Internet, Developed by The OpenGIS Consortium
• GML Defines Both The Geometry and Properties of Objects That Comprise Geographic Information
GML (2/2)
• GML IS A Practical Application for Transferring Cartographic Information over the Web
• GML allows the data to be controlled on the browser end by the user who receives geometries and geographic features and customizes how the data is to be displayed, instead of transmitting a GIF or JPG map • Geographic data in GML can be sent to any device With an an XML Interface
References
• D. Florescu, D. Kossman, Storing and Querying XML Data Using An Rdbms. IEEE DATA ENGINEERING Bulletin 22 (3), 1999
• M. Yoshikawa et al.
• H. Jiang et al., Xparent: an effect rdbms-based XML Database System, In Proc. Of ICDE, 2002
• H. Jiang et al., Path Materialization Revisited: An Efficient Storage Model for XML Data, In Proc. Of aice, 2000
• About GML
- http://www.opengis.org
- http://www.isotc211.org
- http://www.w3c.org
- http://gml4j.sourceforge.net
- http://www.expway.net
- http://www.galdosinc.com
Thanks for your attntion!
Any Questions?