Saturday, September 26, 2009

On Contexts

Sometimes I feel out of context, but today I would like to return to the notion of context, which is the topic of chapter 7 of the EPIA book. I have discussed the notion of context first time almost two years ago, and since then mentioned it in some other postings; so now it is a good time to talk more about it. A context, in essence, is a grouping of events that are processed together. This grouping may be: temporal, spatial, state oriented, or segmentation oriented, as seen in the figure below.

Temporal context may be fixed interval, interval that start and end in the occurrence (or detection) of events, and also sliding interval, according to time, or number of events. Spatial contexts can relate to fixed location, to distance from an entity, and to distance from the location of event occurrence, state oriented refers to external state (e.g. weather), and segmentation oriented, refers to partition of the event space according to some assertion (e.g. simple partition can be: platinum customers, gold customers and other type of customers). A context can be composite such as: spatial and temporal together.

What is the role of context in event processing ? first - an event processing agent lives within a context, in different contexts, the same event can be processed by different event processing agents. Second - it determines which events are processed together as input for the same pattern detection (AKA "complex event processing"). For example, if we are looking for the behavior of a single customer within a single day, then this is a combination of a temporal context (day) and a segmentation context (partition by customer), and each of them is processed in looking for a distinct pattern. This is a description of contexts in a nutshell. Some languages support kinds of temporal contexts ("window" or "sliding window"), some have more developed notion of context, and some have none. I'll write more about context types in one of the next postings.


Marco Seiriƶ said...

Ah Context, my favorite topic :)

What about relationships? Could not events be included in the context based on relationships?

like: if car is inside container include all events from entity car.

Opher Etzion said...

Hello Marco. How is the context support in RuleCore is advancing ?

For your question --- relationships can be done using the segmentation dimension typically, in the example you specified this may be also a spatial context of distance from an object (note that the object may be moving).



Marco Seiriƶ said...

Work on context is progressing nicely. We are putting a big part of our development efforts into creating a good way to manage the context in which our rules are evaluated.

Our definition is more or less the same that you use: A set of events with properties that match some criteria.

We associate a context to each rule and then we allow for inclusion of events into the context depending on the properties of the events or properties of the context itself.

It seems that a good concept for context management is the key for powerful and simple definition of rules. Without good context, everything gets complicated and you tend to push complexity into the rules instead.

With rich context management downstream processing gets much simpler so improving context management is prio one around here.

Hans said...

I agree that contexts are interesting, and are one of the things that I have learned about by following this blog. Previously I did not consider the idea of a context, but had a more narrow concept to express dividing up events.

I would be interested to hear about how the context concept works in a particular use case: Let's say I have events that contain, among other things, a number. I would like to capture the third quartile (a data point that sits immediately above 75% of the other points) of the number, every hour. I would then like to perform some operation over the previous 8 of these hourly numbers.

How would this be expressed as contexts and agents?