P.L. Flavours of XChange, a rule-based reactive language for the (Semantic) Web

更新时间:2023-05-12 17:54:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

FlavoursofXChange,aRule-BasedReactive

Languageforthe(Semantic)Web

JamesBailey1,Fran¸coisBry2,MichaelEckert2,andPaula-LaviniaP atr anjan21TheUniversityofMelbourne,Australia,http://www.cs.mu.oz.au/~jbailey/

2UniversityofMunich,Germany,http://pms.ifi.lmu.de/

Abstract.ThisarticleintroducesXChange,arule-basedreactivelan-guagefortheWeb.Stressingapplicationscenarios,it rstarguesthathigh-levelreactivelanguagesareneededforbothWebandSemanticWebapplications.Then,itdiscussestechnologiesandparadigmsrelevanttohigh-levelreactivelanguagesforthe(Semantic)Web.Finally,itpresentstheEvent-Condition-ActionrulesofXChange.

1Introduction

AcommonperceptionoftheWebisthatofadistributedrepositoryofhyper-mediadocuments,withclients(ingeneralbrowsers)thatdownloaddocuments,andserversthatstoreandupdatedocuments.Althoughre ectingawidespreaduseoftheWeb,thisperceptionisnotcompletelyaccurate.Infact,manyWebapplicationsrelyontheupdatingofserverdatainresponsetotherequestsofclients,orclientdatainresponsetotherequestsofservers.Indeed,therearemanykindsofreactionsforbothserversandclients,toeventsormessagesex-changedontheWeb.TheWebhasaninfrastructureforupdatesandreactivity:theprotocolHTTP.Thisarticle rstarguesthatcomplementingHTTPwithhigh-levellanguagesforupdatesandreactivityisneededforbothstandardWebandSemanticWebapplications.ItthenintroducesXChange,anovelhigh-levellanguageforEvent-Condition-Actionrulesforupdatesandreactivityonthe(Semantic)Web.

2Motivation

UpdatesontheWeb.ManyWebapplicationsbuilduponserversthatupdatedataaccordingtoclientrequestsoractions.Thisisthecasefore-Commercesystemsthatreceive,processandbuyorders,e-Learningsystemsthatselectanddeliverteachingmaterialsdependingonstudents’testperformances,andofcommunicationplatformssuchaswikis,whereseveralusersmodifythesamedocuments.Conversely,someWebapplicationsalsobuilduponclientsthatup-datedataaccordingtoserverrequests.Thisisthecasewithso-calledcookies,i.e.descriptionsonaclientofthestatesofaconnectiontoaserver,orwhenaclientkeeps,afteraconnectiontoaserver,datacollectedduringtheconnection,e.g.forarailwaysorairlineelectronicticket.

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

2

ReactivityontheWeb.ManyWebapplicationsnotonlybuildupontheupdatingofdata,butalsouponcomplexreactionstomessagesorevents,exchangednotonlybetweenclientsandserversbutalso(viaservers)betweenclients.ThisisthecasewhencontributorstoaWeb-basedcommunicationplatformareinformedofothercontributorsjoininginorleavingasession.ItisthecaseforWeb-basedbusinessmanagementsystems,suchasbusinesstravelapplicationsandplanningandreimbursementinlargecompanies,thatrelyuponcomplexwork owsofactionsandmessages,possiblyrealizedusingWebservices.ItisalsothecaseforWeb-basedsystemso eringcontext-dependentservices.e.g.atimeandlocationdependentcarparkdirectory,thatadaptstheinformationitdeliversandreactstotimechanges,withclientschangingplacesandcarparksannouncingtheirfreeparkingcapacities.

UpdatesandReactivityontheSemanticWeb.Updatesandreactivityareasmuch“SemanticWebissues”,astheyare“standardWebissues”.Theapplicationscenariosstressedabove,mightinvolvebothstandardWebandSemanticWebdataandtechniques,suchasHTML,XML,RDF,TopicMapsandOWLdata,aswellasinferencefromRDFtriples.Forexample,e-Commerceo ersmightbedescribedbyRDFmeta-dataandane-LearningsystemmightrefertoinferencerulesexpressedintermsofRDFtriples,RDFS,andOWL.

HTTP/1.1:TheInfrastructureforUpdatesandReactivityontheWeb.UpdatesandreactivityontheWebarerealizedusingHTTP/1.1,thecurrentversionoftheHypertextTransferProtocol.HTTP’scommunicationparadigmisaclient-servermodelofrequest-responseinteractionso eringamongothers,therequestsGET(bywhichaclientcanretrievefromaserver,informationidenti edbyaURI)andPOST(bywhichaclientcansubmitinformationtoan“entity”onaserveridenti edbyaURI).HTTPhasrolesfor(software)intermediariessuchasproxies,gateways,andtunnels,givingrisetothespeci cationofvariousformsofcommunication.HTTPhastwokindsofmessages:requestsandresponses.Messageheadersgiverisetothespeci cationofnetworkcommunicationandsystemparameters(e.g.whetherthemessagesenderwantstoclosetheconnec-tion),cachingdirectives,encodinginformation(e.g.indicatingthatthemessagebodyisencodedusingthegzip leformat),communicationprotocolsotherthanHTTP/1.1acliento erstheservertouse,thelengthofthemessagebody,abaseforrelativeURIsreferredtoinamessagebody,etc.

High-LevelLanguagesforUpdatesandReactivityontheWeb.AlthoughHTTP/

