xml/relational mapping gregory schroeder april 28, 2015

10
XML/Relational Mapping Gregory Schroeder April 28, 2015

Upload: adam-curtis

Post on 31-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

XML/Relational Mapping

Gregory Schroeder

April 28, 2015

XML/Relational Mapping

2

• eXtensible Markup Language (XML)

– Text-based format that allows for the structuring of electronic document and is not limited to a set of labels1

– Used to describe and share data over networks, including the Internet

– Defined by:• Document Type Definition (DTD)• XML Schema

Image courtesy en.wikipedia.org

XML/Relational Mapping

3

• Relational Database– A collection of data items organized as

a set of formally-described tables from which data can be accessed or reassembled in many different ways without having to reorganize the database tables2

– Commonly used by businesses to store information

Image courtesy of www.svgopen.org

XML/Relational Mapping

4

● Table-based mapping models XML documents as tables in the relational database● Simple to follow and easy to understand.● Limited to XML data that follows a certain structure:3

<Tables> <Table_1> <Row> <Column_1>. . .</Column_1> . . . <Column_n>. . .</Column_n> </Row> . . . </Table_1> . . . <Table_n> <Row> <Column_1>. . .</Column_1> . . . <Column_n>. . .</Column_n> </Row> . . . </Table_n></Tables>

XML/Relational Mapping

5

●Object-relational mapping works with XML data that does not follow the limited structure required by table-based mapping● Follows a two-step process:3

●1) XML is mapped to an object schema●2) Object schema is mapped to a relational model

XML/Relational Mapping

6

● XML:

<SalesOrder> <Number>1234</Number> <Customer>Gallagher Industries</Customer> <Date>29.10.00</Date> <Item Number=“1”> <Part>A-10</Part> <Quantity>12</Quantity> <Price>10.95</Price> </Item> <Item Number=“2”> <Part>B-43</Part> <Quantity>600</Quantity> <Price>3.99</Price> </Item> </SalesOrder>

XML/Relational Mapping

7

● Object schema: object SalesOrder { number = 1234; customer = “Gallagher Industries”; date = 29.10.00; items = {ptrs to Item objects}; } object Item { number = 1; part = “A-10”; quantity = 12; price – 10.95; } object Item { number = 2; part = “B-43”; quantity = 600; price = 3.95; }

XML/Relational Mapping

8

● Relational model:SaleOrders----------Number Customer Date------ -------------------- ---------1234 Gallagher Industries 29.10.00... ... ...... ... ...

Items-----SONumber Item Part Quanity Price-------- ---- ---- ------- -----1234 1 A-10 12 10.951234 2 B-43 600 3.99... ... ... ... ...

XML/Relational Mapping

9

●Steps to map DTD to relational schema:4

1. Simplify DTD

2. Map complex elements

3. Map content of complex elements1. Single reference of simple element

2. Repeated reference of simple element

3. Reference to a complex element

4. Map attributes1. Single-valued attributes

2. Multi-valued attributes

XML/Relational Mapping

10

● References:● 1Rouse, Margaret. "What Is XML (Extensible Markup Language)? - Definition from

WhatIs.com." SearchSOA. December 1, 2014. Accessed April 28, 2015. http://searchsoa.techtarget.com/definition/XML.

● 2Rouse, Margaret. "What Is Relational Database? - Definition from WhatIs.com." SearchSQLServer. April 1, 2006. Accessed April 28, 2015. http://searchsqlserver.techtarget.com/definition/relational-database.

● 3Bourret, Ronald. "Ronald Bourret." Rpbourret.com. September 1, 2005. Accessed April 28, 2015. http://www.rpbourret.com/xml/DTDToDatabase.htm.

● 4Madiraju, Praveen. "DTD to Schema." Lecture, Advanced Database Systems from Marquette University, February 24, 2015.

● Dongwon Lee, Murali Mani, Wesley W. Chu "Effective Schema Conversions between XML and Relational Models" In European Conf. on Artificial Intelligence (ECAI), Knowledge Transformation Workshop (ECAI-OT), Lyon, France, July 2002 (Invited)

● Florescu, Daniela, and Donald Kossmann. "Storing and Querying XML Data Using and RDBMS." Bulletin of the IEEE Computer Society Technical Committee on Data Engineering, 1999. Accessed April 28, 2015. http://courses.cs.washington.edu/courses/cse544/02sp/papers/florescu99.ps.

● A.A. Abdel-aziz, H. Oakasha, "Mapping XML DTDs to relational schemas", AICCSA, 2005, 2013 ACS International Conference on Computer Systems and Applications (AICCSA), 2013 ACS International Conference on Computer Systems and Applications (AICCSA) 2005, pp. 47-I, doi:10.1109/AICCSA.2005.1387044