您好,欢迎访问三七文档
ConstraintProgrammingandDatabaseQueryLanguagesParisCKanellakis?andDinaQGoldin?BrownUniversity,Providence,RI02192,USAAbstract.ThedeclarativeprogrammingparadigmsusedinconstraintlanguagescanleadtopowerfulextensionsofCodd’srelationaldatamodel.Thedevelopmentofconstraintdatabasequerylanguagesfromlogicaldatabasequerylanguageshasmanysimilaritieswiththedevelop-mentofconstraintlogicprogrammingfromlogicprogramming,butwiththeadditionalrequirementsofdatae cient,set-at-a-time,andbottom-upevaluation.Inthisoverviewofconstraintquerylanguages(CQLs)we rstpresenttheframeworkof[41].Theprincipalideaisthat:\thek-tuple(orrecord)datatypecanbegeneralizedbyaconjunctionofquanti er-freeconstraintsoverkvariables.Thegeneralizationmustpre-servevariouslanguagepropertiesoftherelationaldatamodel,e.g.,thecalculus/algebraequivalence,andhavetimecomplexitypolynomialinthesizeofthedata.Wenextpresentanalgebrafordenseordercon-straintsthatissimplertoevaluatethanthecalculusdescribedin[41],andwesharpensomeoftherelateddatacomplexitybounds.WenotethatCQLsareapplicabletospatialdatabases.Thisisbecausetheselanguageshave\spatialpointsetasthesemanticsoftheirrecorddatatypeandbecauseexistingmulti-dimensionalsearchingdatastructurescansupportI/Oe cientaccesstosetsofrecords.Finally,weobservethatCQLscanbeaugmentedwithcomplexobjectdatatypes,aggregateoperations,andnull-values,justliketherelationaldatamodel.1FromConstraintProgrammingtoDatabaseQuerying1.1DeclarativeProgrammingwithConstraintsConstraintprogrammingparadigmsareinherentlydeclarative,sincetheyim-plicitlydescribecomputationsbyspecifyinghowthesecomputationsarecon-strained.Programmingwithconstraintsasprimitives(orconstraintprogram-ming)isappealingbecauseconstraintsarethenormallanguageofdiscourseformanyhigh-levelapplications.Pioneeringworkinconstraintprogramminggoesbacktotheearly1960’s,e.g.,Sutherland’sSKETCHPAD[67].Thethemehasbeeninvestigatedsincethe1970’s,e.g.,inarti cialintelligence[31,54,55,66],ingraphical-interfaces[10],andinlogicprogramminglanguages[37,22,27].Therelevantliteratureandcontributionsaretoolargetoattemptasurvey.Insteadwewilllimitourexpositiontorecentapplicationsindatabases.?ResearchwassupportedbyONRgrantN00014-91-J-4052ARPAOrderNo.8225.Perhapsoneofthemostimportantadvancesinconstraintprogramminginthe1980’shasbeenthedevelopmentofConstraintLogicProgramming(CLP)asageneral-purposeframeworkforcomputations,e.g.,inCLP()[37],inPrologIII[22],andinCHIP[27,72].FormoreinformationonCLPseethesurveysin[21,51],theproceedingsoflogicprogrammingconferencesandofrecentworkshopsonthesubject,e.g.,[42].Inparticular,theadvancesinCLPareveryrelevantfordatabaseapplications(whichbringsustothesubjectofthispaper).Onereasonisthemanyconnectionsbetweendatabasesandlogicprogramming.StartingwiththeJapanese5thGenerationProject,theseconnectionswereexploredindepthduringthelastdecade.Thedeclarativestyleofdatabasequerylanguagesisanimportantaspectofdatabasesystems,thathasbeenatthecoreoftherelationaldatamodelsinceCodd’spioneeringwork[20].Indeed,havingsuchalanguageforad-hocdatabasequeryingisarequirementintoday’scommercialrelationaltechnology.QueryinginCodd’srelationalcalculusisaformoflimited(butverysuccessful)constraintprogramming.Itisrathersurprisingthatotheradvancesinconstraintprogramminghavenotyetin uenceddatabasequerylanguagedesign.However,webelievethatthiswillsoonchangeandtherewillbe(inthe1990’s)integrationofconstraintprogramminganddatabases.OneintuitivereasonforthesuccessofCLPisasfollows.Astrengthofatypicallogicprogramminglanguage(e.g.,Prolog)isitstop-down,depth- rstsearchstrategy.Theoperationof rst-ordertermuni cation,attheforefrontofthissearch,isaspecialformofe cientconstraintsolving.Additionalcon-straintsolvingincreasesthedepthofthesearchand,thus,thee ectivenessoftheapproach.Unfortunately,thebottom-upandset-at-a-timestyleofevalua-tionemphasizedinrelationaldatabases,andmorerecentlyinknowledgebases,seemstocontradictthetop-down,depth- rstintuitionbehindCLP.ThemaincontributionoftheConstraintQueryLanguage(CQL)frameworkin[41]wastodemonstratethatitispossibletobridgethegapbetween:bottom-up,e cient,declarativedatabaseprogrammingande cientconstraintsolving.OnekeyintuitioncamefromCLP:aconjunctionofquanti er-freeconstraintsoverkvariables,wherekdependsonthedatabaseschemaandnottheinstance,isthecorrectgeneralizationofthek-tupleorrecordorgroundfact.Thetechnicaltoolsforthisintegrationwere:datacomplexity[17,73]fromdatabasetheory,andquanti ereliminationmethodsfrommathematicallogic[28,29,68,23,8,48,60].Morespeci cally, niterelationsaregeneralizedto nitelyrepresentablere-lationsandappropriatealgebrasfortheirdatamanipulationcanbedevelopedinthisframework.Inmanycases,thealgebrashavepolynomialtimedatacom-plexity.Thisuseofdatacomplexity(acommontoolforstudyingexpressibilityin nitemodeltheory)distinguishestheCQLframeworkfromarbitrary(andinherentlyexponential)theoremproving[30,9,15].Example1.Letusillustratedatabasequeryingandintroducesomeofitsno-tation.Themeaninganduseis(orrathershouldbe)intuitivelyobvious.Forformalde nitionswereferthereaderto[40,69].Toseetha
本文标题:Constraint programming and database query language
链接地址:https://www.777doc.com/doc-4517620 .html