We have added a new sample solution to our samples package on CodePlex. This sample uses the StreamInsight extensibility framework to implement a pattern detection application. The solution can be found in Applications\PatternDetector contains – apart from the used adapters – the following projects:
- AugmentedFiniteAutomaton (refers to a project in UserExtensions), which implements a pattern matching user-defined operator.
- PatternDetector, which uses the user-defined operator to look for a V-pattern in a stock ticker stream
Our pattern matching user-defined operator is based on an augmented finite automaton (AFA) – which is basically a non-deterministic finite automaton (NFA) with additional information, called a register, that can be created and maintained as part of the automaton during runtime.
The PatternDetector example uses a sample input stream of stock prices as point events (read from a file with the SimpleTextFileReader input adapter), and defines an AFA that detects a sequence of downticks followed by an equal number of upticks. We detect the pattern over a tumbling window of one hour. The corresponding AFA is shown in the file AFAexample.pptx (included in the solution), and is implemented in AFA_EqualDownticksUpticks.cs. The output is simply dumped on the console.
For more information on pattern matching using AFA, see:
Badrish Chandramouli, Jonathan Goldstein, and David Maier. High-Performance Dynamic Pattern Matching over Disordered Streams. In VLDB 2010.