1.1canhelpimplementupdatesandreactivityontheWeb,asneededbytheafore-mentionedapplications,moreabstractandhigher-levellanguagesareneed-edthat(1)abstractawaynetworkcommunicationandsystemissues,(2)easethespeci cationofcomplexupdatesofWebresources(e.g.XML,RDF,andOWLdata),(3)areconvenientforspecifyingcomplex owsofactionsandreactionsontheWeb.Theneedforhigh-levelWebupdateandreactivitylanguagesissimilartotheneedforhigh-level(Semantic)Webquerylanguages(cf.[2]forasurvey).High-levelreactivitylanguageswillcomplement,notreplaceHTTP.Indeed,thesimplestandthereforemostdesirablewaytoimplementahigh-levelreactivitylanguageforthe(Semantic)Web,istouseHTTP/1.1.

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

3

3TechnologiesandParadigms

AtomicEvents,EventMessages,andCompositeEvents:WebandSemanticWebapplicationsrequireanumberofdi erentkindsofatomicevents:i)eventsex-changedbetweenWebnodes,tomakeitpossibleforaWebnodetotriggerre-actionsatremoteWebnodes,ii)eventslocaltoaWebnode,tohelpexpresslocalreactivity,e.g.localupdates,andiii)systemevents,makingitpossibleforreactiontothefunctioning,ornon-functioning,oftheencompassing“sys-tem(s)”,e.g.theoperatingsystemofanodeorofthenetwork.AsimpleandnaturalassumptionisthateventsexchangedbetweenWebnodesareexpressedaseventmessages,expressedinaWebformatsuchasXML.Reactingtocompos-ite(orcomplex)events,plexeventshavereceivedconsiderableattentioninthe eldofactivedatabases,cf.e.g.[16,14].How-ever,di erencesbetween(generallycentralised)activedatabasesandtheWeb,wherecentralclockandmanagementaremissingandmessagedeliveriesbetweenWebnodescanbedelayed,necessitatenewapproaches.Furthermore,compositeeventsre ectingauser-centered,andnotasystem-centeredviewareneededontheWeb.

EventMessagesvs.WebResources.EventmessagesandstandardWebresourcesshouldbekeptintwoseparatedatakinds,sinceotherwisethedevelopmentofthereactiveWebmaybeinsu cientlydistinguishablefromthe(Semantic)Web.Inshort:NoURIsforeventmessages!

TemporalDependenciesoftenhavetobeexpressedwhencompositeeventsarespeci ed.Anapplicationexamplemightbe“dependonaneventE1occurringbeforeaneventE2”,or“dependonaneventE3occurringwithinatimeinterval”.Thus,areactivelanguagerequiressophisticatedtemporalnotionsandtemporaleventcompositionconstructs.

Event-Condition-ActionRules,(ECArules) twellwiththewidespreadandintuitiveviewoftheWebasadistributedrepositoryofdocumentsmentionedabove.Indeed,ECArulesbuildonqueriesbytheuseof“conditions”.Thus,ECArulesbuildingonaWeborSemanticWebquerylanguageareaverynaturalparadigmforupdatesandreactivityontheWeb.Updatesandreactivitypertaintoimperativeprogramming,becausetheyrefertostatechangesontheWeb.Arguably,ECArulesbuildingonaWebquerylanguagearemoreconvenientforreactivityontheWeb,thanconventionalimperativeprogramminglanguages.DistributedProcessingandCommunication.OntheWeb,reactiveprogramscallfordistributedprocessing.Arguably,reactivelanguagesmakingeachWebnodecapableofcontrollingitsownreactivebehaviour,would tthede-centralisedmanagementofthe(Semantic)Web.

4XChangeinaNutshell

XChangeisalanguageofECArules.Eachruleconsistsofthreeparts:(1)aneventquery,alsocalled“event”,accessing(localorremote)eventmessagesand(local)systemevents,(2)aWebqueryrefereedtoasthe“condition”accessing

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

4

standardWebdata,and(3)an“action”expressing(3.a)singleupdates,(3.b)transactionsi.e.agroupofactionstoberealizedinanall-or-nothingmanner,or(3.c)messagestobesenttoWebnodes.

TheatomiceventsofXChangearehappenings(e.g.anupdateofapossiblyremoteWebresource)towhicheachWebnode(throughareactiveprogram)mayormaynotreact.XChangedistinguishesbetweentwokindsofatomicevents:ex-pliciteventsandimplicitevents.ExpliciteventsareexplicitlyraisedbyauserorbyanXChangeprogramataWebnodeandsenttothisand/orotherWebnodesaseventmessages.XChange’seventmessagesare(arbitrary)XMLdocumentswithinaneventmessageenvelopeexpresseditselfasa(speci c)XMLdocument.Anenvelopementionsatleastthesender,arecipient,and,uponreceptionataWebnode,thereceptiontime.Anenvelope,mightinaddition,mentionotherrecipientsandtheevent’sraisingtime(atthesender’snode).Figure2presentsanenvelopeinthetermsyntaxofXcerpt[5,2,18]andXChange.ThissyntaxisaslightvariationoftheXMLsyntaxwithunlabeledparenthesesinsteadofla-beledtagsandelementnamesoccurringimmediatelybeforetheparentheses,e.g.article[title{"FlavourofXChange"},body[...]]isthetermsyntaxfortheXMLdocumentofFigure1.Figure2presentsanXChangeeventmes-<article>

<title>FlavourofXChange</title><body>...</body>

</article>

Fig.1.

sage(notethenamespacepre xxchange).Therespectivemeaningsofthesquarebrackets[]andcurlybraces{}areexplainedinSection5.Nestingmessageswiththeirformerenvelopesmakeitpossibletotracktheoriginofmessages,removingenvelopesbeforeforwardingmessageshidestheirorigin.

