this part is about how xml documents can be stored and retrieved
TRANSCRIPT
![Page 1: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/1.jpg)
XML DOCUMENTS AND DATABASES
![Page 2: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/2.jpg)
This part is about how XML Documents can be stored and retrieved.
Introduction
![Page 3: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/3.jpg)
Several approaches to organizing the contents of XML documents to facilitate their subsequent querying and retrieval have been proposed. The following are the most common approaches.
Approaches to Storing XML Documents
![Page 4: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/4.jpg)
A relation or object DBMS can be used to store whole XML documents as text fields within the DBMS records or objects.
This approaches cen be used if the DBMS has a special module for document processing, and would work for storing schemaless and document- centric XML documents.
Using a DBMS to store the documents as text
![Page 5: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/5.jpg)
The keyword indexing functions of the document processing module can be used to index and speed up search and retrieval of the documents
Using a DBMS to store the documents as text
![Page 6: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/6.jpg)
This approach would work for storing a collection of documents that follow a specific XML DTD or XML schema.
Because all the documents have the same structure, one can design a relational database to store the leaf data elements within the XML documents.
Using a DBMS to store the document contents as data elements
![Page 7: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/7.jpg)
To be able to handle this it requires mapping algorithmsto design a database schema that is compatible with the XML document structure as specified in the XML schema to recreate the XML documents from the stored data.
Using a DBMS to store the document contents as data elements
![Page 8: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/8.jpg)
A new type of database system based on the tree model could be desinged and implemented.
The system would include specialized indexing and would work for all types of XML documents.
By the way you can use compression techniques in this approach.
Designing a speciliazed system for storing native XML data
![Page 9: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/9.jpg)
There are enormous amounts of data already stored in relational databases.
Parts of this data may need to be formatted as documents for exchanging or displaying over the Web
Creating and publishing customized XML documents from preexisting relational databases
![Page 10: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/10.jpg)
This approach would use a seperate middleware software layer to handle the conversions needed between the XML documents and teh relational database.
Creating and publishing customized XML documents from preexisting relational databases
![Page 11: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/11.jpg)
Extracting XML Documents from Relational Databases
![Page 12: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/12.jpg)
In this part we focused on the last approach.
XML uses tree model to represent documents. When we add referential integrity constraints, a relational schema can be considered to be a graph structure.
Similarly also the ER model represents data using graphlike structures
There would be straightforward mappings between the ER and relational models.
Extracting XML Documents from Relational Databases
![Page 13: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/13.jpg)
So we can conceptually represent a relational database schema using the corresping ER schema.
Namely the issue is clarifying differences between tree and graph models. If we solve this also solve the problem of converting relational data to XML.
Extracting XML Documents from Relational Databases
![Page 14: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/14.jpg)
Objective: Creating application to extract XML documents for student course and grade information from University DB.
Example
![Page 15: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/15.jpg)
Example
![Page 16: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/16.jpg)
To be able to do this we need COURSE, SECTION and STUDENT attributes.
Example
![Page 17: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/17.jpg)
Example
![Page 18: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/18.jpg)
When we convert it to tree model we must select root. So in this example we can choose three different root.
Example
![Page 19: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/19.jpg)
Example
![Page 20: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/20.jpg)
Example
![Page 21: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/21.jpg)
Example
![Page 22: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/22.jpg)
Example
![Page 23: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/23.jpg)
Example
![Page 24: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/24.jpg)
It is possible to have more complex subset with one or more cycles, indicating multiple relationships among entities
In this case it is more complex to decide how to create the document hierarchies.
Additional duplication of entities may be needed to represent the multiple relationships.
Breaking Cycles to Convert Graphs into Trees
![Page 25: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/25.jpg)
The way is to replicate the entity types involved in the cycles.
Breaking Cycles to Convert Graphs into Trees
![Page 26: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/26.jpg)
Example
![Page 27: This part is about how XML Documents can be stored and retrieved](https://reader035.vdocuments.us/reader035/viewer/2022062620/551b0490550346cf5a8b4945/html5/thumbnails/27.jpg)
It is necessary to create the correct query in SQL to extract the desired information for the XML document
Once the query is executed, its result must be structured from the flat relational form to the XML tree structure.
Other Steps for Extracting XML Documents from Databases