Creating and Modifying Simple Queries: Pattern

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 Expressions compute_template.gif in the shape toolbar.
    3. Edit a column expression by double-clicking to open the inline editor, or by selecting the expression and pressing Ctrl+F2 to open it in the pop-up editor.
  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 CCL Programmers Guide.
  6. (Optional) Use the toggle stream.gif option to designate the pattern object as LOCAL or OUTPUT.
Related concepts
Simple Queries
Related tasks
Creating and Modifying Simple Queries: Filter
Creating and Modifying Simple Queries: Aggregate
Creating and Modifying Simple Queries: Compute
Creating and Modifying Simple Queries: Join
Creating and Modifying Simple Queries: Union