xchange:event{

xchange:sender{"http://www.pms.lmu.de/"},

xchange:recipient{""},

xchange:recipient{"http://www.cs.mu.oz.au/~jbailey/"},

xchange:raising-time{"2005-06-29T18:15:00"},

info{"HereisanarticleforRuleML’06!"],

article[title{"FlavourofXChange"},authors[...],body[...]]}

Fig.2.AnXChangeEventMessage

ImpliciteventsarelocaleventssuchasupdatesoflocalWebresourcesandsystemclockevents.Theyarenotexpressedthrougheventmessages.EventsaretransmittedfromoneWebnodetoanotherviaeventmessages.Thus,positeeventsarede nedinXChangeasanswersofcompositeeventqueries,cf.Section6.

XChangemakesastrictdistinctionbetweenpersistentdata,i.e.Webre-sources,3andvolatiledata,i.e.byde nitionevents.XChangereliesonthequery3AWebresourcemightbecomputedonrequestfromotherresources,usinge.g.views,andthereforebemore“dynamic”than“persistent”.XChange’sdistinctionbetweenWebresourcesandeventsisnota ectedbytheexistenceof“dynamic”resources.

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

5

languageXcerpt[5,2,18]foraccessingpersistent,i.e.Web,data.XChangeusesanovelquerylanguageespeciallytunedtoeventsforaccessingvolatiledata,i.e.events.ThiseventquerylanguagebuildsuponXcerptandextendsitwithconstructsfortemporaleventcomposition.EventmessagescanbeturnedintoWebresources,andWebresourcesmightbeincludedineventmessages.ThemetaphorforXChange’sdistinctionbetween“volatiledata”orevents,versus“persistentdata”orWebresources,isthatofspeechvs.writtentext:Speechcannotbestoredandcannotbeupdatedonceproduced,butonlycompletedbyfurtherspeech,whilstwrittentextcanbestoredandupdated.However,(non-storable,non-updatable)speechcanbeturnedinto(storableandupdatable)writtentext.

XChange’seventqueryevaluationisnotbasedoneventconsumption:aneventalreadyusedinansweringaneventquerycanbeusedforansweringanothereventquery.XChangesupportsalimitedformofeventselection[19]withthetemporalrangesofitseventqueries.Theauthorsbelievethatrejectingeventconsumptionandinsteadusing“pure”eventselection,greatlycontributestomakingtheeventquerylanguageclosertodatabaseandWebquerylanguages,especiallyXcerpt,thusmakingprogramminginXChangeeasier.NotethateventconsumptionandselectionstrategiescaneasilybeimplementedusingXChangerules.

XChange’scommunicationmodelispeer-to-peer,i.e.allWebnodes,whethertheybeclientsorserversaccordingtoHTTP,havethesamecommunicationcapabilitiesandeverypartycaninitiateacommunicationwitheveryotherWebnode.Twobasiccommunicationstrategiesarepossibleonanetwork:apushstrategywheresendersinformrecipientsofmessagestheywanttosendtothem,andapullstrategywhere(potential)recipientskeepqueryingall(potential)sendersformessages.Arguably,thepullstrategyisconvenientforquerying(persistent)Webresources,whilethepushstrategyisconvenientforquerying(volatile)events.XChangereliesonthepushstrategyforeventqueriesandonthepullstrategyforWebresourcequeries.4XChange’smessagecommunicationisasynchronous,i.e.XChange’s‘sendoperation’isnon-blocking:theexecutionofanXChangeprogramimmediatelycontinuesaftera‘sendoperation’withoutwaitingforthemessagetransmission,anacknowledgementofreceipt,orareply.NotethatblockingsendingcaneasilybeimplementedusingXChangerules.

XChangeprogramsareprocessedinadistributedmanner,each(XChange-aware)Webnodeprocesses,possiblybydelegationtoanotherWebnode,theXChangeprogramslocallyspeci ed.XChangereliesneitheron“super-peers”,noroncentralservices,suchasacentralsynchronizationpoint.

XChangeensuresalocalcontrolofevents,aswellasofeventmemorisation.AWebnodemightrejectanupdaterequestfromaremoteWebnode(sentin4Pushcommunicationcanbesimulatedinapullcommunicationframeworkby“con-tinuousqueries”,i.e.potentialrecipientsperiodicallypollingallpotentialsenders.Thissimulationhasseveredrawbacks:Increasednetworktra c,delayedreceptions,communicationinitiatedbypotentialrecipientsandnotactualsenders,potentialrecipientsmustbeawareofallpotentialsenders,etc.

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

6

aneventmessage),e.g.becauseofalackofcredentials.Furthermore,theeventsmemorizedataWebnodeonlydependontheXChangeeventqueriesposedatthatnode.Thetimeduringwhichanatomicevent,e.g.aneventmessageoralocalimplicitevent,iskeptinmemoryataWebnode,onlydependsontheeventqueriesposedatthatnode.Bydesign,XChangecompositeeventqueriescanbeevaluatedwithoutkeepinganyeventforeverinmemory.Ifthisisnecessaryforsomeapplications,(volatile)eventsshouldbeexplicitlystoredas(persistent)Webresources.

XChangeeventquerieshaveadeclarativesemanticsexpressedintermsofaTarski-stylemodeltheory,i.e.recursivelyonthestructureofcompositeeventqueries,makingthemeasytounderstandandtoimplement.XChangeeventqueryevaluationisdata-driven,incomingeventsareusedforincrementallyeval-uatingqueries.Incontrast,theevaluationofqueriesagainstWebresources,e.g.XcerptqueriesandXChangeconditions,isingeneralquerydriven.

