Space and time are two dimensions that are increasingly more important in today’s online world. It is therefore no surprise that the blending of CEP and spatial is a natural one and ever more important.
Recently at DEBS 2001, I presented our work on integrating Oracle Spatial with Oracle CEP, where we are seamless referencing to spatial functions and types in CQL (e.g. our event processing language). This allows us to implement geo-fencing and telematics within the real-timeness of CEP.
For example, consider the following query:
SELECT shopId, customerIdFROM Location-Stream [ NOW ] AS loc, Shop
WHERE contains@spatial(Shop.geometry, loc.point)
Noteworthy to mention:
- Location-Stream is a stream of events containing the customer’s location as a point, perhaps being emitted by a GPS.
- Shop is a relation defining the physical location of shops as a geometry.
- The contains predicate function verifies if a point (event) from the stream is contained by any of the geometries (row) of the relation.
This single query selects an event in time (i.e. now) and joins it with a spatial table!
The join happens in memory aided by a R-Tree (i.e. region-tree) data structure, which is also provided by the spatial library, or as we called, the spatial cartridge.
Further, as better detailed in the presentation, CQL accomplishes this in a pluggable form using links and cartridges, but this is the subject of a future post…