Creating and Modifying Pattern Queries

Run a pattern matching query that watches for a specific pattern of incoming events on one or more inputs and produces an output event when the pattern is detected. Pattern uses the CCL MATCHING clause.

  1. In the Visual editor Palette, in Streams and Windows, click Pattern (patternstream.gif).
  2. Select a location in the diagram and click to add the shape.
  3. Connect the Pattern shape to one or more streams or windows that are the inputs to query.
  4. Add columns:
    1. Click Copy Columns from Input (copycolumn.gif) in the shape toolbar to select the columns to copy into the schema for the Pattern query.
      This is the schema of the new event that is produced when the pattern is detected.
    2. Add additional columns by clicking Add Column Expression compute_template.gif in the shape toolbar.
    3. Edit a column expression by double-clicking to open the inline editor, by selecting one of the tabs in the Properties view, or by selecting an expression and pressing Ctrl+F2 to edit it using the pop-up expression editor.
    Tip: When entering column names and their datatypes, use Tab to easily move between cells in the table.
  5. Create and edit a pattern expression:
    1. Click Add Pattern (patternstream.gif).
    2. Enter an alias for the event.
    3. Enter either a time interval or parameters.
    4. To define the expression, right-click Pattern to add an event. Continue right-clicking elements of the expression to add operators and refine the event expression. Then click Next.
    5. Click Add to add a join condition.
    For details of valid pattern expressions, see ON Clause: Pattern Matching Syntax in the Programmers Guide.
  6. (Optional) Use the toggle stream.gif option to designate the pattern object as LOCAL or OUTPUT. By default, patterns are Output.
Related concepts
Simple Queries
Related tasks
Creating and Modifying Filter Queries
Creating and Modifying Aggregate Queries
Creating and Modifying Compute Queries
Creating and Modifying Join Queries
Creating and Modifying Union Queries