5ConditionsorWebQueries

TheconditionpartsofXChangerulesareexpressedinXcerpt[5,2,18],aWebandSemanticWebquerylanguage.Xcerpthasquerypatterns,calledqueryterms,forqueryingWebresources,andconstructionpatterns,calledconstructterms,montoquery,construct,anddataterms,isthattheyrepresentgraphs,i.e.ID/IDREFandotherXMLreferencesaredereferencedbyXcerpt.ThechildrenofthenodeofanXMLdocumentmightbeeitherorderedorunordered,i.e.duringqueryingwithXcerpt,theirordermightbemodi ed.InthetermsyntaxofXcerpt,anorderedtermspeci cationisdenotedbysquarebrackets[],anunorderedtermspeci cationbycurlybraces{}.

bib{massimo@person{first{"Massimo"},last{"Benedetti"}},

article{title{"QueryingXML"},authors{^massimo}},

article{title{"UpdatingXML"},authors{^massimo}}}

Fig.3.AXcerptDataTerm

DataTermsrepresentWebresources,i.e.XMLdocuments.InanXcerptpro-gram,theWebresourcestobequeriedarespeci edusingthekeywordresource,followedbytheURIsoftheresources.Figure3presentsanXcerptdatatermdescribingabibliography.Notethede ningoccurrencemassimo@...andthereferencingoccurrence^massimoofthereference,orpointer,massimo.

QueryTermsare(possiblyincomplete)patternsthatarematchedagainstWebresources.Bothpartial(i.e.incomplete)ortotal(plete)querypatternscanbespeci ed.Aquerytermtusingapartialspeci cation(denotedbydoublesquarebrackets[[]]orcurlybraces{{}})foritssubterms,matcheswithallsuchtermsthat(1)containmatchingsubtermsforallsubtermsoftandthat(2)mightcontainfurthersubtermswithoutcorrespondingsubtermsint.Incontrast,aquerytermusingatotalspeci cation(denotedbysinglesquarebrackets[]orcurlybraces{})doesnotmatchwithtermsthatcontainadditionalsubterms

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

7

withoutcorrespondingsubtermsint.Querytermscontainvariablesforselectingsubtermsofdatatermsthatareboundtothevariables.Variablerestrictionscanbeexpressedusingthe->construct(readas),whichrestrictthebindingsofthevariableattheleftof->tothosetermsmatchingwiththequerytermattherightof->.Figure4presentsaquerytermretrievingtheauthorsofarticleslistedinthedatatermofFigure3at.

in{resource{""}

bib{{article{{varWrote->authors}}}}}

Fig.4.AXcerptQueryTerm

Xcerptquerytermsmayuseadditionalconstructslikesubtermnegation(key-wordwithout),optionalsubterms(keywordoptional),anddescendant(key-worddesc)[18].Querytermsare“matched”againstdataorconstructtermsbyanon-standarduni cationmethodcalled“simulationuni cation”[6].

ConstructTermsservetoreassemblevariables(thebindingsofwhicharespec-i edinqueryterms)soastoconstructnewterms.Theyaresimilartodataterms,butareaugmentedbyvariables(actingasplaceholdersfordataselectedbyaquery)andthegroupingconstructsall(whichservetocollectallinstancesthatresultfromdi erentvariablebindings)andsomeorsomenwhichservetocollectoneorn(non-deterministicallychosen)instancesresultingfromdi erentvariablebindings.Occurrencesofall,some,orsomen,maybeaccompaniedbyanoptionalsortingspeci cation.

Construct-QueryRulesrelateaconstructterm(introducedbythekeywordCONSTRUCT)toaquery(introducedbythekeywordFROM)consistingof“and”and/or“or”connectedqueryterms.Queriesorpartsofaquerymaybefurtherrestrictedbyconstraints(e.g.arithmeticconstraints),inaso-calledconditionbox(introducedbythekeywordwhere).Agoalislikearule,exceptforthekeywordCONSTRUCTreplacedbyGOAL.Goalsspecifydatatobecomputedanddelivered,whilerulesspecifypossibleintermediatecomputations.A(query)pro-gramconsistsofoneormorerulesandofatleastonegoal.Xcerptrulesmaybechainedtoformcomplexqueryprograms,i.e.rulesmayquerytheresultsofotherrules.MoreonXcerptcanbefoundat[5,18].

6

6.1EventQueriesSyntaxofAtomicEventQueries

AtomicEventQueriesarepatternstobe“matched”againstincomingevents(attheWebnodewheretheatomiceventqueryisevaluated).TheyareinXChangeliketheyareinXcerpt,queryterms,theonlydi erencebeingthateventquerytermsneverrefertoaWebresource,unlikeXcerptqueryterms(recall:NoURIsforeventmessages!).Figure5presentsanatomiceventquery(watchingeventsannouncing ightcancellationsforMassimoBenedetti)withinanXChangerule(theactionandconditionofwhicharenotgiven).

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

8

RAISE

<action>

ON

xchange:event{{

flight-cancellation{{

flight-number{varNb},

passenger{{name{first{"Massimo"},last{"Benedetti"}}}}}}

}}

FROM

<condition>

END

Fig.5.AnAtomicEventQueryWithinanXChangeRule

6.2SyntaxofCompositeEventQueries

