/
OntheUpdatabilityofXMLViewsPublishedoverRelationalDataLingWangandElkeA OntheUpdatabilityofXMLViewsPublishedoverRelationalDataLingWangandElkeA

OntheUpdatabilityofXMLViewsPublishedoverRelationalDataLingWangandElkeA - PDF document

celsa-spraggs
celsa-spraggs . @celsa-spraggs
Follow
364 views
Uploaded On 2015-11-30

OntheUpdatabilityofXMLViewsPublishedoverRelationalDataLingWangandElkeA - PPT Presentation

2LingWangandElkeARundensteiner ID: 209632

2LingWangandElkeA.Rundensteiner

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "OntheUpdatabilityofXMLViewsPublishedover..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

OntheUpdatabilityofXMLViewsPublishedoverRelationalDataLingWangandElkeA.RundensteinerDepartmentofComputerScienceWorcesterPolytechnicInstituteWorcester,MA01609flingw,rundenstg@cs.wpi.eduAbstract.UpdatesovervirtualXMLviewsthatwraptherelationaldatahavenotbeenwellsupportedbycurrentXMLdatamanagementsystems.Thispaperstudiestheproblemoftheexistenceofacorrectrelationalupdatetranslationforagivenviewupdate.First,weproposeacleanextended-sourcetheorytodecidewhetheratranslationmappingiscorrect.Thentoanswerthequestionoftheexistenceofacorrectmap-ping,weclassifyaviewupdateaseitherun-translatable,conditionallyorunconditionallytranslatableunderagivenupdatetranslationpolicy.Wedesignagraph-basedalgorithmtoclassifyagivenupdateintooneofthethreeupdatecategoriesbasedonschemaknowledgeextractedfromtheXMLviewandtherelationalbase.Thisnowrepresentsapracti-calapproachthatcouldbeappliedbyanyexistingviewupdatesysteminindustryandinacademicforanalyzingthetranslatabilityofagivenupdatestatementbeforetranslationofitisattempted.1IntroductionTypicalXMLmanagementsystems[5,9,14]supportthecreationofXMLwrap-pingviewsandthequeryingagainstthesevirtualviewstobridgethegapbe-tweenrelationaldatabasesandXMLapplications.Updateoperationsagainstsuchwrapperviews,however,arenotwellsupportedyet.TheproblemofupdatingXMLviewspublishedoverrelationaldatacomeswithnewchallengesbeyondthoseofupdatingrelational[1,7]orevenobject-oriented[3]views.The¯rstistheupdatability.Thatis,themismatchbetweenthehierarchicalXMLviewmodelandthe°atrelationalbasemodelraisesthequestionwhetherthegivenviewupdateisevenmappableintoSQLupdates.Thesecondisthetranslationstrategy.Thatis,assumingtheviewupdateisindeedtranslatable,howtotranslatetheXQueryupdatesstatementsontheXMLviewintotheequivalenttuple-basedSQLupdatesexpressedontherelationalbase.Translationstrategieshavebeenexploredtosomedegreeinrecentwork.[11]presentsanXQueryupdategrammarandstudiestheexecutionperformanceoftranslatedupdates.However,theassumptionmadeinthisworkisthatthegivenupdateisindeedtranslatableandthatinfactithasalreadybeentranslatedintoSQLupdatesoverarelationaldatabase,whichisassumedtobecreatedbya 2LingWangandElkeA.Rundensteiner¯xedinlineloadingstrategy[8].CommercialdatabasesystemssuchasSQL-Server2000[10],Oracle[2]andDB2[6]alsoprovidesystem-speci¯csolutionsforrestrictedupdatetypes,againundertheassumptionofgivenupdatesalwaysbeingtranslatable.Ourearlierwork[12]studiestheXMLviewupdatabilityforthe\round-trip"case,whichischaracterizedbyapairofinvertablelosslessmappingsfor(1)loadingtheXMLdocumentsintotherelationalbases,and(2)extractinganXMLviewidenticaltotheoriginalXMLdocumentbackoutofit.WeprovethatsuchXMLviewsarealwaysupdatablebyanyupdateoperationvalidontheXMLview.However,tothebestofourknowledge,noresultintheliteraturefocusesonageneralmethodtoassesstheupdatabilityofanarbitraryXMLviewpublishedoveranexistingrelationaldatabase.Thisviewupdatabilityissuehasbeenalongstandingdi±cultproblemevenintherelationalcontext.Usingtheconceptof\cleansource",DayalandBern-stein[7]characterizetheschemaconditionsunderwhicharelationalviewoverasingletableisupdatable.Beyondthisresult,ourcurrentworknowanalyzesthekeyfactorsa®ectingtheviewupdatabilityintheXMLcontext.Thatis,givenanupdatetranslationpolicy,weclassifyupdatesoveranXMLviewasun-translatable,conditionallyorunconditionallytranslatable.Aswewillshow,thisclassi¯cationdependsonseveralfeaturesoftheXMLviewandtheupdatestatements,including:(a)granularityoftheupdateattheviewside,(b)prop-ertiesoftheviewconstruction,and(c)typesofduplicationappearingintheview.Byextendingtheconceptofa\cleansource"forrelationaldatabases[7]into\cleanextended-source"forXML,wenowproposeatheoryfordeterminingtheexistenceofacorrectrelationalupdatetranslationforagivenXMLviewupdate.Wealsoprovideagraph-basedalgorithmtoidentifytheconditionsunderwhichanXMLviewoverarelationaldatabaseisupdatable.Thealgorithmde-pendsonlyontheviewanddatabaseschemaknowledgeinsteadofontheactualdatabasecontent.Itrejectsun-translatableupdates,requestsadditionalcondi-tionsforconditionallytranslatableupdates,andpassesunconditionallytrans-latableupdatestothelaterupdatetranslationstep.Theproofofcorrectnessofouralgorithmcanbefoundinourtechnicalreport[13].Itutilizesourcleanextended-sourcetheory.Section2analyzesthefactorsdecidingtheXMLviewupdatability,whichisthenformalizedinSection3.InSection4weproposethe\cleanextended-source"theoryastheoreticalfoundationofourproposedsolution.Section5describesourgraph-basedalgorithmfordetectingupdatetranslatability.Section6providesconclusions.FactorsforXMLViewUpdatabilityUsingexamples,wenowillustratewhatfactorsa®ecttheviewupdatabilityingeneral,andwhichfeaturesofXMLspeci¯callycausenewviewupdatetransla-tionissues.RecentXMLsystems[5,9,14]useadefaultXMLviewtode¯nethe OntheUpdatabilityofXMLViewsPublishedoverRelationalData3980039800398001bookidwww.bookpool.com45.60www.amazon.com56.0063.70amountwww.amazon.comwebsiteProgramming in Unix98002Data on the Web98003TCP/IP Illustrated98001titlebookidpricebookPrimary KeyNon KeyLegend:CREATE TABLEbook(bookidVARCHAR2(20),title VARCHAR2(100),CONSTRAINTSBookPKPRIMARYKEY(bookid))CREATE TABLEprice(bookidVARCHAR2(20),amount DOUBLE,website VARCHAR2(100),CONSTRAINTSPricePKPRIMARYKEY(bookid, website),FOREIGNKEY(bookid) REFERENCESbook (bookid))Fig.1.RelationaldatabaseDB�book�row�bookid�98001/bookid�title�TCP/IP Illustrated/title�/row�.../book�price�row�bookid�98001/bookid�amount�63.70/amount�website�www.amazon.com/website�/row�.../price�DB�Fig.2.DefaultXMLviewofdatabaseshowninFigure1bib�FOR$book IN document("default.xml")/book/rowRETURN {book_info�$book/bookid,$book/title,FOR$price IN document("default.xml")/price/rowWHERE$book/bookid= $price/bookid RETURN {price_info�$price/amount,$price/website /price_info�}/book_info�/bib� }Q1bib�book_info�bookid�98001/bookid�title� TCP/IP Illustrated /title�price_info� amount�63.70/amount�website�www.amazon.com/website�/price_info�/book_info�book_info�bookid�98003/bookid�title�Data on the Web/title�price_info� amount�56.00/amount�website�www.amazon.com/website�/price_info�price_info� amount�45.60/amount�website�www.bookpool.com/website�/price_info�/book_info�/bib�V1bib�FOR$book IN document("default.xml")/book/row,$price IN document("default.xml")/price/rowWHERE$book/bookid= $price/bookid RETURN {price_info�$price/amount,$price/website,book_info�$book/bookid,$book/title/book_info�/price_info�/bib� }Q2bib�price_info� amount�63.70/amount�website�www.amazon.com /website�book_info�bookid�98001/bookid�title�TCP/IP Illustrated/title�/book_info�/price_info�price_info� amount�56.00/amount�website� www.amazon.com /website�book_info�bookid�98003/bookid�title�Data on the Web/title�/book_info�/price_info�price_info� amount�45.60/amount�website� www.bookpool.com /website�book_info�bookid�98003/bookid�title�Data on the Web/title�/book_info�/price_info�/bib�V2(a) View V1 defined by Q1(b) View V2 defined by Q2bib�FOR$book IN document("default.xml")/book/row,$price IN document("default.xml")/price/rowWHERE$book/bookid= $price/bookid RETURN {book_info�$book/bookid,$book/title,price_info�$price/amount,$price/website/price_info�/book_info�/bib�}Q3V3bib�book_info�bookid�98001/bookid�title� TCP/IP Illustrated /title�price_info� amount�63.70/amount�website�www.amazon.com/website�/price_info�/book_info�book_info�bookid�98003/bookid�title�Data on the Web/title�price_info� amount�56.00/amount�website�www.amazon.com /website�/price_info�/book_info�book_info�bookid�98003/bookid�title�Data on the Web/title�price_info� amount�45.60/amount�website� www.bookpool.com /website�/price_info�/book_info�/bib�(c) View V3 defined by Q3Q4V4(d) View V4 defined by Q4bib�FOR$book IN document("default.xml")/book/rowRETURN {book_info�$book/bookid,$book/title,FOR$priceIN document("default.xml")/price/rowWHERE$book/bookid= $price/bookid RETURN {price_info�$book/bookid,$price/amount,$price/website /price_info�}/book_info�/bib� }bib�book_info�bookid�98001/bookid�title� TCP/IP Illustrated /title�price_info� bookid�98001/bookid�amount�63.70/amount�website�www.amazon.com/website�/price_info�/book_info�book_info�bookid�98003/bookid�title�Data on the Web/title�price_info� bookid�98003/bookid�amount�56.00/amount�website�www.amazon.com /website�/price_info�price_info�bookid�98003/bookid�amount�45.60/amount�website� www.bookpool.com /website�/price_info�/book_info�/bib�Fig.3.ViewV1toV4de¯nedbyXQueryQ1toQ4respectively 4LingWangandElkeA.Rundensteinerone-to-oneXML-to-relationalmapping(Fig.2).Aviewquery(Fig.3)isde¯nedoverittoexpressuser-speci¯cXMLwrapperviews.Userupdatesoverthevir-tualXMLviewsareexpressedinXQueryupdatesyntax[11](Fig.4).Also,weonlyconsiderinsertion/deletioninourdiscussion.Areplacementistreatedasadeletionfollowedbyaninsertionwithoutspeci¯callydiscussion.2.1UpdateTranslationPolicyClearly,theupdatetranslationpolicychosenforthesystemisessentialforthedecisionofviewupdatability.Anupdatemaybetranslatableunderonepolicy,whilenotunderanotherone.Wenowenumeratecommonpoliciesobservedintheliterature[3,11]andinpractice[14].Policiesforupdatetypeselection.(1)Sametype.Thetranslatedupdateal-waysmusthavethesameupdatetypeasthegivenviewupdate.(2)Mixedtype.Translatedupdateswithadi®erenttypeareallowed.Policiesformaintainingreferentialintegrityoftherelationaldatabaseun-derdeletion.(1)Cascade.Thedirectlytranslatedrelationalupdatescascadetoupdatethereferencedrelationsaswell.(2)Restrict.Therelationalupdateisrestrictedtothecasewhentherearenoreferencedrelations.Otherwise,rejecttheviewupdate.(3)SetNull.Therelationalupdateisperformedasrequired,whiletheforeignkeyissettobeNULLineachdanglingtuple.Thetranslatabilityofavalidviewupdateunderagivenpolicycanbeclassi¯edasunconditionallytranslatable,conditionallytranslatableandun-translatable.Aviewupdateiscalledun-translatableifitcannotbemappedintorelationalup-dateswithoutviolatingsomeconsistency.Aviewupdateisunconditionallytrans-latableifsuchatranslationalwaysexistsunderthegivenpolicy.Otherwise,wecallitconditionallytranslatable.Thatis,underthecurrentupdatepolicy,thegivenupdateisnottranslatableunlessadditionalconditions,suchasassump-tionsorusercommunication,areintroducedtomakeittranslatable.Whennotstatedotherwise,throughoutthepaperwepickthemostcommonlyusedpolicy,thatis,sameupdatetypeanddeletecascade.Ifadi®erenttranslationpolicyisused,thenthediscussioncanbeeasilyadjustedaccordingly.Also,wedonotindicatetheorderofthetranslatedrelationalupdates.Foragivenexecutionstrategy,thecorrectordercanbeeasilydecided[1,11,12].2.2NewChallengesArisingfromXMLDataModelExample1.:Viewconstructionconsistency.AssumetwoviewupdatesuVanduV2(Fig.4)deletea\bookinfo"elementfromV1andV2inFig.3respectively.(i)Fig.5showsuVisunconditionallytranslatable.ThetranslatedrelationalupdatesequenceURinFig.5(b)willdeletethe¯rstbookfromthe\book"relationbyuR1,anditspricesfromthe\price"relationthroughuR2.Byre-applyingtheviewqueryQ1ontheupdateddatabaseD0inFig.5(c),theupdatedXMLviewinFig.5(d)equalstheuserexpectedupdatedviewV10inFig.5(a). OntheUpdatabilityofXMLViewsPublishedoverRelationalData5FOR$root INdocument("V1.xml"),$book IN$root/book_infoWHERE$book/title/text() = " TCP/IP Illustrated" UPDATE$root {DELETE$book }uV1FOR$root INdocument("V2.xml"),$book IN$root/price_info/book_infoWHERE$book/title/text() = " TCP/IP Illustrated" UPDATE$root {DELETE$book }uV2FOR$root INdocument("V3.xml"),$book IN$root/book_infoWHERE$book/title/text() = " Data on the Web" AND $book/price_info/website = " www.amazon.com"UPDATE$root {DELETE$book }uV3FOR$root INdocument("V4.xml"),$book IN$root/book_infoWHERE$book/title/text() = "Data on the Web" AND $book/price_info/website = " www.amazon.com "UPDATE$root {DELETE$book/price_info}uV4FOR$root INdocument("V2.xml"),$price IN$root/price_infoWHERE$price/book_info/title/text() = "TCP/IP Illustrated" UPDATE$root {DELETE$price }uV5FOR$root INdocument("V3.xml"),$book IN$root/book_infoWHERE$book/title/text() = " Data on the Web“AND $book/price_info/website = " www.amazon.com"UPDATE$root {DELETE$book/price_info }uV6FOR$root INdocument("V4.xml"),$book IN$root/book_infoWHERE$book/title/text() = "Data on the Web" AND $book/price_info/website = " www.amazon.com"UPDATE$root {DELETE$book }uV7FOR$root INdocument("V3.xml")UPDATE$root {INSERT book_info�bookid�"98003"bookid�title�" Data on the Web"/title�price_info�amount�56.00/amount�website�www.ebay.com/website�/price_info�/book_info� }uV8Fig.4.UpdateoperationsonXMLviewsde¯nedinFig.3bib�book_info�bookid�98003/bookid�title�Data on the Web/title�price_info� amount�56.00/amount�website�www.amazon.com/website�/price_info�price_info� amount�45.60/amount�website�www.bookpool.com/website�/price_info�/book_info�/bib�(a)V10(d)Q1(D0).Samewith(a).u1R: DELETE FROMbook WHEREbook.ROWID IN( SELECT DISTINCTbook.ROWID FROMbookWHERE(book.title = 'TCP/IP Illustrated') )u2R: DELETE FROMprice WHEREprice.ROWID IN( SELECT DISTINCTprice.ROWID FROMbook,price WHERE(book.title = 'TCP/IP Illustrated') AND(book.bookid= price.bookid))(b)UR9800398003bookidwww.bookpool.com45.60www.amazon.com56.00amountwebsiteProgramming in Unix98002Data on the Web98003titlebookidpricebook(c)D0Fig.5.TranslateuV(a)V10:Theuserexpectedupdatedview,(b)UR:Thetranslatedupdate,(c)D0:Theupdatedrelationaldatabase,(d)Q1(D0):Theregeneratedview.(ii)Fig.6showsuVisun-translatable.First,therelationalupdateuR1inFig.6(b)isgeneratedtodeletethebook(bookid=98001)fromthe\book"relation.Notetheforeignkeyfromthe\price"relationtothe\book"relation(Fig.1).ThesecondupdateoperationuR2willbegeneratedbytheupdatetranslatortokeeptherelationaldatabaseconsistent.TheregeneratedviewinFig.6(d)isdi®erentthantheuserexpectedupdatedviewV20inFig.6(a).Noothertranslationisavailablewhichcouldpreserveconsistencyeither.Theexistenceofacorrecttranslationisa®ectedbytheviewconstructionconsistencyproperty,namely,whethertheXMLviewhierarchyagreeswiththehierarchicalstructureimpliedbythebaserelationalschema.Example2.:Contentduplication.NextwecomparethetwovirtualXQueryviewsV1andV3inFig.3.Thebook(bookid=98003)withtwopricesisexposedtwiceinV3,whileonlyonceinV1.TheupdateuVinFig.4willdeletethe\bookinfo"elementfromamazon,whilekeepingtheonefrombookpool.Nowshouldwedeletethebooktupleunderneath?Itisunclear.Anadditionalcondition,suchasanextratranslationrulelike\Nounderlyingtupleisdeletedifitisstillreferencedbyanyotherpart 6LingWangandElkeA.Rundensteinerbib�price_info� amount�63.70/amount�website�www.amazon.com/website�/price_info�price_info� amount�56.00/amount�website�www.amazon.com/website�book_info�bookid�98003/bookid�title�Data on the Web/title�/book_info�/price_info�.../bib�(a)V20(b)UR.SamewithFig.5(b).(c)D0.SamewithFig.5(c).bib�price_info� amount�56.00/amount�website�www.amazon.com/website�book_info�bookid�98003/bookid�title�Data on the Web/title�/book_info�/price_info�.../bib�(d)Q2(D0)Fig.6.TranslateuV(a)V20:Theuserexpectedupdatedview,(b)UR:Thetranslatedupdate,(c)D0:Theupdatedrelationaldatabase,(d)Q2(D0):Theregeneratedview.oftheview"couldmaketheupdateuVtranslatablebykeepingthebooktupleuntouched.Thisupdateisthuscalledconditionallytranslatable.ThisambiguouscontentduplicationisintroducedbytheXQuery\FOR"expression.ThispropertycouldalsoariseinrelationalJoinviews.Example3.:Structuralduplication.GivenQ4inFig.3witheach\bookid"exposedtwiceinthesingle\bookinfo"element.TheupdateuVinFig.4,whichdeletesthe¯rstpriceofthespeci¯edbook,isclassi¯edasconditionallytranslatable.Sincetheprimarykey\bookid"istouchedbyuV,wecannotdecidewhethertodeletethebook-tupleunderneath.Withanadditionalcondition,suchasknowledgeoftheuserintentionabouttheupdate,uV4becomestranslatable.Structuralduplication,asillustratedabove,isspecialtoXMLviewupdating.Whileitalsoexistsintherelationalcontext,itwouldnotcauseanyambiguity.The°atrelationaldatamodelonlyallowstuple-basedviewinsertion/deletion.Theupdatetouchesallnotjustsomeoftheduplicateswithinaviewtuple.In-steadofalwaysenforcinganupdateonthebiggestviewelement\bookinfo",the°exiblehierarchicalstructureofXMLallowsa\partial"updateonsubelementsinsideit.Inconsistencybetweentheduplicatedpartsthusoccurs.Example4.:Updategranularity.ComparedwiththefailureoftranslatinguVinExample1,theupdateuV5inFig.4onthesameviewV2isconditionallytranslatable.uV5deletesthewhole\priceinfo"elementinsteadofjustthesub-element\bookinfo".ThetranslatedrelationalupdatesequenceURisthesameasinFig.6(b).Theregeneratedviewisthesameaswhattheuserexpects.Duetocontentduplication,uVissaidtobeconditionallytranslatable.XMLhierarchicalstructureo®ersanopportunityfordi®erentupdategranu-larity,anissuethatdoesnotariseforrelationalviews.3FormalizingtheProblemofXMLViewUpdatabilityThestructureofarelationisdescribedbyarelationschemaR(N;A;F),whereNisthenameoftherelation,A=fa1;a2;:::;amgisitsattributeset, OntheUpdatabilityofXMLViewsPublishedoverRelationalData7andFisasetofconstraints.ArelationRisa¯nitesubsetofdom(A),aprod-uctofalltheattributedomains.Arelationaldatabase,denotedasD,isasetofnrelationsR1;:::;Rn.ArelationalupdateoperationuR20Risadeletion,insertionorreplacementonarelationR.Asequenceofrelationalup-dateoperations,denotedbyUR=fuR;uR2;:::;uRgisalsomodeledasafunctionUR(D)=uR(uR¡1(:::;uR2(uR1(D)))).Table1.NotationsforXMLviewupdateproblemDrelationaldatabaseR(N;A;F)schemaofrelationRrelation0RdomainofrelationalupdateoperationsuRrelationalupdateoperationURsequenceofrelationalupdateoperationsVXMLviewDEFVXMLviewde¯nitionuVviewupdate0VdomainofviewupdateoperationsAnXMLviewVoverarelationaldatabaseDisde¯nedbyaviewde¯-nitionDEFV(anXQueryexpressioninourcase).Thedomainoftheviewisdenotedbydom(V).LetrelbeafunctiontoextracttherelationsinDrefer-encedbyDEFV,thenrel(DEFV)=fRi1;Ri2;:::;RipgµD.AnXMLviewschemaisextractedfrombothDEFVandrel(DEFV).See[13]fordetails.LetuV20VbeanupdateontheviewV.Avalidviewupdate(e.g.,Fig.4)isaninsertionordeletionthatsatis¯esallconstraintsintheviewschema.De¯nition1.Givenanupdatetranslationpolicy.LetDbearelationaldatabaseandVbeavirtualviewde¯nedbyDEFV.ArelationalupdatesequenceURisacorrecttranslationofuVi®(a)uV(DEFV(D))=DEFV(UR(D))and(b)ifuV(DEFV(D))=DEFV(D))UR(D)=D.VDuV(V)DEFvDEFv(2)uV(3) URUR(S)(1)(4)Fig.7.CorrecttranslationofviewupdatetorelationalupdateUn-translatableConditional TranslatableNon-Conditional TranslatableInvalid UpdateInvalid UpdateLegend:Valid UpdateUn-translatableConditionallyTranslatableNon-ConditionallyTranslatableFig.8.Thepartitionofviewupdatedomain0VFirst,acorrecttranslationmeansthe\rectangle"ruleholds(Fig.7).Intu-itively,itimpliesthetranslatedrelationalupdatesdonotcauseanyviewsidee®ects.Second,ifanupdateoperationdoesnota®ecttheview,thenitshouldnota®ecttherelationalbaseeither.Thisguaranteesanymodi¯cationoftherelationalbaseisindeeddoneforthesakeoftheview.Fig.8showsatypicalpartitionoftheviewupdatedomain0V.TheXMLviewupdatabilityclassi¯esavalidviewupdateaseitherunconditionallytrans-latable,conditionallytranslatableorun-translatable. 8LingWangandElkeA.Rundensteiner4TheoreticalFoundationforXMLViewUpdatabilityDayalandBernstein[7]showthatacorrecttranslationexistsinthecaseofa\cleansource",whenonlyconsideringfunctionaldependenciesinsideasinglerelation.InthecontextofXMLviews,wenowadoptandextendthisworktoalsoconsiderfunctionaldependenciesbetweenrelations.De¯nition2.GivenarelationaldatabaseDandanXMLviewVde¯nedoverseveralrelationsrel(DEFV)µD.LetvbeaviewelementofV.Letg=(t1;:::;tp)beageneratorofv,whereti2RxforRx2rel(DEFV).ThentiiscalledasourcetupleinDofv.Further,tj2RyisanextendedsourcetupleinDofvi®9ti2gthatti:akisaforeignkeyoftj:az,whereak2Rx(A),az2Ry(A)andRx;Ry2rel(DEFV).ge=g[ftjjtjisanextendedsourcetupleofvgiscalledanextendedgeneratorofv.Asourcetupleisarelationalrowusedtocomputetheviewelement.Forinstance,inV1ofFig.3,the¯rstviewelementv1isbookinfoelementwithbookid=98001.LetR1andR2denotethebookandpricerelationsrespectively,thenthegeneratorgofv1isg=(t1;t2),wheret12R1isthebooktu-ple(98001,TCP/IPIllustrated)andt22R2isthepricetuple(98001,63.70,www.amazon.com).Lettheview-elementv2bethetitleofv1.Thenthesourcetupleofv2ist1.Sincet1.bookidisaforeignkeyoft2:bookid,wesayt2isanextendedsourcetupleofv2,andge=(t1;t2)isanextendedgeneratorofv2.De¯nition3.LetV0beapartofagivenXMLviewV.LetG(V0)bethesetofgeneratorsofV0de¯nedbyG(V0)=fgjgisageneratorofaview-elementinV0g.Foreachg=(t1;:::;tp)2G(V0),letH(g)besomenonemptysubsetofftijti2gg.Thenanysupersetof[g2G(V0)H(g)isasourceinDofV0.(IfG(V0)=;,thenV0hasnosourceinD.)Similarly,letGe(V0)bethesetofextendedgeneratorsforviewelementsinV0.Thenanysupersetof[g2Ge(V0)H(g)isanextendedsourceinDofV0,denotedbySe.Asourceincludestheunderlyingrelationalpartofaview\portion"V0whichconsistsofmultipleview-elements.Forexample,letV0=V1(Fig.3),G(V0)=fg1;g2g,whereg1=f(98001,TCP/IPIllustrated),(98001,63.70,www.amazon.com)g,g2=f(98003,DataontheWeb),(98003,56.00,www.amazon.com),(98003,45.60,www.bookpool.com)g.Thatis,G(V0)includesallthegeneratorsforviewele-mentsinV0.LetH(g1)=f(98001,TCP/IPIllustrated)gandH(g2)=f(98003,56.00,www.amazon.com)g.Thenf(98001,TCP/IPIllustrated),(98003,56.00,www.amazon.com)gisasourceofV0,alsoanextendedsourceofV0.De¯nition4.LetD=fR1;:::;Rngbearelationaldatabase.LetV0bepartofagivenXMLviewVandSebeanextendedsourceinDofV0.SeisacleanextendedsourceinDofV0i®(8v2V¡V0),(9S0e)suchthatS0eisanextendedsourcein(R1¡Se1;:::;Rn¡Sen)ofv.Or,equivalently,SeisacleanextendedsourceinDofV0i®(8v2V¡V0)(SeisnotanextendedsourceinDofv). OntheUpdatabilityofXMLViewsPublishedoverRelationalData9Acleanextendedsourcede¯nesasourcethatisonlyreferencedbythegivenviewelementitself.Forinstance,giventheview-elementvinV2(Fig.3)rep-resentingthebookinfoelement(bookid=98001),itsextendedsourcef(98001,TCP/IPIllustrated),(98001,63.70,www.amazon.com)gisnotacleanextendedsourcesinceitisalsoanextendedsourceofthepriceelement.Thecleanextendedsourcetheorybelowcapturestheconnectionbetweencleanextendedsourceandupdatetranslatability(Proofsin[13]).Itservesasaconservativesolutionforidentifyingthe(unconditionally)translatableupdates.Theorem1.LetuVbethedeletionofasetofviewelementsVdµV.Let¿beatranslationprocedure,¿(uV;D)=UR.Then¿correctlytranslatesuVtoDi®URdeletesacleanextendedsourceofVd.ByDe¯nition1,acorrectdeletetranslationisonewithoutanyviewsidee®ect.Thisisexactlywhatdeletingacleanextended-sourceguaranteesbyDef-inition4.ThusTheorem1follows.Theorem2.LetuVbetheinsertionofasetofviewelementsViintoV.LetV¡=V¡Vi,Vu=Vi¡V.Let¿beatranslationprocedure,¿(uV;D)=UR.Then¿correctlytranslatesuVtoDi®(i)(8v2Vu)(URinsertsasourcetupleofv)and(ii)(8v2dom(V)¡(Vu[V¡))(URdoesnotinsertasourcetupleofv).Sincedom(V)¡(Vu[V¡)=(dom(V)¡(Vi[V))[(Vi\V),Theorem2indicatesacorrectinserttranslationistheonewithoutanyduplicateinsertion(insertasourceofVi\V)andanyextrainsertion(insertasourceofdom(V)¡(Vi[V)).Thatis,itinsertsacleanextendedsourceforthenewview-element.DuplicateinsertionisnotallowedbyBCNF,whileextrainsertionwillcauseaviewsidee®ect.Forexample,foruVinFig.4,letuR1=fInsert(98003,DataontheWeb)intobookg,uR=fInsert(98003,56.00,www.ebay.com)intopriceg.ThenUR=fuR;uR2gisnotacorrecttranslationsinceitinsertsaduplicatesourcetupleintobook.WhileUR0=fuR2gisacorrecttranslation.5Graph-basedAlgorithmforDecidingViewUpdatabilityWenowproposeagraph-basedalgorithmtoidentifythefactorsandtheiref-fectsontheupdatetranslatabilitybasedonourcleanextendedsourcetheory.WeassumetherelationaldatabaseisintheBCNFform.Nocyclicdepen-dencycausedbyintegrityconstraintsamongrelationsexists.Also,thepred-icateusedintheviewqueryexpressionisaconjunctionofnon-correlation(e.g.,$price/website=\www.amazon.com")orequi-correlationpredicates(e.g.,$book/bookid=$price/bookid).5.1GraphicRepresentationofXMLViewsTwographscapturetheupdaterelatedfeaturesintheviewVandrelationalbaseD.TheviewrelationshipgraphGR(NGR;EGR)isaforestrepresenting 10LingWangandElkeA.RundensteinerthehierarchicalandcardinalityconstraintsintheXMLviewschema.Aninternalnode,representedbyatriangle4,identi¯esaviewelementorattributelabeledbyitsname.Aleafnode(representedbyasmallcircle±)isanatomictype,labeledbyboththeXPathbindingandthenameofitscorrespondingrelationalcolumnRx:ak.Anedgee(n1;n2)2EGRrepresentsthatn1isaparentofn2intheviewhierarchy.Eachedgeislabeledbythecardinalityrelationshipandcondition(ifany)betweenitsendnodes.Alabel\?"meanseachparentnodecanonlyhaveonechild,while\¤"showsmultiplechildrenarepossible.Figures9(a)to9(d)depicttheviewrelationshipgraphsforV1toV4inFig.3respectively.book_infobook/row/bookidbook.bookidbook/row/titlebook.titleprice_infobib1347price/row/websiteprice.website5price/row/amountprice.amount6*??*??con(a)book_infobook/row/bookidbook.bookidbook/row/titlebook.titleprice_infobib12347price/row/websiteprice.website5price/row/amountprice.amount6*?????con(c)price_infobook/row/titlebook.titlebook_infoprice/row/amountprice.amountbook/row/bookidbook.bookidbib123467price/row/websiteprice.website5*?????con(b)book_infobook/row/bookidbook.bookidbook/row/titlebook.titleprice_infobib1348price/row/websiteprice.website5price/row/amountprice.amount*??*?7?conbook/row/bookidbook.bookid6?(d)*Note:con=(book/row/bookid=price/row/bookid)Fig.9.GRofV1toV4asshownby(a)to(d)bookbook/row/bookidbook.bookidbook/row/titlebook.titlepriceprice/row/amountprice.amount123price/row/websiteprice.website54con??*??6*Note:con=(book.bookid=price.bookid)Fig.10.GTofV1{V4De¯nition5.Thehierarchyimpliedinrelationalmodelisde¯nedas:(1)GivenarelationschemaR(N;A;F),withA=faij1·i·mg,thenNiscalledtheparentoftheattributeai(1·i·m).(2)GiventworelationschemasRi(Ni,Ai,Fi)andRj(Nj,Aj,Fj),withforeignkeyconstraintsde¯nedasPK(Ri)ÃFK(Rj),thenNiistheparentofNj.TheviewtracegraphGT(NGT;EGT)representsthehierarchicalandcardi-nalityconstraintsintherelationalschemaunderlyingtheXMLview.Thesetof OntheUpdatabilityofXMLViewsPublishedoverRelationalData11leafnodesofGTcorrespondtotheunionofallleavesofGR.Specially,aleafnodelabeledbytheprimarykeyattributeofarelationiscalledakeynode(depictedbyablackcircle²).Aninternalnode,depictedbyatriangle4,islabeledbytherelationname.Eachedgee(n1;n2)2EGTmeansn1istheparentofn2byDe¯nition5.Anedgeislabeledbyitsforeignkeycondition(ifitisgeneratedbyrule(2)inDe¯nition5),andthecardinalityrelationshipbetweenitsendnodes.TheviewtracegraphsofV1toV4areidentical(Fig.10),sincetheyallde¯nedoverthesameattributesofbaserelations.TheconceptofclosureinGRandGTisusedtorepresentthe\e®ect"ofanupdateontheviewandontherelationaldatabaserespectively.Intuitively,theirrelationshipindicatestheupdatabilityofthegivenview.Theclosureofanoden2NGR,denotedbyn+R,isde¯nedasfollows:(1)Ifnisaleafnode,n+GR=fng.(2)Otherwise,n+GRistheunionofitschildren'sclosuresgroupedbytheirhierarchicalrelationshipandmarkedbytheircardinality(forsimplicity,notshownwhencardinalitymarkis?).Forexample,inFigure9(a),(n3)+GR=fn3g,while(n5)+GR=fn6;n7g,(n2)+GR=fn3;n4;(n6;n7)¤g.Theclosureofanoden2NGTisde¯nedinthesamemannerasinGR,exceptforleafnodes.Eachleafnodehasthesameclosureasitsparentnode.Forinstance,inFig.10,(n2)+GT=(n3)+GT=(n1)+GT=fn2;n3;(n5;n6)¤g.Thisclosurede¯nitioninGTisbasedonthepre-selectedupdatepolicyinSection2.1.Ifadi®erentpolicywereused,thenthede¯nitionneedstobeadjustedaccordingly.Forexample,ifwepickthemixedtype,theclosurewillbe\onlythekeynodehasthesameclosurede¯nitionasitsparentnode,whileanyotherleafnodehasitselfastheclosure".ConsequentlyinFig.10,(n3)+T=fn3g,while(n2)+T=fn2;n3;(n5;n6)¤g.Thedeleteonthesenon-keyleafnodescanbetranslatedasareplacementonthecorrespondingrelationalcolumn.Toreducetheclosurede¯nition,thegroupmark\()"canbeeliminatedifitscardinalitymarkis\?".Forexample,inFigure9(c),(n2)+T=fn3;n4;(n6;n7)g=fn3;n4;n6;n7g.TheclosureofasetofnodesN,denotedbyN+,isde¯nedasN+=S(ni2N)n+,whereSisa\Union-like"operationthatcombinesnotonlythenodesbuttheirsharedoccurrence.Forinstance,inFig.10,fn2;n5g+T=(n2)+TS(n5)+GT=fn2;n3;(n5;n6)¤gSfn5;n6g=fn2;n3;(n5;n6)¤g.TwoleafnodesinGRorGTareequalifandonlyiftherelationalattributelabelsintheirrespectivenodelabelsarethesame.5.2AGraph-basedAlgorithmforViewUpdatabilityIdenti¯cationDe¯nition6.TwoclosuresC1andC2match,denotedbyC1»C2,i®thenodesetofC1andC2areequal.Further,C1andC2areequal,denotedbyC1´C2,i®thenodegroups,cardinalitymarksofeachgroup,andconditionsoneach\*"edgeareallthesame.Fortwoclosurestomatchmeansthatthesameviewschemanodesareincluded.WhileequalityindicatesthatthesameinstancesofXMLviewele-mentswillbeincluded.Forexample,(n2)+RinFig.9(c)and(n1)+GTinFig. 12LingWangandElkeA.Rundensteiner10match.Thatis,bothclosuresincludethesameXMLviewschemanodes:book.bookid,book.title,price.amount,price.website.However,(n2)+RinFigure9(a)and(n1)+GTinFigure10areequal,namelyfbook.bookid,book.title,(price.amount,price.website)¤g.Thisisbecausetheirgrouppartition(markedby\()"),cardi-nalitymark(*or?)andconditionsforeach\*"edgeareallthesame.BothclosurestouchexactlythesameXMLview-elementinstances.Theorem3.LetVbeaviewde¯nedbyDEFVoverarelationaldatabaseDwiththeviewrelationshipgraphGR(NGR;EGR)andviewtracegraphGT(NGT;EGT).LetYµNGRandXµNGT.(8generatorsg;g0ofviewelementsvandv0re-spectively,g[X]=g0[X])v[Y]=v0[Y])i®theirclosuresX+GT´Y+GR.Theorem3indicatesthattwoequalgeneratorsalwaysproducetheidenticalviewelementsi®therespectiveclosuresoftheviewschemanodesinGRandGTareequal.Theorem3nowenablesustoproduceanalgorithmfordetectingthecleanextendedsourcesSeofaviewelementbasedonschemaknowledgecapturedinGRandGT.Theorem4.LetV;DEFV;D;GR;GT;Ybede¯nedasinTheorem3.Givenaviewelementv2V(Y),thereisacleanextendedsourceSeofvinDi®(9XµNGT)suchthatX+GT´Y+GR.Theorem4indicatesthatagivenviewelementvhasacleanextendedsourcei®theclosureofitsschemanodeinGRhasanequalclosureinGT.AsindicatedbyTheorems1and2,theexistenceofacleanextendedsourceforagivenXMLviewelementimpliesthattheupdatetouchingthiselementisunconditionallytranslatable.Thefollowingobservationthusservesasageneralmethodologyforviewupdatabilitydetermination.Observation1LetD;V;GR;GT;Ybede¯nedasinTheorem3.(1)UpdatesthattouchYareunconditionallytranslatablei®(9XµNGT)suchthatX+GT´Y+GR.(2)UpdatesthattouchYareconditionallytranslatablei®(9XµNGT)suchthatX+GT»Y+GR.(3)Otherwise,updatesonYareun-translatable.However,searchingallnodeclosuresinGTto¯ndoneequaltotheclosureofagivenview-elementisexpensive.AccordingtothegenerationrulesofGT,thenodesintheclosureofvalsoserveasleafnodesinGT.Wethusproposetostartsearchingfromleafnodeswithintheclosure,thusreducingthesearchspace.Observation2utilizedthefollowingde¯nitiontodeterminethetranslatabilityofagivenviewupdate.De¯nition7.LetnbeanodeinGR(V),withitsclosureinGRdenotedbyCR=n+R.LetCT=S(ni2CR)(ni)+GT,where(ni)+GTbetheclosureofniinGT.Wesaynisacleannodei®CR´CT,aconsistentnodei®CR»CTandaninconsistentnodeotherwise. OntheUpdatabilityofXMLViewsPublishedoverRelationalData13Foranodetobeinconsistentmeansthatthee®ectofanupdateontheview(nodeclosureinGR)isdi®erentfromthee®ectontherelationalside(nodeclosureinGT)basedontheselectedpolicy(closurede¯nitioninGT).Itisthusun-translatable.Acleannodeisguaranteedtobesafelyupdatablewithoutanyviewside-e®ects.Adirtyconsistentnode,however,needsanadditionalconditiontobeupdatable.Forexample,n5inFig.9(a)isacleannode.InFig.9(b),n5isaninconsistentnodeandn2isadirtyconsistentnode.Observation2Anupdateonacleannodeisunconditionallytranslatable,onaconsistentnodeitisconditionallytranslatable,whileonaninconsistentnodeitisun-translatable.Algorithm1OptimizedUpdateTranslatabilityCheckingAlgorithm/*GivenGRandGTofaviewV,determinethetranslatabilityofaviewupdateu*/ProcedurecheckTranslatability(u,GR,GT)Noden=identifyNodeToUpdate(u,GR)classifyNode(n,GR,GT)ifnisacleannodethennisunconditionallytranslatableelseifnisaconsistentnodethennisconditionallytranslatableelsenisuntranslatableendifendif/*Classifythenoden2GRtobeupdated*/ProcedureclassifyNode(n,GR,GT)InitiateCRandCTemptyCR=computeClosure(n,GR)whileCRhasmorenodedogetthenextnodeni2CRCT=CT[computeClosure(ni,GT)endwhileifCR»=CTthenifCR´CTthennisaconsistentnodeelsenisacleannodeendifelsenisaninconsistentnodeendifAlgorithm1showsouroptimizedupdatetranslatabilitycheckingalgorithmusingObservation2.It¯rstidenti¯esthedeleting/insertingGRnode.Then,usingDe¯nition7theprocedureclassifyNode(n,GR,GT)determinesthetypeofthenodetobeupdated.Thereafterthegivenviewupdatecanbeclassi¯edasun-translatable,conditionallyorunconditionallytranslatablebyObservation2.Usingthisoptimizedupdatetranslatabilitycheckingalgorithm,aconcretecasestudyonthetranslatabilityofdeletesandinsertsisalsoprovidedin[13].6ConclusionInthispaper,wehaveidenti¯edthefactorsdeterminingviewupdatabilityingeneralandalsointhecontextofXQueryviewsinparticular.Theextendedclean-sourcetheoryfordeterminingtranslationcorrectnessispresented.Agraph-basedalgorithmhasalsobeenpresentedtoidentifytheconditionsunderwhichacorrecttranslationofagivenviewupdateexists.Oursolutionisgeneral.Itcouldbeusedbyanupdatetranslationsystemssuchas[4]toidentifythetranslatableupdatebeforetranslationofitisat-tempted.Thiswaywewouldguaranteethatonlya\well-behaved"viewupdateispasseddowntothenexttranslationstep.[4]assumestheviewisalwayswell-formed,thatis,joinsarethroughkeysandforeignkeys,andnestingiscontrolled 14LingWangandElkeA.Rundensteinertoagreewiththeintegrityconstraintsandtoavoidduplication.Theupdateoversuchaviewisthusalwaystranslatable.Ourworkisorthogonaltothisworkbyaddressingnewchallengesrelatedtothedecisionoftranslationexistencewhencon°ictsarepossible,thatisaviewcannotalwaysbeguaranteedtobewell-formed(asassumedinthispriorwork).Ourviewupdatabilitycheckingsolutionisbasedonschemareasoning,thusutilizesonlyviewanddatabaseschemaandconstraintsknowledge.Notethatthetranslatedupdatesmightstillcon°ictwiththeactualbasedata.Forexample,anupdateinsertingabook(bookid=98002)toV1issaidtobeunconditionallytranslatablebyourschemacheckprocedure,whilecon°ictswiththebasedatainFig.1maystillarise.Dependingonselectedupdatetranslationpolicy,thetranslatedupdatecanthenbeeitherrejectedorexecutedbyreplacingtheex-istingtuplewiththenewlyinsertedtuple.Thisrun-timeupdatabilityissuecanonlyberesolvedatexecutiontimebyexaminingtheactualdatainthedatabase.References1.A.M.Keller.TheRoleofSemanticsinTranslatingViewUpdates.IEEETrans-actionsonComputers,19(1):63{73,1986.2.S.Banerjee,V.Krishnamurthy,M.Krishnaprasad,andR.Murthy.Oracle8i-TheXMLEnabledDataManagementSystem.InICDE,pages561{568,2000.3.T.Barsalou,N.Siambela,A.M.Keller,andG.Wiederhold.UpdatingRelationalDatabasesthroughObject-BasedViews.InSIGMOD,pages248{257,1991.4.V.P.Braganholo,S.B.Davidson,andC.A.Heuser.OntheUpdatabilityofXMLViewsoverRelationalDatabases.InWEBDB,pages31{36,2003.5.M.J.Carey,J.Kiernan,J.Shanmugasundaram,E.J.Shekita,andS.N.Subrama-nian.XPERANTO:MiddlewareforPublishingObject-RelationalDataasXMLDocuments.InTheVLDBJournal,pages646{648,2000.6.J.M.ChengandJ.Xu.XMLandDB2.InICDE,pages569{573,2000.7.U.DayalandP.A.Bernstein.OntheCorrectTranslationofUpdateOperationsonRelationalViews.InACMTransactionsonDatabaseSystems,volume7(3),pages381{416,Sept1982.8.J.Shanmugasundarametal.RelationalDatabasesforQueryingXMLDocuments:LimitationsandOpportunities.InVLDB,pages302{314,September1999.9.M.Fernandezetal.SilkRoute:AFrameworkforPublishingRelationalDatainXML.ACMTransactionsonDatabaseSystems,27(4):438{493,2002.10.M.Rys.BringingtheInternettoYourDatabase:UsingSQLServer2000andXMLtoBuildLoosely-CoupledSystems.InVLDB,pages465{472,2001.11.I.Tatarinov,Z.G.Ives,A.Y.Halevy,andD.S.Weld.UpdatingXML.InSIGMOD,pages413{424,May2001.12.L.Wang,M.Mulchandani,andE.A.Rundensteiner.UpdatingXQueryViewsPublishedoverRelationalData:ARound-tripCaseStudy.InXMLDatabaseSymposium(VLDBWorkshop),pages223{237,2003.13.L.WangandE.A.Rundensteiner.UpdatingXMLViewsPublishedOverRela-tionalDatabases:TowardstheExistenceofaCorrectUpdateMapping.TechnicalReportWPI-CS-TR-04-19,ComputerScienceDepartment,WPI,2004.14.X.Zhang,K.Dimitrova,L.Wang,M.EL-Sayed,B.Murphy,L.Ding,andE.A.Rundensteiner.RainbowII:Multi-XQueryOptimizationUsingMaterializedXMLViews.InDemoSessionProceedingsofSIGMOD,page671,2003.

Related Contents


Next Show more