Storage of XML DataXML data can be storedinNon-relationaldatastores.Flatfiles-Natural for storing XMI-ButhasallproblemsdiscussedinChapter1(noconcurrency,norecovery,....XMLdatabase-Databasebuilt specificallyfor storingXMLdata,supportingDOM modeland declarativequerying-Currentlyno commercial-grade systemsRelationaldatabasesDatamustbetranslatedintorelationalformAdvantage:maturedatabasesystems.Disadvantages:overhead oftranslatingdata and queries
Storage of XML Data • XML data can be stored in − Non-relational data stores • Flat files − Natural for storing XML − But has all problems discussed in Chapter 1 (no concurrency, no recovery, .) • XML database − Database built specifically for storing XML data, supporting DOM model and declarative querying − Currently no commercial-grade systems − Relational databases • Data must be translated into relational form • Advantage: mature database systems • Disadvantages: overhead of translating data and queries
Storing XML as RelationsTree representation: model XML data as tree and storeusing relationsnodes(id, type,label,valuechild (child-id, parent-id)-Each element/attribute is given a unique identifier-Typeindicateselement/attribute-Label specifies the tag name of the element/name ofattribute-Valueisthetext value ofthe element/attribute- The relation child notes the parent-child relationshipsin the tree. Can add an extra attribute to child to record orderingofchildren
Storing XML as Relations • Tree representation: model XML data as tree and store using relations nodes(id, type, label, value) child (child-id, parent-id) − Each element/attribute is given a unique identifier − Type indicates element/attribute − Label specifies the tag name of the element/name of attribute − Value is the text value of the element/attribute − The relation child notes the parent-child relationships in the tree • Can add an extra attribute to child to record ordering of children
Storing XML as Relations- Benefit: Can store any XML data, even without DTD-Drawbacks: Data is broken up into too many pieces, increasingspace overheadsEven simple queries require a large number of joins.whichcanbeslow
Storing XML as Relations − Benefit: Can store any XML data, even without DTD − Drawbacks: • Data is broken up into too many pieces, increasing space overheads • Even simple queries require a large number of joins, which can be slow
RootSigmodRecordssuvolumearticlesnumbertitleauthorsinitPageendPageAnnotated Biblioyon Data De:authorauthorpositionpositionAnthony L WasseKaren Botmichsern
Root SigmodRecord issue volume number articles title initPage endPage authors author author position position Annotated Bibliography on Data Design Anthony I. Wasserman Karen Botnich
SrcOrdLabelFlagValueTgt0refSigmodRecord2refissue32val11volume224numberval253refarticles5ref6article761titlevalAnnotated86245initPageval77936valendPage6104refauthors
Src Ord Tgt Label Flag Value 0 1 1 SigmodRecord ref 1 1 2 issue ref 2 1 3 volume val 11 2 2 4 number val 1 2 3 5 articles ref 5 1 6 article ref 6 1 7 title val Annotated 6 2 8 initPage val 45 6 3 9 endPage val 77 6 4 10 authors ref