Relations Relations and Oracle CEP Tuple Kind Indicator

1-8 Oracle Complex Event Processing CQL Language Reference ■ + for inserted tuple ■ - for deleted tuple ■ U for updated tuple indicated when invoking com.bea.wlevs.ede.api.RealtionSink method onUpdateEvent for more information, see Oracle Complex Event Processing Java API Reference.

1.1.2 Relation-to-Relation Operators

The relation-to-relation operators in Oracle CQL are derived from traditional relational queries expressed in SQL. Anywhere a traditional relation is referenced in a SQL query, a relation can be referenced in Oracle CQL. Consider the following examples for a stream CarSegStr with schema: car_id integer, speed integer, exp_way integer, lane integer, dir integer, and seg integer. In Example 1–7 , at any time instant, the output relation of this query contains the set of vehicles having transmitted a position-speed measurement within the last 30 seconds. Example 1–7 Relation-to-Relation Operation processor namecqlProcessorname rules view id=CurCarSeg schema=car_id exp_way lane dir seg[CDATA[ select distinct car_id, exp_way, lane, dir, seg from CarSegStr [range 30 seconds] ]]query rules processor The distinct operator is the relation-to-relation operator. Using distinct, Oracle CEP returns only one copy of each set of duplicate tuples selected. Duplicate tuples are those with matching values for each expression in the select list. You can use distinct in a select_clause and with aggregate functions. For more information on distinct, see: ■ Chapter 9, Built-In Aggregate Functions ■ select_clause::= on page 20-3

1.1.3 Stream-to-Relation Operators Windows

Oracle CQL supports stream-to-relation operations based on a sliding window. In general, S[W] is a relation. At time T the relation contains all tuples in window W applied to stream S up to T. Introduction to Oracle CQL 1-9 window_type::= Oracle CQL supports the following built-in window types: ■ Range: time-based S[Range T], or, optionally, S[Range T1 Slide T2] ■ Range: time-based unbounded S[Range Unbounded] ■ Range: time-based now S[Now] ■ Range: constant value S[Range C on ID] ■ Tuple-based: S[Rows N], or, optionally, S[Rows N1 Slide N2] ■ Partitioned: S[Partition By A1 ... Ak Rows N] or, optionally, S[Partition By A1 ... Ak Rows N Range T], or S[Partition By A1 ... Ak Rows N Range T1 Slide T2] This section describes the following stream-to-relation operator properties: ■ Section 1.1.3.1, Range, Rows, and Slide ■ Section 1.1.3.2, Partition ■ Section 1.1.3.3, Default Stream-to-Relation Operator For more information, see: ■ Range-Based Stream-to-Relation Window Operators on page 4-6 ■ Tuple-Based Stream-to-Relation Window Operators on page 4-13 ■ Partitioned Stream-to-Relation Window Operators on page 4-18

1.1.3.1 Range, Rows, and Slide

The keywords Range and Rows specify how much data you want to query: