• Aucun résultat trouvé

Astral: An algebraic approach for sensor data stream querying

N/A
N/A
Protected

Academic year: 2023

Partager "Astral: An algebraic approach for sensor data stream querying"

Copied!
31
0
0

Texte intégral

(1)

HAL Id: hal-00953449

https://hal.inria.fr/hal-00953449

Submitted on 4 Mar 2014

HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Astral: An algebraic approach for sensor data stream querying

Loïc Petit, Claudia Lucia Roncancio, Cyril Labbé

To cite this version:

Loïc Petit, Claudia Lucia Roncancio, Cyril Labbé. Astral: An algebraic approach for sensor data

stream querying. [Research Report] RR-LIG-019, 2011. �hal-00953449�

(2)
(3)
(4)

Astral: An algebrai approah for sensor data stream querying

LoïPetit a,b

,ClaudiaLuiaRonanio b

,CyrilLabbé b

a

OrangeLabs,Meylan,Frane

b

UniversityofGrenoble,LIGLaboratory,Frane

Abstrat

Theuseofsensorbasedappliationsisinexpansioninmanyontexts. Sensorsareinvolvedatseveralsalesranging

from theindividual (e.g. personal monitoring, smarthomes) to regionaland evenworldwide ontexts (i.e. logistis,

naturalresouremonitoringandforeast). Easyandeientmanagementofdatastreamsproduedbyalargenumber

of heterogeneoussensorsis akeyissue tosupport suhappliations. Numeroussolutionsfor queryproessingondata

streams havebeen proposed by the sienti ommunity. Several query proessors havebeen implemented and oer

heterogeneousqueryingapabilitiesandsemantis.

Ourworkisaontributionontheformalizationofqueriesondatastreamsingeneral,andonsensordatainpartiular.

ThispaperproposestheAstralalgebra;deningoperatorsontemporalrelationsandstreamswhihallowtheexpression

ofalargevarietyofqueries,bothinstantaneousandontinuous. Thisproposalextendsseveralaspetsofexistingresults:

it presentspreise formal denitions of operators whih are (or may be) semantially ambiguous and it demonstrates

severalpropertiesofsuh operators. Suhpropertiesareanimportantresultforqueryoptimizationastheyarehelpful

inqueryrewritingandoperatorsharing. Thisformalizationdeepenstheunderstandingofthequeriesandfailitatesthe

omparison ofthesemantisimplementedbyexistingsystems. This isanessentialstepinbuildingmediationsolutions

involvingheterogeneousdata stream proessingsystems. Crosssystemdata exhange and appliationoupling would

befailitated.

This paper disusses existing proposals, presents the Astral algebra, several properties of the operators and the

prototypewehaveimplemented.

Keywords: formal;algebra;sensor; datastream;model;query;optimisation

1. Introdution

Theexpansion ofsensor basedappliations motivates

many studies of sensor data management. Several aa-

demiandindustrialprojetsproposesensordataproess-

ingsolutionsinludingnumerousproposalsforqueryeval-

uation. Itisdiulttoomparethepowerofexpressionof

dierentpropositions beause thequery semantisis not

alwayswelldened. Theevaluationofaquerybytwosys-

temsmayleadtodisparateresultseveniftheyworkonthe

same sensornetwork. Forthese reasonsqueryproessing

aross multiple heterogeneous sensor systems is diult

andpreventsextensiveuseofoptimizationtehniques.

Thispaperisaontributiontothelariationandfor-

malizationofsensorqueries.Itrstpointsoutthedierent

kindofqueriesonsensordataandthenproposesAstral,an

algebraformalizingalltherelatedoneptsandoperators.

Astralprovidesauniedmodelto expressalargevariety

of sensor queriesinluding ontinuous and instantaneous

Afullversionof thisalgebraisavailableontheAstralWikiat

http://sigma.imag.fr/a stra l

Emailaddresses: loi.petitorange-ftgrou p.o m (Loï

Petit),Claudia.Ronanioimag.fr (ClaudiaLuiaRonanio),

Cyril.Labbeimag.fr(CyrilLabbé)

ones. Formaldenition failitatesabetterunderstanding

of the queries and the omparison of the semantis im-

plemented bydierent systems. This paper goes beyond

previousworkin thelariationof the semantisof im-

portant operators. Among them window operators and

joins whose omplexityis often underestimated. This al-

lows us to isolate properties of the operators whih an

beusedforqueryrewriting andoptimization. Disussion

ofsuhpropertiesisanimportantontributionofthispa-

per. Moregenerally,ourproposaloversalargevarietyof

queriesombiningstreamsandrelationsandanbehelpful

inmediationsystemsinvolvingheterogeneousdatastream

proessing. Itwouldfailitaterosssystemsdataexhange

andappliationoupling.

This paper presents the denition of the Astral

algebra

, its implementation and a disussion of related

work. ItalsoillustrateshowAstralanbeusedtoexpress

queriessupported byseveralexistingsensorqueryingsys-

tems. The paper is organized as follows: Setion 2 in-

troduestheontext,relatedworkandmotivationforour

proposal. Setion3presentstheoreofAstral. Setion4

fous on operators on relations whereas setion 5 fous

onoperatorsonstreams. Setion 6presentspropertiesof

streamandrelationoperators. Setion 7omparesAstral

(5)

to existingproposals. Setion 8presentstheprototypeof

Astral. Setion 9 givesouronlusions andresearh per-

spetives. AppendixApresentstheproofsnotinludedin

thepreedingsetions.

2. Querying streamsand models

Asensorisadeviethatdetetsormeasuresaphysial

property and reords, indiates or otherwise responds to

it 1

. Inubiquitoussystems,asensormainlyatsasadata

stream soure. Sensorsmayperformaloaltreatmenton

data before sending the reords asstreams to be further

proessedelsewhere. Atimestamp inthereordindiates

when themeasurement/detetionhasbeenmadeorom-

puted. Toallowrihdelarativequeriesonsensorstreams,

any relevant property of thesensor at the time of dete-

tion may be assoiated to the reord. These properties,

referred to as meta-data, an be for example the sensor

type, the sensor id, the sensor loation, the auray of

themeasurementorthebatterylevelatdetetiontime...

For many years now, researh and industrial