ACompositeEventQueryconsistsof(1)aconnectionof(atomicorcompos-ite)eventqueries(possiblywithwhereclauseslimitingvariablebindings)witheventcompositionoperatorssuchasand,andthen,or,andwithoutand(2)positeeventsareonlyde nedasanswersto,positeeventsdonothavetimestamps,incontrasttoeventmes-sages,i.e.atomicevents.Instead,acompositeeventinheritsfromitscomponentsabeginningtime(thereceptiontimeofthe rsteventmessagereceivedthatcon-tributestothecompositeevent)andanendingtime(thereceptiontimeofthelasteventmessagereceivedthatcontributestothecompositeevent).

Thefollowingnotations,possiblywithindices,areusedintherestofthesection:AtomicEventQuery,CompositeEventQuery,EventQuery(anatomicorcompositeeventquery),TimePoint,AbsTimeRange(anabsolutetimerange,i.e.ananchored nitetimeintervallikee.g.“fromJune3,2005toJuly4,2005”),RelTimeRange(arelativetimerange,i.e.anunanchored nitetimeintervallikee.g.“3days”),andTimeRange(anabsoluteorrelativetimerange).

6.2.1TemporalRanges

ATemporalRangeisatimeintervalduringwhichacompositeeventqueryistobeevaluated,i.e.onlyeventsreceivedduringthistimeintervalmightberelevanttotheeventquery.TemporalrangesarenecessaryforensuringthatnoeventsreceivedbythisnodemighthavetobekeptforeverforansweringsomecompositeeventqueriesposedatthisWebnode.Atemporaltimerangecanbeabsoluteorrelative.

aAnabsolutetemporalrangehaseithertheforminAbsTimeRange,ortheformbeforeTimePoint.Figure6presentstwocompositeeventqueriesthatdetectnewdiscountsfor ightsfromMunichtoParis.

ThecurrentprototypeimplementationofXChangeacceptstimepointsex-pressed,likeintheexamplesofFigure6,usingthe“restrictedpro le”ofISO8801[17],possiblyleavingoutthe“timezonedesignator”(thenconsideringim-

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

9

plicitlythetimezoneoftheWebnodeevaluatingtheeventquery).XChangehasadditionalconstructsbywhichonecande neabsolutetemporalrangesre-ferringtotheraisingorreceptiontimesofatomicevents,ortothebeginningorending(raisingorreception)timesofcompositeevents.Ifatemporalrangecanbederivedfromthetemporalrangesofthecomponentsofacompositeeventquery,thennoexplicittemporalrangeneedbespeci edforthisquery.xchange:event{{

flight{{

from{"Munich"},

to{"Paris"},

new-discount{varD}

}}

}}before"2005-08-10T14:00:00"xchange:event{{flight{{from{"Munich"},to{"Paris"},new-discount{varD}}}}}in["2005-08-10","2005-08-31"]

positeEventQuerieswithAbsoluteTemporalRanges

bArelativetemporalrangehastheformwithinDuration.Thecurrentim-plementationofXChangeacceptsdurationsexpressedasnumbersofyears,days,hours,minutesandseconds.Figure7presentsa(composite)eventquerywitharelativetemporalrange.

6.2.2EventCompositionOperators

aNon-TemporalEventCompositionOperators

a.1Conjunctionsofeventqueriesareusedfordetectinginstancesforeachspeci edeventqueryregardlessoftheirorder.Theyhavetheform:

and{EventQuery1,...,EventQueryn}

a.2InclusiveDisjunctionsofeventqueriesareusedfordetectinginstancesforoneofthespeci edeventqueries.Theyhavetheform:

or{EventQuery1,...,EventQueryn}

Ananswertothiseventqueryisthe rstanswerofoneoftheEventQueryitheevaluationofwhichcanbecompletedusingtheeventsreceivedsofar.bTemporalEventCompositionOperators

Thereceptiontimeofincomingatomiceventsdeterminesthetemporalorderofeventsthatthetemporaleventcompositionoperatorsreferto(theraisingtimeisanotheralternativecurrentlybeinginvestigated).ThetemporaleventcompositionoperatorsofXChangeinclude:orderings,eventexclusions,multipleselectionsandexclusions,branchings,andoccurrences.

b.1Orderings

b.1.1Temporallyorderedconjunctionsofeventqueriesdetectsuccessively,intermsoftheeventtemporalorder,instancesofevents.Theyhavetheforms:andthen[EventQuery1,...,EventQueryn]

andthen[[EventQuery1,...,EventQueryn]]

Atotalspeci cation(using[])expressesthatonlyinstancesoftheEventQueryi(i=1,...,n)areofinterestandareincludedintheanswer.Instancesofother

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

10

eventsthatpossiblyhaveoccurredbetweentheinstancesoftheEventQueryiarenotofinterestand,thus,arenotcontainedintheanswer.Incontrast,apartialspeci cation(using[[]])expressesinterestinallincomingeventsthathavebeenreceivedbetweentheinstancesoftheEventQueryi.Thus,alltheseinstancesarecontainedintheeventquery’sanswer.Figure7presentsaneventquerythatdetectsnoti cationsof ightcancellationsthatarefollowed,withintwohoursofreception,bynoti cationsthattheairlineisgrantingnoaccommodation.andthen[

xchange:event{{xchange:sender{""},

cancellation-notification{{flight{{number{varNb}}}}}}},xchange:event{{xchange:sender{""},

important{"Accommodationnotgranted!"}}}

]during2hours

Fig.7.ATemporallyOrderedConjunctionEventQuery

