...
Syntax of our Implemenation
![](/download/attachments/4587821/start.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/createStmt.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/query.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/patternPart.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/patternDecl.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/seqPatternDecl.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/stateDef.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/typeDefinition.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/aAttributeName.bmp?version=1&modificationDate=1356079854000&api=v2)
![](/download/attachments/4587821/kTypeDefinition.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/kAttributeName.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/where.bmp?version=1&modificationDate=1356079858000&api=v2)
![](/download/attachments/4587821/skip.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/skipMethod.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/parameterList.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/attributeName.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/whereExpression.bmp?version=1&modificationDate=1356079858000&api=v2)
![](/download/attachments/4587821/expression.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/mathExpression.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/mult.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/term.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/attributeTerm.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/aggregation.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/aggop.bmp?version=1&modificationDate=1356079854000&api=v2)
![](/download/attachments/4587821/kAttributeUsage.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/current.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/first.bmp?version=1&modificationDate=1356079855000&api=v2)
![](/download/attachments/4587821/last.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/len.bmp?version=1&modificationDate=1356079856000&api=v2)
![](/download/attachments/4587821/value.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/within.bmp?version=1&modificationDate=1356079858000&api=v2)
![](/download/attachments/4587821/timeunit.bmp?version=1&modificationDate=1356079857000&api=v2)
![](/download/attachments/4587821/returnPart.bmp?version=1&modificationDate=1356079857000&api=v2)
Examples
Examples from [http://avid.cs.umass.edu/sase/]
Code Block |
---|
|
Query 1:
PATTERN SEQ(ShelfReading x, ! CounterReading y, ExitReading z)
WHERE x.id = y. id AND x.id = z.id /* equivalently, [id] */
WITHIN 16 hours |
Code Block |
---|
|
Query 2:
PATTERN SEQ(ShelfReading x, ShelfReading y, ! (ANY(CounterReading, ShelfReading) z) )
WHERE [id] AND x.shelf_id ≠ y.shelf_id AND x.shelf_id = z.shelf_id
WITHIN 1 hour |
Code Block |
---|
|
Query 3:
PATTERN (StartLoading a, RfidReading+ b[ ], EndLoading c)
WHERE [loading_dock]
AND a.session_id = c.session_id
AND b[i].packaging_level = ‘pallet’
RETURN a.session_id, count(b[ ]), b[ ].tag_id |
Code Block |
---|
|
PATTERN SEQ(MedicineTaken x, MedicineTaken y)
WHERE [name=‘John’]
AND [medicine=‘Antibiotics’]
AND (x.amount + y.amount) > 1000
WITHIN 4 hours |
Code Block |
---|
|
PATTERN SEQ(News a, Stock+ b[ ])
WHERE [symbol]
AND a.type = 'bad'
AND b[i].symbol = 'GOOG'
AND b[b.LEN].volume < 80%*b[1].volume
WITHIN 4 hours
RETURN sum(b[ ].volume) |
Code Block |
---|
|
PATTERN SEQ(Stock+ a[])
WHERE [symbol]
AND a[1].price = 10
AND a[i].price > a[i-1].price
AND a[a.LEN].price = 20
AND avg(a[].volume) ≥ a[1].volume
WITHIN 1 hour
RETURN a[1].symbol, a[].price |
Code Block |
---|
|
PATTERN SEQ(Stock+ a[], Stock b)
WHERE [symbol]
AND a[1].volume > 1000
AND a[i].price > avg(a[…i-1].price))
AND b.volume < 80% * a[a.LEN].volume
WITHIN 1 hour
RETURN a[1].symbol, a[].(price,volume), b.(price,volume) |
Code Block |
---|
|
PATTERN SEQ(Scan a, !(Scan+ b[]), Scan c)
WHERE [object_id]
AND a.location = “New York”
AND c.location = “Amherst”
AND b[1].location = a.next
AND b[i].location = b[i-1].next
AND c.location = b[b.LEN].next
AND b.LEN ≤ 3
RETURN c.object_id, c.courier_id |
Code Block |
---|
|
PATTERN SEQ(Alert a, Shipment+ b[ ])
WHERE a.type = 'contaminated'
AND b[1].from = a.site
AND b[i].from = b[i-1].to
WITHIN 3 hours
RETURN a.type, a.site, b[ ].to
|