Designing Intelligent Event Processor (IEP) Projects

Stream Projection and Filter

The Stream Projection and Filter operator enables you to join a stream with multiple relations and tables, in order to create new events or to filter existing events based on specified conditions.

The input to the Stream Projection and Filter operator must include one (and only one) stream. The input can also include any number of relations and tables.

The output from the Stream Projection and Filter operator is a stream.

Configuring the Stream Projection and Filter operator resembles the process of writing a SQL SELECT statement. The property editor includes a SELECT area, a FROM area, and a WHERE area. The property editor also includes a tree structure that contains the input operators and their attributes.

Screen capture of the property editor for the Stream
Projection and Filter operator.

In the SELECT area, you populate a table with one or more attributes. You can quickly add an existing attribute by selecting the attribute in the tree structure and dragging it to the Expression column. You can create a new attribute by using a mathematical computation in the Expression column. In the following example, two existing attributes are multiplied to create the new attribute.


total=Products.price*Products.tax

You can remove an attribute from the input stream by not including it in the SELECT area.

In the WHERE area, you can specify a search condition in the form of a boolean value expression. The boolean value expression can include the following types of predicates: comparison, between, in, like, null, quantified comparison, and exists.

One of the IEP tutorials uses the Stream Projection and Filter operator to check whether the price of each stock transaction is significantly different from the average price of all stock transactions during the last two minutes. The operator contains the following WHERE clause:


StockTransactions.symbol=RollingAvgPrice.symbol AND
(StockTransactions.price > 1.1 * RollingAvgPrice.price OR
StockTransactions.price < 0.9 * RollingAvgPrice.price)

ProcedureTo Create a Stream Projection and Filter Operator

  1. Drag a Stream Projection and Filter operator from the Palette to the Design view.

  2. Connect the output of an operator that has stream output to the input of the Stream Projection and Filter operator.

  3. (Optional) Connect the output of one or more operators that have relation output to the input of the Stream Projection and Filter operator.

  4. (Optional) Connect the output of one or more operators that have table output to the input of the Stream Projection and Filter operator.

  5. Double-click the Stream Projection and Filter operator.

    The property editor opens.

  6. If you want to change the default name, then change the value in the Name field.

  7. In the SELECT area, populate the table with one or more attributes.

    By default, the SELECT area contains only one attribute row. To create additional rows, click Add Attribute.

    You can drag and drop attributes from the tree structure into the Expression column. If you use this approach, then the operator name is automatically added to the FROM area.

  8. In the FROM area, specify the names of one or more input operators.

    You can drag and drop operators from the tree structure into the FROM area.

    You can specify an alias for a table (for example, TableInput0 t) and then use the alias in the WHERE clause. You cannot specify an alias for a stream or a relation.

    If you specify more than one operator name, then separate the names with a comma (for example, StockTransactions,RollingAvgPrice).

  9. (Optional) In the WHERE area, specify a search condition in the form of a boolean value expression.

    You can drag and drop operators and attributes from the tree structure into the WHERE area.

  10. Click OK.