1 / 27

XML DOCUMENTS AND DATABASES

XML DOCUMENTS AND DATABASES. Introduction. This part is about how XML Documents can be stored and retrieved. Approaches to Storing XML Documents.

baird
Download Presentation

XML DOCUMENTS AND DATABASES

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML DOCUMENTS AND DATABASES

  2. Introduction • This part is about how XML Documents can be stored and retrieved.

  3. Approaches to Storing XML Documents • 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.

  4. Using a DBMS to store the documents as text • 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.

  5. Using a DBMS to store the documents as text • The keyword indexing functions of the document processing module can be used to index and speed up search and retrieval of the documents

  6. Using a DBMS to store the document contents as data elements • 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.

  7. Using a DBMS to store the document contents as data elements • 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.

  8. Designing a speciliazed system for storing native XML data • 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.

  9. Creating and publishing customized XML documents from preexisting relational databases • 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

  10. Creating and publishing customized XML documents from preexisting relational databases • This approach would use a seperate middleware software layer to handle the conversions needed between the XML documents and teh relational database.

  11. Extracting XML Documents from Relational Databases

  12. Extracting XML Documents from Relational Databases • 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.

  13. Extracting XML Documents from Relational Databases • 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.

  14. Example • Objective: Creating application to extract XML documents for student course and grade information from University DB.

  15. Example

  16. Example • To be able to do this we need COURSE, SECTION and STUDENT attributes.

  17. Example

  18. Example • When we convert it to tree model we must select root. So in this example we can choose three different root.

  19. Example

  20. Example

  21. Example

  22. Example

  23. Example

  24. Breaking Cycles to Convert Graphs into Trees • 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.

  25. Breaking Cycles to Convert Graphs into Trees • The way is to replicate the entity types involved in the cycles.

  26. Example

  27. Other Steps for Extracting XML Documents from Databases • 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.

More Related