projets [19℄ have foused on managing data streams in

adelarativewayapitalizingontheresultsobtained,for

example,bythedatabaseommunity.

Thissetion introdues themainapproahestoquery

sensor data andpresentsthemotivation forour work. It

is organized as follows. Setion 2.1 introdues our run-

ning example. Setion 2.2 presents the variety of inter-

esting queriesto treatsensor related data (e.g., ontinu-

ous queries). Setion 2.3presentsrelated work onformal

models to support suh queriesand givesthe motivation

forourwork.

2.1. Runningexample: buoys &sensors

Themain runningexampleusedinthispaperinvolves

a large set of oeanographi buoys similar to the 1250

buoysused in theGlobal Drifter Program[33, 31℄. It in-

ludes drifting buoys and anhored buoys eah with at

leastonesensor. Severaltypesofsensorsareusedtomea-

sure SeaSurfae Temperature(SST), Sea Level Pressure

(SLP),Wind(W)andSeaSurfaeSalinity(SSS).Drifting

buoysalso havepositioningsensors (GPS)and may have

a drogue of whih the depth is speied. These infras-

trutureandolleteddataserveavarietyofappliations

on sienti alulus (based on historial data), disaster

detetion andtraking(real timemeasurement),weather

foreasts(usingpresentstatesandhistorialdata),...

2.2. OfSensorsandQueries

Queryingstreams,andpartiularlysensordata,involve

long living ontinuous queries where data are onsumed

andmaynotbepersistent. Thisisdierentfromthelas-

si DBMS ontext whih supports instantaneous queries

1

OxfordAmerianditionary

Value 2 : SLP

3 : GPS

1 2

1 : SST

3

4 : Wind

5 : GPS 4

6 : SSS

1 2 3 4

0 1 1 0

2 3

20 15

1 4

P1 P4

1 2 3 4 5 6

3 1 2 2 3

GPS SST SLP GPS Wind

lg/la Cel Pa lg/la m/s

Buoys DrifBuoys AnchBuoys Sensors

4 SSS ppm

BuoyId Drift BuoyId DrogueD BuoyId Loc Id BuoyId Type Unit

...

1024 ...

10 20 45.1−5.7

−45.1−5.7 35.1 10 12 45.2−5.4 Stream of Data

...

4

...

1230 1

3 5 6 4 3 4

...

2

...

2570

Id timestamp

1410 1641 1853 1885 2102 2253 1410

Figure1: Oeanographi buoysandrelateddata: buoysproperties,

sensorspropertiesanddatastreamfromsensors.

(the lassialones)also alled "ad-ho" queries. Toope

withomplete sensorqueryingrequirements,bothlasses

ofqueriesareneeded.

Instantaneous Queries

Denition 1 (Instantaneous query). An instantaneous

query is evaluated at a time

t

on a set of data available

at this time. The result is the set of data satisfying the

query onditions.

Queries are evaluated ondata desribing pastorpresent

statesofthemonitoredsystem. Forexample: Whih is

the last buoy being in zone '7016' 2

?

Theanswerto suhaquerymaybefoundin thepresent

(if

7016

zoneisnotempty)orinthepaststatesofthezone

history. Two sub-lasses of instantaneous queries anbe

distinguishedaordingtothedatatheyrequire.

Denition 2(Presentquery). A present query is anin-

stantaneous querywhih isevaluated ona setof data de-

sribing the present state of the monitored system. The

result istheset ofdatasatisfying the queryonditions.

For example: Whih buoys are presently in zone

'7016'?

Denition 3 (Histori query). An histori query is an

instantaneous query whih is evaluated on a set of data

desribingpaststatesof the monitoredsystem. Theresult

isthe setof datasatisfyingthe query onditions.

For example: What was the mean of measures issued

by sensors n o

42 and 44 yesterday at 20h UTC?

The evaluation of suh a query requires past data. In

mostases, sensors are notable to store thehistoryand

anexternalpersistentsupportisneeded.

Continuous Queries

Denition 4 (Continuous query). A ontinuous query

proess without interruption a varying set of data. The

result is a varying set of datasatisfying the query ondi-

tions.

2

see[25℄forzonesdesription

(6)

over 30 minutes of SST measured by sensor 42

The evaluation of this query produes a new data item

every30 minutes. The proess will last until an expliit

stopinstrution. Inthisexample,theinputdatasoureis

astreamomingfrom asensordesignatedbyitsid(42).

Among ontinuous queries, we highlight a partiular

sublass: queriesbydesignation. Thesequeriesuseasub-

querytodesignatedatasoures(here sensors/streams)to

be proessed by the ontinuous query. This allows very

expressivequeriesbutrequirespowerfulqueryproessing.

Denition 5 (Query by designation). A query by des-

ignation isa query that designates its input data soures

using anotherquery.

Forexample: Every 30 min, retrieve data from SST

sensors measuring more than 25 o

C at start time

This query will proess the data issued by suh sensors

verifying the temperature ondition when the query is

launhed. If, after a while, asensor measurement drops

under 25, itsstream hasstillto beproessedbythe on-

tinuous query. Here, the "designation" sub-query is an

instantaneous query and more preisely apresentquery.

A ontinuousquery analso beuseful for designation as

in thefollowingexample:

Every 30 min, retrieve data from SST sensors

measuring more than 25 o

C

Inthislastquery,unlikethepreedingone,ifafterawhile,

asensormeasurementdropsunder25,itsstreamhastobe

removedfrom the sope ofthe ontinuous query. Onthe

other hand,if asensor measurementexeeds25, thenits

streamhastobeaddedtothesetofproessedstreams.

Several systems propose sensor data management.

They respondto dierent onstraintsand implementdif-

ferentkindsofqueries. Notalltheaforementionedlasses

ofqueriesaresupportedbyeahofsuh systems. Among

theexistingsolutionswedistinguishin-networkqueryeval-

uationin sensornetworks[29,30℄, mainlyentralizedbut

generalstreamqueryevaluationprovidedbyDataStream

ManagementSystems(DSMS)[4,2,1℄,dataolletorsim-

plementing present and histori queries[10, 36, 26℄, and

hybridsystemsombiningseveralaspetsofthepreeding

atégories [18,3,15,10℄.

2.3. Formal models: relatedworkandmotivation

Inthispaperwefousonformalsupportforsensordata

managementinludingbothinstantaneousandontinuous

queries. Webrieydisuss in thissetion existingresults

and presentthemotivationforourontribution.

The early years. Data streamswereexplored earlyinthe

SEQ model [38℄ where astream is onsidered asa set of

reordswithapositionalorder(withouttimemodel). This

formalism has been used by several works [18, 7℄. Win-

dowssupport andjoins betweentwostreams were notas

als [42℄, ontinuous queries were onsidered as instanta-

neousqueriesexeutedperiodially 3

. Tableswerealready

usedasarelationthatvariesovertime. Lateron,ontinu-

ousqueriesoverfull streamswereonsidered [23℄. Firstly

only full or instant windows were used in these models,

then real windows (sliding, xed, tumbling) were intro-

dued [40℄ following the two major riteria: time-based

andount-basedwindows.

Networkanalysisandsensormonitoringmotivatednew

models for data stream management [2, 29, 30, 45, 13℄.

Sliding windows, aggregation and joins were really ap-

plied. However,thesemantisoftheoperatorswasmainly

foused on implementation with several restritions and

meritsfurtherlariation.

Thetwo-foldapproah. Oneofthemajorontributionsin

datastreammanagementisSTREAM[4℄andpartiularly

its semanti model [5℄. It distinguishes two major on-

epts: ontheonehand,streamsasinnitesetsoftuples

withaommonshemahavingatimestamp,ontheother

hand, relations as funtions that map time to a nite

set of tuples with a ommon shema. In this approah,

windowsare mappersfrom stream to relation, streamers

map relation to stream, and relational algebra[12℄ oper-

ators work on relation(s) to produe a relation. Stream

to stream operations exist only as a omposition of the

other operators. This proposal and the assoiated CQL

language [6℄ have been used ever sine in many stream

projets[44,39,22℄.

Rethinking formalmodels. Reently,theorebasisofthe

aforementionedmodelshasbeenproventobesemantially

ambiguous. Therefore, standardization and lariation

of the ore semantis of some operators have been pro-

posed [24℄. Theonept ofbathasa set oftuples that

has the same timestamp, has been introdued. A new

wave of formalization arises subsequently to ll the lak

of mathematialmodels. Some works ontributeto more

ompleteformalization ofwindows[32, 8, 35℄ astheyare

theaspetofstreamproessingwhihhasledtothemost

dierentinterpretations.

Onestepforward. Thispaperisaontributiontothefor-

malizationofsensordatamanagement. Itextendsexisting

proposalsin severalways.

It goesastepforward in thelariationof these-

mantisofsomeoperators.Forinstane,thewindow

operator(range,row,slidedenition)andthestream

join (instantaneous,innite, band,join) havemany

possible interpretations leading to dierent results.

This has signiant drawbaksin pratie; without

unambiguousdenitionoftheoperatorsitishardto

3

givingonlynewtuplestotheuser

(7)

fortshavebeenmade [24℄,mainlyforsomeommon

typesof windows, but not everyoperator has been

treatedand moresemantisanbedisovered. For

instane,streamersandjoinshavemanyinterpreta-

tionsthat shouldbedetailed.

It improvestheexpressivityof someoperators. For example,thepowerofexpressionofthewindowop-

eratoranbereally large. Fornow,onlysliding (or

similar) windows in the positional or time domain

were onsidered. This paper shows that windows

anhavemoreuseful interpretations,for instane a

slideby3severy5tuples(ombinationofpositional

andtime-based).

It failitates the integration of ontinuous, instan- taneous, designation and histori queries. Current

proposalshardlyonsiderthisaspetwhihisamain

issueforfuture globaldatastreammanagement.

It provides onrete results on query equivalene

whih is a topi that reeived little attention until

now. Forexample,todaytherearenoresultsonhow

to determine if two ontinuous queries (even sim-

pleones), startingat dierenttime, ansharetheir

queryplans. Thispaperproposesasetofproperties,

relyingonmathematialproofs,whihwillallowin-

terestingalgebraioptimization.

Asamatteroffat,agoodomprehensionofquerying

mehanismsis akeypointforthedevelopmentofubiqui-

toussystems. Awelldenedmodelwillenhanetheom-

prehensionofrequirementsandallowabetterreusability,

ouplinganddevelopmentofexistingsupports.

On the appliation developer side, having in mind a

speiappliationbasedonsensors,amodelisneededto

identifyrequiredqueryingapabilities. Then,tehnologies

andsystemsanbehosentofullsuhrequirements.

On the infrastruture provider side, having in mind

spei tehnologies/systems,amodelis neededto repre-

sentqueryingapabilities. Abettermathingbetweentar-

get appliation requirements and systems provided fun-

tionsanbemade.

3. The basis of the algebra

This setion introduesthe foundations of the Astral

algebra. For sensor stream querying, data timestamps

and positionsare indispensablefor aorretdenition of

streams and relations. The followingpresents thedeni-

tionsonerningdatarepresentation. Theoperatorsofthe

algebraareintroduedin thefollowingsetions.

3.1. Tuples andidentiers

Beforegoinganyfurther,letusreallthebasiprini-

plesofstritformalizationoftuplesintherelationalmodel.

a nite subset of attribute names to atomi values. The

domainof this funtionisalled theshema of the tuple.

Asanypartialfuntionitispossibletorepresentatu-

pleasaset ofouplesofAttribute

×

Value(withaunique

onstraintontheattribute). Wewilloftenusethisrepre-

sentationtomanipulatetuples. Notethatnotypesystem

has been dened and it is assumed that any two values

anbeompared. Thisassumptionisnotaproblemfrom

aprogramminglanguagetheorypointofview.

Nowletusaddaphysialidentiertotuples. Thispar-

tiular attribute isintended to identify tuples evenwhen

the valuesof the other attributes are dupliated. It also

allows the denition of a positional order in a set of tu-

ples. Wenowonsiderthedenitionofphysialidentier,

tuple-setandthepositionofatuple.

Denition7(Physialidentier). Thephysial identier

ofatuple

s

isanelementoftheidentierspae

I

isomorph to

N

andtotallyordered. Thenameofthisattributewillbe denotedby

ϕ

and

s(ϕ)

designatesthe valueofthe physial

identier of

s

.

Denition8(Tuple-set). Atuple-setisaountablesetof

tuples sharing the same shema and inluding a physial

identier

ϕ

. Thephysial identierofatupleisuniquein

thetuple-setandinduesastritorderofthe tuplesinthe

tuple-set.

The ommon shema of a tuple-set

T S

is designated

by

Attr(T S)

.

Denition9(Positionofatuple). Thepositionofatuple

s

in a tuple-set

T S

is the ardinal of the following set:

{s ∈ T S/s (ϕ) < s(ϕ)}

Itisnotedas

pos

T S

(s)

Datamanagementinsensorenvironmentsalsorequires

timestampstobeassoiatedtomeasureddata. Weadopt

ontinuoustimeto allowgeneraldatamanagement. This

hoieisdisussedmoreinsetion7.

Denition10 (Timestamp). The time-spae

T

isaeld

isomorphi to

R

. The time-spae is naturally and totally ordered. A timestamp

t

isan elementof

T

.

Thenotionof bath,presentedin[24℄,is neessaryto

handle simultaneous tuples (i.e., tuples having the same

timestamp). Simultaneous tuples an arise, for example,

whenjoining streams(seedenition 32)issuedbyseveral

sensors 4

.

Denition11 (Bath). A bathisatuple-setwhih on-

tains simultaneous tuples. Given a timestamp, bathes

formapartition of the setof all tuples having thistimes-

tamp. Atupleispartofonesinglebath,buttwosimulta-

neoustuples may belong totwodierent bathes.

Bathidentiersareelementsoftheorderedset

T × N

. 4

Clok synhronization isan important issue butis out of the

sopeofthispaper.

(8)

Asshownin [4,17℄ relationsand streamsaretwodif-

ferentoneptsthat haveto bedenedseparately.

Denition 12 (TemporalRelation). A temporal relation

R

is a step funtion that maps a bath identier

(t, i) ∈ T × N

toatuple-set

R(t, i)

.

Example 1: Buoy deployment Deployment of a new

anhored buoy (

BuoyId = 5

) at time

t 1

leads to mod-

iations in relations

Buoys

,

AnchBuoys

, and

Sensors

.

Changesin

Buoys

stateattime

t 1

(bathidentier(

t 1

,0))

areshownhereafter:

Buoys(t 1 − δ, 0)

:

BuoyId Drif t

1 0

2 1

3 1

4 0

Buoys(t 1 + δ, 0)

:

BuoyId Drif t

1 0

2 1

3 1

4 0

5 0

Inthefollowing,

R

designatesatemporal relation. For

simpliity,wewillusethetermrelation fortemporal rela-

tion(def.12). Thetuple-set

R(t, i)

isalledinstantaneous relationatbath

(t, i)

(orattime

t

withoutanymorepre-

ision).

Denition 13 (Stream ontent). A stream ontent

S

is

a possibly innite tuple-setwith a shema ontaining one

morespeialattribute

t

for atimestamp.

The physial identier rules the positional order in

streams, and this plays entral role in data ordering.

Note that the notion of stream is inompletefor now as

the stream needsalso to be partitioned into bathes(see

14,15).

Anelementof

S

isan-tuple

s

inludingavalue

s(t) ∈ T

.

Example 2: Figure 2 illustrates a stream of data

sent by sensors loated on two buoys. The tu-

ples of the stream have the attributes

Attr(S) = (BuoyID, SensorID, V alue, timestamp, ϕ)

.

(1,1,v3,10,3)

2 : SLP 3 : GPS 1

1 : SST

2

Time S(BuoyID,SensorID,Value,Timestamp, ) ϕ

(2,3,v4,12,4) (2,2,v5,15,5) (1,1,v6,17,6) (2,3,v7,20,7) (1,1,v1,3,1) (2,2,v2,9,2)

Figure2: Datafromtwobuoysasastream. Streamsareinniteset

oftupleswithaommonshema.

Todenegenerioperatorsonstreamsorretly,apre-

isedenitionoftupleorderisrequired. Weonsiderboth

is inferred from the timestamps and the positional order

from the physial identiers. As a stream is partitioned

into bathes,thefull denition of astream needsto on-

siderthefuntion thatidentiesthebathgivenatuple.

Denition 14 (Bath indiator). A bath indiator is a

funtion that gives the bath identier of a given tuple

takenfromastreamontent

S

.

B S : S 7→ T × N

Nowweandeneastreamasaompositionofaon-

tentandthisindiator.

Denition 15 (Stream). A stream is a ouple

(S, B S )

omposedof itsontentandabath indiator onthosetu-

ples.

Inthefollowing,thenotationofthestreamontent

S

maybeusedtodenotetheproperstream

(S, B S )

.

Thetimestamp

t 0

willnowdesignatesthestarttimes-

tampforqueryevaluationorfortemporalrelations.

3.3. Bathes andpositionson streams

We will nowassume that, thetotal order indued by

thebathesis oherentwiththepositionalorder. Thatis

tosay: ifatuple

s

preedes

s

inthepositionalorderthen

B S (s) ≤ B S (s )

. However, the positional order is strit,

e.g. there are no tuples that havethe sameposition on

astreamasopposedto thetemporalorder wheretwotu-

ples may have the same timestamp. This assumption is

notmadeby[2,44℄butreorderedtool/operator[2℄isthen

usedtomaintainthisproperty. Ofourse,thishypothesis

maybereally hardto ensure,espeially in lowlevel net-

worksthatannotguaranteeorderintheirmessagesasin

sensornetworks. Wefousonwhatisaformaltreatment

of onsistent data streams. Further work ould look for

theonsequenesofaviolationofthishypothesis.

Hypothesis 1 (Cohereny positional order - timestamp

order). Thetemporal orderandthepositionalorderare

oherent: Let

S

beastream,then

∀s ∈ S, s ∈ S, s(ϕ) < s (ϕ) ⇒ B S (s) ≤ B S (s )

Reall,thattupleshaveauniquepositioninastream.

The following denition assoiates positions and times-

tamps. Givenatupleposition,weanobtaintheidentier

ofthebathontainingthat tuple.

Denition16(Position-timestampmapping). Let

S

bea

stream, and

P S = [[−1, |S |[[⊂ Z

. The funtion

τ S : P S → T × N

isthe funtionwhih given atuplepositionreturns theidentierofitsbath. Byonvention,

τ S (−1) = (t 0 , 0)

.

Corollary 1. Considering Hypothesis1, the funtion:

τ S −1 : T × N → Z

isthe pseudoinverse of

τ S

. For avalid

bathidentier

(t, i)

itreturnsthehighesttuplepositionof

thatbath. Ifthereisnobathidentiedby

(t, i)

,thebath

(9)

having the preeding identierisused.

More formally 5

,

∀(t, i) ∈ T × N ≥ (t 0 , 0)

,

τ S −1 (t, i) =

 

 

|S| − 1 if|S| < +∞ ∧ (t, i) ≥ τ S (|S| − 1)

|S|−2

X

n=−1

n 1 [τ S (n),τ S (n+1)[ (t, i) else

Asthese twofuntions willbemanipulatedin thefol-

lowingitisimportanttostateresultsabouttheirompo-

sition.

Property 1(Properties of

τ S

). The following properties

state:

τ S (0) ≥ (t 0 , 0) τ S (τ S −1 (t, i)) ≤ (t, i)

τ S −1 (τ S (n)) ≥ n

Moreover,if

∃s ∈ S, B S (s) = (t, i)

,then

τ S ◦ τ S −1 (t, i) = (t, i)

.

Proof sketh: The rst property states from deni-

tion10whereasthetwoothersstatebythefatthat

τ S −1

takesthemaxinaseofequality. Resultsanbefoundby

using the formaldenition of

τ S −1

. See appendix A for a

omplete proofofthisrstproposition.

4. Relational operators

As introdued previously, Astral adopts the two-fold

approah of data stream management based on streams

andrelations. Morepreisely,thisworkusestemporalre-

lations (see denition 12) whih are fairly dierent from

the lassi relations in Codd's algebra [12℄. This setion

disusses how Codds's operators are inherited and pro-

poses adapted denitions of the operators to work with

temporal relations. Suh operators are neessaryto pro-

vide learsemantiswhenhandlingstreamsandrelations

together.

Thefollowingsetionsdisuss unary operators,arte-

sianprodut,setorientedoperators,joinsandanoperator

fordomainmanipulation whih isspei totemporal re-

lations.

4.1. Unaryoperators

Letus onsiderseletion,projetionandrenamingde-

ned astemporal relation

temporal relation operators.

Theirsemantisaremainlytheusualoneswithsomesmall

partiularitiesrelatedtotemporalrelations.

Seletion: we note

σ c

the seletion on temporal rela-

tions whereas

Σ c

is used for seletionon (instantaneous) relations. To take into aount the temporal aspet,

σ c

5

Asareall,thefuntion

1 A

istheindiatorfuntionhavingthe

value

1

forallelementsof

A

andthevalue

0

forallotherelements

hastobedenedonbathindiators

(t, i)

. Itisdenedas

follows:

∀R, σ c (R) : (t, i) 7→ Σ c (R(t, i))

The evaluation of

σ c

at bath indiator

(t, i)

behaves as

theusualseletiononthe(instantaneous)relationR(t,i).

Projetion: Forprojetionsapartiularityisintrodued

topreservethephysialidentier(attribute

ϕ

)oftemporal

relations. Weretheidentiertobedisardedbyaproje-

tion,

ϕ

wouldbeimpliitlyadded: if

Π p

with

ϕ 6∈ p

isused

then

Π p∪{ϕ}

isexeuted.

Renaming: Aonstraintonrenamingisalsointrodued

topreserveattribute

ϕ

: If

ρ a/ϕ

isused, thenthephysial

identierisopiedtothenewattribute

a

andtheoriginal

attribute

ϕ

remains.

There are no dierent partiularities for the other

unaryoperators. TheinterestedreadermayvisitAstral's

wikifortheirdenitions.

4.2. Cartesian produt

Letusonsidernowtheartesianprodutbetweentwo

temporal relations produing a temporal relation. The

main issue in the denition of this operator is the order

among tuples and, more preisely, the physial identier

oftheresultingtuples.

Reallthatthephysialidentierallowsustodieren-

tiatebetweentupleshavingthesamevaluesand toorder

tuplesofatuple-set. Aswewillseelater,thisorderisim-

portantto onsider even in relations. Multiple semantis

anbe usedto reatethe physialidentier ofthetuples

produedbytheartesianprodut. Toavoidimpliithet-

erogeneity that may impat the nal result of a query,

we propose to makeexpliit the reation of the physial

identierin artesianproduts. Afuntion

Φ R t,i 1 ×R 2

isin-

troduedforthis purpose.

Theartesianprodutfortemporalrelationsisdened

asfollows.

Denition 17 (Cartesian produt). Let

R 1

and

R 2

, be

two temporal relations suh that

Attr(R 1 ) ∩ Attr(R 2 ) = {ϕ}

,

let

(t, i)

beabathidentier,

let

Φ R t,i 1 ×R 2 : N × N → N

bean injetive funtion om- putingthephysialidentierofthenewtuplegiventhetwo

physial identiersof the tuplesfrom

R 1

and

R 2

.

The temporal relationalartesian produtof

R 1

by

R 2

atbath

(t, i)

isdenedas:

(R 1 × R 2 )(t, i) = [

r ∈ R 1 (t, i) s ∈ R 2 (t, i)

r[Attr(R 1 )\ϕ] ∪ s[Attr(R 2 )\ϕ] ∪ (ϕ, Φ R t,i 1 ×R 2 (r(ϕ), s(ϕ))

where

r[a 1 , ..., a n ]

denotes the restrition of tuple

r

to

attributes

a 1 , ..., a n

.

(10)

produt is thefuntion

Φ R t,i 1 ×R 2

. This funtion rules the

order (indued bythephysialidentier)of tuplesin the

instantaneousrelation

(R 1 ×R 2 )(t, i)

withoutaetingthe

ompositionofthetuples. Thehoieoffuntion

Φ R t,i 1 ×R 2

is neverthelessimportant beause theorder's semantiis

meaningful for some operators. For example,it happens

when the result of the artesian produt is used by a

streaming operator (see setion5.1) where thepositional

order ofthetuplesin thestreamisessential.

Thefuntionusedin thispaperis:

Φ R t,i 1 ×R 2 (ϕ 1 , ϕ 2 ) = ϕ 1 ∗ [ max

r∈R 2 (t,i) (r(ϕ)) + 1] + ϕ 2

Althoughthevalueofthephysialidentierisnotrelevant

by itself, the induedorder is important. The preeding

funtion ensuresthefollowingproperty

Φ R t,i 1 ×R 2 (a, b) < Φ R t,i 1 ×R 2 (c, d) ⇔ a < c ∨ (a = c ∧ b < d)

that desribesthestrit lexiographiorder (whih is to-

tal) bygivingprioritytotheleftside.

Thereisnodiretriteriatoarguethatthehoiemade

for

Φ R t,i 1 ×R 2

is a good one or not. Our hoie has been

guided bymultipleaspets. Firstly,thefuntion provides

a total order ommonly established over

N 2

. Seondly, this order reets the behavior of the usual nested loop

algorithm: iterateon

R 1

andforeahtupleiterateon

R 2

.

Thirdly,duetothissimplebehaviorandformulation,itis

ommonlyfoundin pratiein existingsystems.

Theharateristisof

Φ R t,i 1 ×R 2

mayimpattheproper-

ties of theartesian produt. We highlightthe following

importantfat.

Property 2 (Asymmetrial artesian produt). The

artesian produtisnot symmetriin the general ase.

The following exampleillustrates a artesianprodut

withthehosen

Φ R t,i 1 ×R 2

toalulatethephysialidentier.

It showstheasymmetryoftheartesian produt.

Example 3: Consider relations

R 1

and

R 2

, both on-

tainingasensor

id

and theirsensedvaluestemperature

tv

orhumidity

hv

.

R 1 (t, i) R 2 (t, i)

ϕ

id tv

0 1 20

1 3 23

2 42 22

ϕ

id2 hv

0 42 45

1 2 50

R 1 × R 2

and

R 2 × R 1

dierasshownhereafter.

(R 1 × R 2 )(t, i) (R 2 × R 1 )(t, i)

ϕ

id id2 tv hv

0 1 42 20 45

1 1 2 20 50

2 3 42 23 45

3 3 2 23 50

4 42 42 22 45

5 42 2 22 50

ϕ

id id2 tv hv

0 1 42 20 45

1 3 42 23 45

2 42 42 22 45

3 1 2 20 50

4 3 2 23 50

5 42 2 22 50

ussedinthissetionhavebeenignoredorsuggestedonly.

Wehighlight suh kind of ambiguity, ndpropertiesand

pointoutpotentialproblemsin ordertoproposeapreise

formalframework.

4.3. Sets operators

Thissetiondisussestheunionanddiereneoftem-

poralrelations.

Denition18(Setdierene). Let

R 1

and

R 2

betwotem-

poral relations with the same shema. The set dierene

isdenedas:

R 1 − R 2 : t, i 7→ R 1 (t, i) − R 2 (t, i)

There isno partiularityin thedierene oftemporal

relations. Nevertheless,itisworthnotingthatthephysial

identier(attribute

ϕ

) is handled asany otherattribute.

Thisimpliesthattwotuplesareonsideredasbeingequal

whentheirattributevaluesarethesameevenforattribute

ϕ

.

Thedenition of theunionfor temporal relationsisa

littlemoreompliatedbeausetheresultingtuplesrequire

ameaningfulphysial identier. Asseenfortheartesian

produt, a problem of semantis arises in the resulting

order.

Denition19(Setunion). Let

R 1

and

R 2

betwotemporal

relations withthe sameshema.

Let

Φ R t,i 1 ∪R 2 : {0, 1} × N → N

be a funtion that will ensureaoherentorderof

ϕ

ateahinstant

(t, i)

i.e.

The setunion isdenedas:

R 1 ∪ R 2 : t, i 7→

∪ r∈R 1 (t,i)

n r[Attr(R 1 )\ϕ] ∪ (ϕ, Φ R t,i 1 ∪R 2 (0, r(ϕ)) o

∪ s∈R 2 (t,i)

n s[Attr(R 2 )\ϕ] ∪ (ϕ, Φ R t,i 1 ∪R 2 (1, s(ϕ)) o

Severalsemantisanbeonsidered for

Φ R t,i 1 ∪R 2

. Note

thatusing

Φ R t,i 1 ∪R 2 (i, ϕ) = ϕ

would lead to asymmetri union,but without uniityof

ϕ

valuesin theresult. Thismayhappenfor tuplesof

R 1

and

R 2

having thesamevalue for

ϕ

but no exatmath

for all the other attributes. Suh a funtion an not be

usedbeauseatotalorderinferred by

ϕ

isrequired.

Forageneralase,wewill onsiderthefollowingfun-

tion

Φ R t,i 1 ∪R 2 (j, ϕ) = j ∗ [ max

r∈R 1 (t,i) (r(ϕ)) + 1] + ϕ = Φ R t,i 2 ×R 1 (j, ϕ)

Here,asfortheartesianprodut,thevalueof

ϕ

itself

is not relevant but the indued order is important. The

hosenfuntiongivesprioritytothelefthandsiderelation

(their tuples are plaed rst). The symmetri property

doesnotholdfortheunion.

Suh orderingproblemshavenotyet beenlariedby

theliteratureandareimportantbeausetheyimpatthe

resultof queriesinvolvingstreams.

(11)

4.4. Thejoins

Giventhepreedingdenitions,partiularlythesele-

tionand artesianprodutof temporal relations,thefor-

malizationofjoinsisnowstraightforward. Theorrespon-

dene between joins and artesian produts fortemporal

relationsisthesameasinrelationalalgebra.

Denition20(Naturaljoin). Let

R 1

and

R 2

betwotem-

poral relations. Let

{a 1 , ..., a n }

betheirommonattributes

exept

ϕ

. Let

{b 1 , ..., b n }

bealistof

n

temporaryattributes

neitherdenedin

R 1

nor in

R 2

.

Thenatural joinisdenedas

R 1 1 R 2 =

Π Attr(R 1 )∪Attr(R 2 ) (◦ n i=1 σ a i =b i ) R 1 × (◦ n i=1 ρ b i /a i )(R 2 )

Note that this denition (using seletion, renaming

and artesian produt) is exatly the same as in lassi-

al relationalalgebra. It would also besimilar for

θ

-join

(

R 1 1 θ R 2

)andsemi-join(

R 1 ⋉ R 2

). Usingthesetopera-

tionsdened in theprevioussetion, outerjoins,antijoin

anddivision analsobeexpressedsimilarly.

4.5. Usingthe paststatesofatemporal relation

Thepreedingsetionsfousedontheusual relational

operatorsapplied tothetemporalrelationsintroduedin

Astral. Thissetionintroduesanewoperator,speito

temporalrelationswhihareonsideredasfuntions.

Let

O

beoneofthealreadyintroduedoperators. For

all

(t, i)

,theresultof

O(R 1 , ..., R n )(t, i)

isomputedwith

R 1 (t, i)

,...,

R n (t, i)

. Oneimportantfeatureistobeableto

use, notonlythestatesof relationsattime

(t, i)

but also

at thepaststates(

(t , i ) < (t, i)

) toomputeresults. To

dothis,anewoperatorisrequired. Itallowsustohange

thedomainofthe

R

funtionsoastousebathindiators

ofthepastandtoreferto thepaststatesofrelations.

Denition 21 (Domain manipulator). Let

R

be a tem-

poral relation, let

f : T × N → T × N

be a funtion of timeindiators(timetransformer),and

c

aonditionover

T × N

.

If,

∀(t, i) ∈ T × N , c(t, i) ∧ f (t, i) ≤ (t, i),

Then,the domain manipulatorisdenedasfollows:

D c f (R) = t, i 7→

( R(f (t, i))

if

c(t, i)

else

Thisoperator,notyetonsidered bytheexistingpro-

posals, is interesting as it allows the reationof a state

basedononeorseveralpaststatesasa"urrent"stateof

a relation. This an beused, for example,to ompare a

relation with its past states. The rstdiret appliation

maybethefollowingone.

Denition 22 (Fixed relation). Let

R

be a temporal re-

lation and let

t s

be a timestamp. The xed relation

R

at

t s

isdenedas

R t s = D t,i7→t t≥t s s ,0 (R) = t, i 7→

( R(t s , 0)

if

t s ≤ t

else

Here

R t s

is therelation

R

frozen at time

t s

. Thefol-

lowingstatesof

R

anbeomparedtothispaststate. The

xrelationoperatorisusefultoexpressontinuousqueries

usinginstantaneousqueriesfordesignation(seedenition

5andsetion7.1). Thatis,aninstantaneousqueryisused

toseletand"x"thesetofsensorstobeusedintheeval-

uation of the ontinuous query. Another appliation of

suh anoperatorwillbeseenwhenmanipulatingstreams

withjoins(seedenition 33).

Wehavenowexploredtheorerelation-to-relationop-

erators. We have seen that suh formalization work al-

lowedus torevealexisting semantidisrepaniesindata

management whih were hardly pereivable but whih

wereneverthelesssigniant. Withourmodel,weantar-

getsemantiproblems andbeawareof them whileusing

theoperators.

5. Streamoperators

This setion presents the operators to manipulate

streams. It rst presentsthe streamers (see Setion 5.1)

whih reatestreams fromrelations. Windowsoperators,

allowingthereationofrelationsfromstreams,aredened

in Setion 5.2. These two types of operators (streamers

andwindows)arethebasisfordening thejoinoperators

ofstreams(seeSetion5.3) 6

.

5.1. Streamers

Streamers areoperatorsused to reateastream from

arelation. Streamsanbegeneratedby monitoringrela-

tions. Twotypesofstreamersanbedistinguished: those

fed when hanges our in the relation (alled sensible

streamers) and those that do not "reat" to hanges in

therelation(alledindependentstreamers).

Streamers are in harge of stamping tuples of the

streams. This stamping is both positional and temporal

andsomustensurethatoherentordersareprodued. We

dene thestamping funtion asthe funtion that adds a

timestampandapositionto atupleofarelation.

Denition23(Streamerstamping). Let

R

bearelation,

let

(t, i)

beabath identier,let

Φ S t,i : N → N

beastritly inreasing funtion that ensures:

∀(t , i ) ≤ (t, i), Φ S t ′ ,i ≤ Φ S t,i

.

The funtion thatstampstuples from

R(t, i)

isdened

by:

∀s ∈ R(t, i), ∀t s ∈ T, Ψ t,i (s, t s ) = {( t , t s ), (ϕ, Φ S t,i (ϕ))} [

a∈Attr(R)\{ϕ, t }

{(a, s(a))}

Suhadenitionensuresthatthestampedtuplesthat

willformastreamverifythefollowingproperties:

6

Forspaereasons,sometehnialdetailsarenotinludedinthe

paperbutanbefoundontheAstral'sWiki.

(12)

eahtuplehasatimestamp

t s

,whihisthemoment

whenithasbeenstamped,

eahtuplehasaphysialidentier(position)greater

thantheidentiersofthepreviousstampedtuples,

thepositionalorderof

R(t, i)

ispreservedinthenal

stream.

If a timestamp was dened in the original tuples, it

will be replaed in the stamping proess. It is possible

to onservethe value of theoriginal timestamp by using

anoperator

ρ t original /t

beforethestreamerthatwillstamp

thetuples.

The atual expression of

Φ S t,i

is not important. Its

purpose is to insure a oherent positional order derived

from the physial identierof theinstantaneousrelation.

Stamping usingthereationtimeisruial. Insensorap-

pliations,thequestionofwhihtimestamphastobeused

fortuplesontainingaggregatedmeasures(5minrangefor

instane) has been disussed many times [18, 7, 16, 20℄.

Three usual hoies have beenidentied: min ormax of

the timestamps of the involved tuples and user-dened.

Several strong arguments an be given for hoosing the

momentofreation 7

ofthetupleasitstimestamp. Firstly,

this hoie is oherent with thetime when the valuehas

beenalulated. Seondly,theorder ispreservedwhereas

order violations ould be introdued by taking another

value. Thirdly, this hoie does not make any hypothe-

sisontheshemaof

R

andallowstime-stampingoftuples withouttimestamporiginally. Property3inSetion6will

showhow anoriginaltimestamp anbe transmittedto a

nal stream.

Sensible streamersan now be dened. Given arela-

tion,sensiblestreamersaddstoastreamhangesourring

in therelation.

Denition 24(Sensible streamers). Let

R

bearelation,

Let

(t, i)

and

(t, i)

besuhthat

(t, i) < (t, i)

.

(t, i)

isabathidentierinnitelynear(butnotequalto)

(t, i)

.8

Theoresensiblestreamersare:

• I S (R)

the operator giving the stream of tuples in-

sertedin therelation

R

:

I S (R) = S

:

s = Ψ t,i (s, t) ∈ S, B S (s ) = (t, i)

⇔ s ∈ R(t, i) ∧ s 6∈ R((t, i) )

• D S (R)

the operator giving the streamof tuples sup-

pressedfromthe relation

R

:

D S (R) = S

:

s = Ψ (t,i) (s, t) ∈ S, B S (s ) = (t, i)

⇔ s 6∈ R(t, i) ∧ s ∈ R((t, i) )

• R u S (R)

the operator giving the streamof the ontent

ofthe relation

R

everytimeithanges:

R u S (R) = S

:

s = Ψ t,i (s, t) ∈ S, B S (s ) = (t, i)

⇔ R(t, i) 6= R((t, i) ) ∧ s ∈ R(t, i)

7

Greaterorequaltothemax

8

Choosingsuhtimestampisalwayspossibleas

R

isastepfun- tion

Example 4: Considering the buoys example, relations

Buoys and AnhBuoys are as illustrated by gure 1 (in

Setion2.1). AttributeBuoyIdmaybeusedforanatural

join. Let

R = Buoys 1 AnchBuoys

betherelationwhihgivesmeta-dataforanhoredbuoys.

Thedeploymentorpikupofabuoyattime

t

leadsto an

updatein

R

atthistime.

The stream of buoy arrivals in the system (when

new buoys are deployed) an be express as:

I S (Π BuoyId R)

.

Thestreamofdeparture(buoypikuportermination ofobservation)is givenby:

D S (Π BuoyId R)

.

Thestreamofloalizationofanhoredbuoy42:

R u S (Π loc σ BuoyId=42 (R))

Letintroduetherelation

M

ontainingthedatasend

byeahbuoy:

l ∈ M ⇔ {l = (id, m, ϕ) }

where

id

is the

sensorid,

m

thereeivedmeasurementand

ϕ

thephysial

identier. Reeiving data from a buoy at time

t

leads

to an insert in

M

at this time, the

ϕ

beinginremented

at eah insertion. Figure 3 shows

M

at insertions times

(

3, 9, 10, 12, ...

). Inthisexample,the

Φ S t,i

funtion(f. 23)

isdeneasfollows:

Φ S t,i (ϕ) = ϕ

Thestreamofsenseddatais givenby

I S (M )

.

I (M) = {(1,v1,3,1), (2,v2,9,2), (1,v3,10,3), (3,v4,12,4),...}

1

Sensor #1 : SST 2

Sensor #2 : SLP Sensor #3 : GPS

Id m ϕ

1 2 3 4 5 6 7 1 2 1 3 2 1 3

v1 v2 v3 v4 v5 v6 v7

Id m ϕ

1 1 v1

Id m ϕ

1 2 1 2

v1 v2

Id m ϕ

1 2 3 1 2 1

v1 v2 v3

Id m ϕ

1 2 3 4 1 2 1 3

v1 v2 v3 v4

Id m ϕ

1 2 3 4 5 1 2 1 3 2

v1 v2 v3 v4 v5

Id m ϕ

1 2 3 4 5 6 1 2 1 3 2 1

v1 v2 v3 v4 v5 v6 9

3 10

M(3): M(9):

Time M(20):

M(17):

M(15):

M(12):

M(10):

20 17 15

12 (2,v2) (1,v3)

(1,v1) (3,v4) (2,v5) (1,v6) (3,v7)

S

Figure3:Streamfromtwobuoysanbeinterpretedasreatedfrom

theoperator

I S

.

The rate of tuples in sensible steamers is ditated by

theupdatesonthetemporalrelation. Let'snowintrodue

independent streamers whih reate tuples at their own

rate.

Denition 25 (Independent streamer

R r S

). Let

R

be a

relation, and

r

beaperiod oftime.

(13)

The independent streamerthat sends the ontent of

R

eah

r

periodisdenedas:

R r S (R) = S :

Ψ t,i (s, t) ∈ S, B S (s) = (t, i) ⇔ s ∈ R(t, i) ∧ t − t 0 ∈ r N

Example 5: Continuing example 4 and using relation

Sensorsillustratedbygure1(inSetion2.1),thestream

ofavailablemeasurementseveryseondanbewrittenas:

R 1s S (Π m,Id,BuoyId (M 1 Sensors))

. The rateof tuples in

the stream is 1 seond independently of hanges in the

relations.

Otherindependentstreameroperatorsouldbedened

to reate streams ofupdates/deletes/insertseveryperiod

r

. This anbedone by omparing thestate of the rela-

tion at

t

and

t − r

. Similarly, insert-sensitivestreamers thatsendtheontentofarelationateahinsertion,ould

also be dened. We don't introdue them in this paper

beauseamoreompletestudyoftheirutilityinpratie

stillneessary.

Streamers have already been dened in other alge-

bra like in STREAM [4℄. For instane,

I S

is simi-

lar to

IST REAM

and

D S

is similar to

DST REAM

.

RST REAM

is similar to

R δ S

, with

δ

being the hronon

of thesystem(1sfor instane). As

RST REAM

usesim-

pliitlythehrononofthesystem,omparingresultsgiven

bytwosystemsusingtwodierenthronons(forexample

δ 1

and

δ 2

)mayleadtosomeonfusions. Theexatbehav-

ioranbeexpressedinAstralwith

R δ S 1

and

R δ S 2

.

5.2. Windows

Windowoperatorsanbeusedtoreaterelationsfrom

streams. These relations an then be used to reate a

streamofaggregatevalues(min,max,...) andalsotodene

join between streams. A window may be temporal (e.g.

data from the last 10 minutes), or positional (e.g. the

10thlastdataofastream)orrossdomain(e.g. the10th

last dataevery10minutes).

Inliterature[9℄mainswindowsare:

Fixed: boundariesarexed,thewindowisevaluated

onlyone.

Sliding : widthis xedandboundarylinearlymov-

ing

Tumbling : is a partiular sliding window, the

boundaries moveis equal to the width of the win-

dowsothat intersetionbetweenwindowsisempty.

Landmark : lowerboundaryis xed and theupper

onegrowslinearly.

We give here a more general denition of windows,

moredetailanbefoundin[35℄. Therststepistodene

asequeneofwindowsandtheoperatortoreateit.

Ingeneral,axedwindowisdenedbyalowerandan

upperbound. Suhboundsdelimitthesubsetofthedata

stream observed in thewindow. Indata stream manage-

ment, sequenes of windows are required to observe the

datain the evolvingstream. Thissetion denesthe op-

eratortoreatesequenesofwindows(denition28). Itis

basedon adesriptionof suh asequene (denition 26)

and its orrelation to data streams (denition 27). This

orrelation uses bathes (introdued in setion 3.1) that

support positionaland temporalwindowsin thepresene

ofsimultaneoustuplesin thestream.

Denition 26 (Window Sequene Desription). Let

D

and

D

beeither

T

or

N

,aWindowSequeneDesription isatriplet(

α, β, r

)where:

• r ∈ D

isthe boundaries evaluationrate

• α

and

β

aretwofuntionsfrom

N → D

representing the boundaries evolution.

α(j)

and

β(j)

denethe

j th

valuesfor the boundaries.

The rstvaluesare given for

j = 0

.

These funtions must verify the following properties

(statedherefor

D = D = T

):

∀j ∈ N ,

 

 

α(j) ≤ β(j)

beginningbeforeend

α(j) ≥ t 0

beginningexists

β(j) ≤ jr + β(0)

endaessible

Byapplying

τ S

(or

τ S −1

),theseonditionsfor othervalues

of

D

and/or

D

areeasy tond.

Example6: Let'sonsiderthestreamoftheSSTsensor

42. In order to monitor temperature, we onsider that

pereah100passeditems,wehaveto extratthelast 10

items. For this ase, we requirea sequene of positional

windowsgenerated for every 100 items (

r = 100

) where

eah window ontains the 10 last items. We handle full

positional windows,

α, β ∈ ( N → N ) 2

. The rst window

oversfrom the 91th item to 100thitem:

α(0) = 91

and

β(0) = 100

. Theboundariesevolvelinearlyasfollows:

α(j) = 100j + 91 β(j) = 100(j + 1)

r = 100

Window reationrequires mapping of the stream tu-

ples into the orresponding window based on the given

sequene desription. For this, we use the following de-

layingfuntionwhih inludesbathidentiers. Basedon

the window sequene desription, this funtion gives the

"rank"ofthelastreatedwindowatthemomentindiated

bythegivenbathidentier.

Denition27(Delayingfuntion). Thedelayingfuntion

isafuntionfrom

T × N → Z

thatmapsthebathidentier withthe id oflast valid boundaries.

If

r ∈ T

,this funtion is

γ : t, i 7→ j t−β(0)

r

k

.

If

r ∈ N

,this funtion is

γ : t, i 7→ j τ −1

S (t,i)−β(0) r

k

.

(14)

The term delaying is related to the fat that the

j th

boundaries omputationhas tobedelayeduntil

γ(t, i) = j

.

Example7: Inthelastexample,thedelayingfuntionis

γ(t, i) = j τ −1

S (t,i) 100

k − 1

. IfweonsiderthattheSSTsensor

42emitsatupleperseond.As

γ(1024, 0) = 1024

100

− 1 = 9

. The 10th window is the last reated window at this

bath identier.

Giventhis,itisnowpossibletodeneanoperatorthat

generatesatemporalrelationfromastream. Thistempo-

ralrelationhasasequeneofstates. Transitionsbetween

statesaretriggeredbybathesarrivalsandhangesof

γ

.

Denition 28(WindowSequene Operator). Let

S

bea

stream,

(α, β, r)

beaWindowSequeneDesriptionand

γ

be the delayingfuntion assoiated tothisdesription,

TheWindow SequeneOperatorisdenedas:

• ∀(t, i)

,suhthat

γ(t, i) ≥ 0

,

Ifthe desription has temporal bounds:

S[α, β, r](t, i) =

{s ∈ S/ (α(γ(t, i)), 0) ≤ B S (s) ≤ (β (γ(t, i)), i)}

Ifthe desription has positionalbounds:

E t,i = {s ∈ S/ τ S (α(γ(t, i))) ≤ B S (s) ≤ τ S (β(γ(t, i)))}

S[α, β, r](t, i) = {s ∈ E t,i /

|{s ∈ E t,i /s(ϕ) < s (ϕ)}| ≤ β(γ(t, i)) − α(γ(t, i))}

• ∀(t, i)

,suhthat

γ(t, i) < 0

,

S[α, β, r](t, i) = ∅

Thisdenitiondistinguishestheaseoftemporalwin-

dowsfrom positionalwindows.

Fortemporalwindows,itonsidersthebathesranging:

from the rstbath providing tuples falling in the

windowsope(noted

(α(γ(t, i)), 0)

),i.e. theirtimes-

tampis

thanthelowerboundofthewindow

until thelastbathprovidingtuplesin thewindow

sope (noted

(β(γ(t, i)), i)

). This is the

i

th bath

having the maximum timestamp inferior than the

higherbound ofthewindow.

Note that therelation

S[α, β, r]

may hange at bath

arrivaleveniftimedoesn'thange. Usingthebathiden-

tiertodeneawindowismandatorysinethepartition-

ing introdued bybathesis neededwhenbuilding anew

streamfromwindow. Disregardingbathidentierswould

leadtothelossofbathgrouping. Atreatmentexlusively

basedontimestampswouldnotbesuient.

Forpositionalwindows,theasewherebathesontain

exatlyonetupleeah(fullspreadstream)issimplerthan

thegeneralasewherebathesontainmoretuples.

Forfullspreadstreams,

E t,i = S[α, β, r](t, i)

.

Forthegeneralase,

E t,i

isomposed ofallbathes

inludingtuplesfallingintheurrentwindowsope.

Theinstantaneousrelation

S[α, β, r](t, i)

isasubset

of

E t,i

.

Asexample,onsider"1-tuple"widthwindows.

E t,i

ontainsthelastbath,butasitmayinludeseveral

tuples, only one has to be seleted. The seletion

over the more-reent tuples is done with regard to

thepositionalorder

ϕ

.

The

γ

funtion in the positional ase is driven by

τ S −1

whih provides themaximumtuple position in

ase of onit. This hoie is important as other

hoieswould introduetupleloosing onsimultane-

ousevents.

Inthefollowing,tospeifytherate

r

wewilluse

n

for

positionaloratemporalunit

s, ms, m

.

Example8: SlidingWindows: Figure4showsasliding

window. Itslidesoftwoseondseverytwoseondswitha

onstantwidth of3seonds.

t 0 = 0

forsimpliity.

W 0

W 1 W 2 W 3 W 4

s 0 s 1 s 2 s 3 s 4 s 5 s 6 s 7 s 8 s 9 s 10 s 11 s 12 s 13

0 1 2 3 4 5 6 7 8 9

time stream

Figure4:SequeneofslidingwindowsPERIOD3sSLIDE2s

Wehave

r = 2s

asslidingrate. Fortherstwindow:

α(0) = 0

and

β(0) = 3

. Theslidesofboundaryis2sso:

∀i ∈ N ,

( α(i) = i ∗ 2s + t 0

β(i) = i ∗ 2s + 3s + t 0

Thetemporalrelationgeneratedfromthestream

S

anbe

noted:

S[2is, 2is + 3s, 2s]

.

Given a timestamp

t = 5.5

it is easy to ompute

S[α, β, r](5.5)

. Thewindowsthatanbeomputedatthis

time is the one numbered

γ(5.5) = j 5,5−β(0)

r

k = 1

. So

S[α, β, r](5.5) = W 1 = {s 4 , s 5 , s 6 , s 7 , s 8 }

Denition29(Partitionedwindow). Asequeneofparti-

tionedwindowsisbuildastheunionofwindowssequenes

onastreampartitionedby asetofattributes

a 1

,... ,

a k

:

S[a 1 ...a k /α, β, r] = [

i∈

Dom

(a 1 ,...,a k )

(σ (a 1 ,...,a k )=i S)[α, β, r]

This operatoris usefultoreate thesamesequeneof

windowson sub-streams of amain stream. See example

bellow.

Example 9: Given thestream

S

of measurements de- ned in example4,thelast valuesendedbyeahbuoyis

givenby

S[BuoyId/i, i, 1n]

whereasthelast valuesended

byeahsensorisgivenby

S[id/i, i, 1n]

.

Theproposedmodelisgenerienoughandanbeused

toreateomplexwindowsliketheonesgeneratedbythe

used of more algorithmi models [10℄. More denitions

Références

Documents relatifs

possible precision. By reconstructing Westwyk’s mathematical practices in compiling, computing and using tables that required and enabled a range of astronomical techniques, this

Long Island City, New York (1981), Hurlburt’s work has been included in National and International exhibitions including: The Power Plant, Toronto; Royal Ontario Museum,

We believe that LSQ could have applications to design benchmarks that better reflect the use of SPARQL in practice, to identify which SPARQL features (or combinations thereof) are

Thus, in this context, temporal queries are formulated using time windows in the same spirit as time windows are used for continuous queries in stream processing systems.. The

We show how we transform an ontology based stream data query language into equivalent relational alge- bra queries in SQL for timetagged data tables.. Our approach extends

Katzarkov-Pantev-Toen endow the schematic homotopy type with a mixed Hodge structure, Pridham extends this to the case of singular varieties, gives a Q ` analogue,. Olsson does a

Abstract: An algebraic variety X over the complex numbers has, as one of its main facets, a topological space X top.. The study of X top has played an important role in the history

During my PhD, I collected positive evidences that a system such as Natron (based on a streaming computational model and on the Lazy Transformation principle), and a conceptual