Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Finally, the RETURN clause transforms each pattern match into a result event for output. Although expressions are possible, in Odysseus only attributes should be used in the RETURN statement

Syntax of our Implemenation

 

 

Examples

The following examples to not work all in Odysseus, currently. There is no ANY.

Examples from [http://avid.cs.umass.edu/sase/]

Code Block
languagesase
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
languagesase
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
languagesase
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
languagesase
PATTERN SEQ(MedicineTaken x, MedicineTaken y)
WHERE 	[name=‘John’] 
   AND	[medicine=‘Antibiotics’] 
   AND	(x.amount + y.amount) > 1000 
WITHIN 	4 hours
Code Block
languagesase
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
languagesase
 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
languagesase
 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
languagesase
 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
languagesase
 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