b.1.2Overlappingsofcompositeeventqueriesdetectinstancesofeventqueriesthatoverlaponthetimeaxisoftheincomingevents.

EventQuery1andEventQuery2overlapifthebeginningtimeofEventQuery1isbeforethebeginningtimeofEventQuery2andtheendingtimeofEventQuery1isafterthebeginningtimeofEventQuery2,orviceversa.

Orderedandunorderedspeci cationsarepossibleforoverlappingofcompos-iteeventqueries,i.eonehasthepossibilitytoexpressthatthetemporalorderisofimportanceornot.Thus,overlappingshavetheforms:

overlap[EventQuery1,EventQuery2]

overlap{EventQuery1,EventQuery2}

b.1.3Meetsforcompositeeventqueriesdetecteventqueryinstanceswhosecomponents“meet”onthetimeaxisoftheincomingevent.EventQuery1meetsEventQuery2iftheendingtimeofEventQuery1isthesameasthebeginningtimeofEventQuery2,orviceversa.Asforoverlappingsofcompositeeventqueries,orderedandunorderedspeci cationsarepossible.Thekeywordforthiseventcompositionoperatorismeet.

b.1.4Overlappingsormeetsforcompositeeventqueries,detecteventqueryinstanceswhosecomponentsoverlapormeetonthetimeaxisoftheincomingevents.overlap-or-meetisthekeywordforthiseventcompositionoperator.b.1.5Inclusionsforeventqueriesdetectinstancesofeventsthathaveoccurredduringthetimeintervaldeterminedbythebeginningtimeandendingtimeofaninstanceofacompositeeventquery.Thekeywordforthiseventcompositionoperatorisinclude.ThisoperatorisAllen’sduringrelation[1].

b.2EventExclusions

Theeventexclusionoperatorenablesthemonitoringofthenon-occurrenceof(atomicorcomposite)eventqueryinstances.i.e.toexpresseventqueriesexclud-ingsomeeventqueryinstances.Eventexclusionsquerieshaveoneoftheforms:CompositeEventQuerywithoutEventQuery

withoutEventQueryAbsTimeRange

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

11

Figure8presentsaneventexclusionquerydetectingifthenoti cationofanonlinereservationmadeon10thofAugust2005isnotreceivedwithintendays.withoutxchange:event{{

online-reservation-notification{{}}

}}in["2005-08-10","2005-08-20"]

Fig.8.AnEventExclusionQuery

b.3MultipleSelectionsAndExclusionsforeventquerieshavetheforms:mofEventQuery1,...,EventQuerynAbsTimeRange

atleastmofEventQuery1,...,EventQuerynAbsTimeRange

atmostmofEventQuery1,...,EventQuerynAbsTimeRange

The rstformrequires1≤m≤n.Itdetectsinstancesofmofthespeci edeventqueriesandthenon-occurrenceofinstancesofthen meventqueries,withinthegiventimeinterval.Theotherformsareself-explanatory.Multipleselectionandexclusionseventqueriesmustalwaysbeaccompaniedbythespeci cationofanabsolutetimerangeinwhichinstancesofthespeci edeventqueriesaretobemonitored.Notethatifm=1,the rstformisequivalenttoanexclusivedisjunction.Figure9presentsacompositeeventdetectingnoti cationsofeithercancellationorofanin-timedeparturefora ight.

1of{xchange:event{{xchange:sender{""},

cancellation-notification{{varFlight->

flight{{number{"AI2021"},date{"2005-08-10"}}}}}

}},

xchange:event{{xchange:sender{""},

in-time-departure-notification{{varFlight}}}}

}before"17:00"

Fig.9.AMultipleSelectionsAndExclusionsEventQuery

b.4Branchings

b.4.1Anif-then-elseeventcompositionoperatorgivesrisetoquerydi erenteventinstances,dependingwhetheraninstanceofaneventquery(speci edintheifpart)hasoccurredornot.

b.4.2Thecaseeventcompositionoperatorgeneralizestheif-then-elseoper-ator.Anoptionalelsepartcanbespeci edfordetectingeventqueryinstancesifnoneoftheeventqueriesofthecasepartcouldbeanswered.

b.5Occurrences

b.5.1Quanti cationsofeventqueriesservetodetecteventqueryinstancesoccurringatleast,atmost,orexactlyagivennumberoftimesinatimerange.Quanti cationshavetheforms:

ntimesEventQueryTimeRange

atmostntimesEventQueryTimeRange

atleastntimesEventQueryTimeRange

Figure10presentsacompositeeventquerymakingitpossibletoreactonlyafterthreeidenticalnoti cationsfromasecretariespoolwithin2hours.

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

12

atleast3timesxchange:event{{

xchange:sender{"/secretaries/"},

varNotification->important{{}}

}}within2hours

Fig.10.AnEventQuerySpecifying3OccurrencesofASameNoti cation

b.5.2Ranksservetodetectinstancesofeventquerieswithagivenposition,orrank,inthe positeeventquerieswithrankshavetheforms:EventQuerywithranknTimeRange

lastEventQueryTimeRange

Negativeranksdenoteeventqueryinstancescountedfromtheendoftheeventquerysequence,with 1denotingthelastoccurrence.Eventquerieswithlastornegativeranksmusthaveatimerangesoastodeterminethelastincomingevent.Figure11presentsaneventquerydetectingthelastnoti cationbefore10:00ofadelayedarrival.

lastxchange:event{{

xchange:sender{""},delay-notification{{varNotif}}}}before"10:00"

Fig.11.AnEventQueryWithRank

