Github user alpinegizmo commented on a diff in the pull request: https://github.com/apache/flink/pull/4041#discussion_r119883183 --- Diff: docs/dev/libs/cep.md --- @@ -98,48 +128,106 @@ val result: DataStream[Alert] = patternStream.select(createAlert(_)) </div> </div> -Note that we use Java 8 lambdas in our Java code examples to make them more succinct. - ## The Pattern API -The pattern API allows you to quickly define complex event patterns. - -Each pattern consists of multiple stages or what we call states. -In order to go from one state to the next, the user can specify conditions. -These conditions can be the contiguity of events or a filter condition on an event. - -Each pattern has to start with an initial state: - -<div class="codetabs" markdown="1"> -<div data-lang="java" markdown="1"> -{% highlight java %} -Pattern<Event, ?> start = Pattern.<Event>begin("start"); -{% endhighlight %} -</div> - -<div data-lang="scala" markdown="1"> -{% highlight scala %} -val start : Pattern[Event, _] = Pattern.begin("start") -{% endhighlight %} -</div> -</div> - -Each state must have a unique name to identify the matched events later on. -Additionally, we can specify a filter condition for the event to be accepted as the start event via the `where` method. -These filtering conditions can be either an `IterativeCondition` or a `SimpleCondition`. - -**Iterative Conditions:** This type of conditions can iterate over the previously accepted elements in the pattern and -decide to accept a new element or not, based on some statistic over those elements. - -Below is the code for an iterative condition that accepts elements whose name start with "foo" and for which, the sum -of the prices of the previously accepted elements for a state named "middle", plus the price of the current event, do -not exceed the value of 5.0. Iterative condition can be very powerful, especially in combination with quantifiers, e.g. -`oneToMany` or `zeroToMany`. +The pattern API allows you to quickly define complex pattern sequences that you want to extract +from your input stream. + +Each such complex pattern sequence consists of multiple simple patterns, i.e. patterns looking for +individual events with the same properties. These simple patterns are called **states**. A complex pattern +can be seen as a graph of such states, where transition from one state to the next happens based on user-specified --- End diff -- ... where transitions from one state to the next occur ...
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---