b.5.3Repetitionsareusedtodetecte.g.everysecond,third,etc.instancesofaspeci edeventqueryinagiventimerange.Theyhavetheform:

everynEventQueryTimeRange

Figure12presentsacompositeeventquerymakingitpossibletoreactonlytoeveryfourthmessagelabeledimportantfromthesecretariespoolwithinaworkday,atemporaltypede nedusingthecalendarsystemCaTTS[4],theintegrationofwhichwithXChangeiscurrentlyunderway.

every4xchange:event{{

xchange:sender{"/secretaries/"},important{{}}}}withinworkday

Fig.12.AnEventQuerySpecifyingaRepetition

6.3SemanticsofEventQueries

XChangeeventquerieshaveadeclarativesemantics[9]de nedintermsofaTarski-stylemodeltheory,i.e.thevaluationofacompositeeventquerywithre-specttoastreamofincomingeventsisde nedrecursivelyonaquery’sstructure.Ananswertoaneventquery,i.e.aneventqueryinstance,cantaketwoforms:aneventstreamformanda“resource”form.

Theeventstreamformofaneventqueryinstance,isthestreamofeventsselectedfromtheincomingstreambytheeventquery.Thisformensurestheanswer-closednessoftheeventquerylanguage,i.e.answersareofthesamekindasthedataqueried.Answer-closednessisanecessaryfeatureformodularprogramsspecifyingcomputationsinastepwisemanner.

The“resource”formofaneventqueryinstanceisanXMLdocument(storableasaWebresource,hencethename)structuredaftertheeventqueryandex-pressedeitherinthetermsyntaxorintheXMLsyntaxofXChangeeventqueries.

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

13

The“resource”formofaneventqueryinstanceisobtainedbybindingavariableusingtheXcerpt->(‘as’)constructtotheeventquery,thus“resource-ifying”eventqueryinstances.Thisvariableservesasa“handle”for“resource-ifying”eventinstancesandthusmakingthemusableinthe“condition”and/or“action”ofanXChangerule.“Resource-i cation”ofeventqueryinstancesisneededbe-causeofXChange’sposition:“NoURIsforeventmessages!”

XChangeeventquerieshaveaproceduralsemanticswhichisdatadriven,i.e.theevaluationofacompositeeventqueryisperformedincrementally,usingtheatomiceventsastheyarereceived.Theproceduralsemanticsissoundandcompletewithrespecttothedeclarativesemantics.

7Actions

TheactionofanXChangerulecanbe(1)thespeci cationof(oneormore)eventstoraise,i.e.thespeci cationofeventmessagestosendto(oneorsev-eral)Webnodes,(2)(oneormore)updaterequeststo(oneorseveral)Webnodes,or(3)(oneormore)transactions,i.e.groupsofeventstoraiseand/orupdaterequeststoperforminanall-or-nothingmanner:Thenoti cationbyaremoteWebnodeoftherejectionofapartofatransaction,isinterpretedbythe(XChange-aware)Webnodethathademittedthetransactionastherejectionofthewholetransaction.Speci ctransactionaleventmessagesareprovidedfornotifyingtherejectionofupdaterequestsortransactions.

XChangetransactionsobeytheACIDproperties[15]andTheycanbecalledweakbecause,incontrasttodatabasesystems,XChangedoesnotautomaticallyroll-backrejectedtransac-tions,butleavesthistasktotheWebnodethatemittedthetransaction,whereitcanbeimplementedwithspeci cXChangerules.ThisisconsistentwiththeXChangecommunicationmodeldiscussedinsection4,especiallywithXChange’snon-blocking‘sendoperation’,andwithXChange’slocalcontrolofeventsmen-tionedinsection4.ThedatabasesystemsstyleofautomaticrollbackwouldcontradictthesetwoparadigmsofXChangeandthede-centralisedmanagementoftheWeb.

XChangeupdaterequestsareexpressedbyupdatetermsbuiltupfromXcerpt’squeryandconstructterms:subtermdeletionsarespeci edsimilarlytoXcerptqueryterms,soastomakepossibleintensionalspeci cationsofdeletions,sub-terminsertionssimilarlytoXcerptconstructterms.Figure13presentsacom-positeaction(1)cancelingallappointmentsofBenedettionthe10thofAugust2005,(2)notifyingviaemailallthepersonsconcernedbythecancellations,and

(3)insertingannovelappointmentforBenedettionthatsameday.Notethein-tensionalspeci cationofthedeletionsusingthevariablesDelAppandEmailAdd,thegroupingall,andthetemporallyorderedconjunctionandthen[...]speci-fyinginwhichorderthethreeactioncomponentsshouldbeperformed.Enclosingancompositeactioninatermlabeledtransactionmakesitatransaction.

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

14

andthen[

in{resource{"organizer:///~benedetti/"},

organizer{{deletevarDelAppappointment{

receiving{last{"Benedetti"}},

visiting{{email{varEmailAdd}}},

when{{day{"2005-08-10"}}}

}}}

},

in{resource{"organizer:///benedetti/"},

organizer{{insertappointment{

receiving{first{"Massimo"},last{"Benedetti"}},

when{day{"2005-08-10"},from{"9:00"},to{"18:00"}}

}}}

},

allraise{

in{resource{"mailto:"varEmailAdd},

appointment-cancellation{varDelApp}

}

}

]

positeOrderedActionSpecifyingUpdatesandRaisingMessages8RelatedWorkAndConclusion

Allen’sTemporalRelations[1]havebeenanimportantinspirationinde ningthetemporaleventcompositionoperators.

ActiveDatabasesprototypesystemshavebeendevelopedthatprovidesophisti-catedeventalgebras,e.g.[8,7,11].Theircompositeeventshavebeenaninspi-rationforXChangeeventquerylanguage.

High-LevelReactiveLanguagesfortheWebformerlydeveloped,e.g.[13],supportsimpleupdateoperationsonXMLdocuments.Theyo ernomeanstospecifyseveralupdatestobeexecutedinagivenorderorinanall-or-nothingmanner.Otherrelatedworkcanbefoundin[12],whereXylemeisdescribed.XylemeisasystemformonitoringandsubscriptionontheWeb.AlertersmonitorsimpleupdatesofWebresources,amonitoringqueryprocessorperformsmorecomplexeventdetectionandsendnoti cationsofeventstoatriggerenginewhichper-formsactions.ThereactivefunctionalityofXylemeishighlytunedtoitsspeci capplication eld.

XChangesigni cantlydi ersfromand/orextendsovertheabove-mentionedapproacheswith(1)itsstructuredeventmessages,(2)itsdistinctionbetweenWebresourcesandeventmessages,(3)itslogicalvariablespossiblysharedbyitseventqueries,conditions,andactions,(4)itsweaktransactions,(5)itsdeclara-tivesemantics,and(6)itscommunicationanddistributedprocessingmodels.

ThisarticlehasintroducedXChange,stressingitsprinciplesandoutliningitssyntax,semantics,andprocessing.XChangeisanon-goingresearchprototype,whichwaspresentedinanearlierstatein[3].Thepresentpaperextendsthispreviouspublicationbyreportingonthenewlydevelopedtemporalcomposite

Abstract. This article introduces XChange, a rule-based reactive language for the Web. Stressing application scenarios, it first argues that high-level reactive languages are needed for both Web and Semantic Web applications. Then, it discusses technologie

15

eventoperator.On-goingworkonXChangeisdevotedtothetransactionspec-i cationlanguage,thetransactionalmessages,eventqueryoptimization,andonintegratingtheCaTTScalendrictypesystem[4].ApromisingperspectiveforfutureworkistoextendXChangewithsecurityfunctionalities,especiallyauthenticationandauthorization.TheprotocolsofaGridarchitecturesuchasGlobus[10],wouldprovidemeansforsuchanextension.Conversely,XChangecouldbeusedasthecoreofahigh-levelreactivelanguageforadvancedservicesontheGrid.

References

m.ACM,26:832–843,1983.

2.J.Bailey,F.Bry,T.Furche,andS.Scha ert.WebandSemanticWebQueryLanguages:ASurvey.InReasoningWeb,LNCS3564.Springer-Verlag,2005.

3.F.BryandP.-L.P atr anjan.ReactivityontheWeb:ParadigmsandApplicationsoftheLanguageXChange.InProc.20thAnnualACMSymp.AppliedComputing,2005.

4.F.Bry,F.-A.Rieß,andS.Spranger.CaTTS:CalendarTypesandConstraintsforWebApplications.InProc.14thIntl.WorldWideWebConference,2005.

5.F.BryandS.Scha ert.AGentleIntroductionintoXcerpt,aRule-basedQueryandTransformationLanguageforXML.InProc.Int.WorkshoponRuleMarkupLanguagesforBusinessRulesontheSemanticWeb,2002.

6.F.BryandS.Scha ert.TowardsaDeclarativeQueryandTransformationLan-guageforXMLandSemistructuredData:SimulationUni cation.InProc.Int.Conf.LogicProgramming,LNCS2401.Springer-Verlag,2002.

7.A.Buchmann,A.Deutsch,andJ.Zimmermann.TheREACHActiveOODBMS.InProc.ACMSIGNMODInt.Conf.ontheManagementofData,1995.

8.S.ChakravarthyandD.Mishra.SNOOP:AnExpressiveEventSpeci cationLan-guageforActiveDatabases.DataandKnowledgeEngineering,14(1),1994.

9.M.Eckert.ReactivityontheWeb:EventQueriesandCompositeEventDetectioninXChange.Master’sthesis,Inst.forInformatics,Univ.Munich,Germany,2005.

10.I.Foster,C.Kesselman,andS.Tuecke.TheAnatomyoftheGrid.Enabling

ScalableVirtualOrganizations.Int.Jour.ofSupercomputerApplications,2001.

11.R.Meo,G.Psaila,positeEventsinChimera.InProc.5thInt.

Conf.onExtendingDatabaseTechnology,1996.

12.B.Nguyen,S.Abiteboul,G.Cobena,andM.Preda.MonitoringXMLDataon

theWeb.InProc.ACMSIGMODConf.ontheManagementofData,2001.

13.G.Papamarkos,A.Poulovassilis,andP.Wood.Event-Condition-ActionRulesLan-

guagesfortheSemanticWeb.InProc.WorkshoponSemanticWebandDatabases,2003.

14.N.W.Paton.ActiveRulesinDatabaseSystems.Springer-Verlag,1999.

15.J.D.Ullman.PrinciplesodDatabaseandKnowledge-baseSystems,volume1.

ComputerSciencePress,1988.

16.J.WidomandS.Ceri.ActiveDatabaseSystems.MorganKaufmann,1996.

17.M.WolfandC.Wicksteed.DateandTimeformats.W3CNote,1997.

18.Xcerpt..

19.D.ZimmerandR.Unland.OntheSemanticsofComplexEventsinActive

DatabaseManagementSystems.InProc.15thInt.Conf.DataEngineering,1999.

本文来源:https://www.bwwdw.com/article/jhre.html

Top