This generic operator allows the definition of different kinds of pattern (e.g. all, any). For sequence based patterns see SASE operator (below). In the following the implemented pattern types are desribeddescribed.
Parameter
type
: What kind The type of pattern that should be detected. See below for a list of all supported types and examples.eventTypes
: Describes the types of the input portstime
: If there should be a temporal context (window) this states the time andinterval size.timeUnit
is the unit of this time: If there should be a temporal context, this states the time unit.size
: For element based windows, this is the count of elements that are treated together, size and time can be used togetherassertions
: Predicate over the input data that must be fullfilled to create an outputoutputmode
: states, what the operator should deliver:- EXPRESSION: use the
return
parameter to create the output - INPUT: Deliver events from input port 0, can be changed with parameter
inputPort
- TUPLE_CONTAINER: Deliver all events that are related to this matching
- SIMPLE
- EXPRESSION: use the
return
: seeoutputmode
/EXPRESSIONinputPort
: seeoutputmode
/INPUT
Logical Pattern
ALL
Beschreibung
Die Anfrage wählt zu einem Gebot, mit einemWert höher als 200, und zu der Person, die das Gebot abgegeben hat, die ID und den Namen der Person und den Preis des Gebots aus. Berücksichtigt werden nur Personen und Gebote, die nicht älter als 10 min sind. Zusammenfassend könnte man also sagen, dass die Anfrage die Personen auswählt, die innerhalb von 10 min nach ihrem Erscheinen bereits ein Gebot mit einem Wert über 200 abgeben.
Possible Parameter
assertions, time, timeUnit, size, outputMode, return, inputPort
Besonderheiten
time und size legen fest, wie lange bzw. wie viele Events zwischengespeichert werden
The ALL type selects all events that match a given pattern.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'ALL', eventTypes = ['person', 'bid'],
time = 10, timeUnit = | ||
Code Block | ||
| ||
PATTERN({type = 'ALL', eventTypes = ['person', 'bid'], time = 10, timeUnit = 'MINUTES', assertions = ['person.id = bid.bidder && bid.price > 200'], outputmode = 'EXPRESSIONS', return = ['person.id', 'person.name', 'bid.price']}, person, bid) |
In the example, the query selects a bid, with a value higher than 200, and the person who won the bid, the ID and name of the person
...
and the price of the bid. Be taken into account only persons and commandments, which are not older than 10 min. In summary, one could say that the request selects the persons within 10 min after its release already bid with a value over 200 exits. The time and size parameter determine how long and how many events are cached.
ANY
The ANY type selects one event that matches the given pattern
ANY
Beschreibung
Die Anfrage wählt jedes Gebot mit einem Wert höher als 200 aus.
Mögliche Parameter
assertions, outputMode, return, inputPort
Besonderheiten
Die i-te Assertion gilt jeweils nur für Events des Typs, der an i-ter Stelle der relevanten Event-Typ-Liste steht.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'ANY', eventTypes = ['bid'], assertions = ['bid.price > 220'], outputMode = 'INPUT'}, bid) |
ABSENCE
Beschreibung
Die Anfrage erkennt, wenn 400 Millisekunden kein Gebot abgegeben wurde.
Mögliche Parameter
assertions, time, timeUnit, outputMode
Besonderheiten
In the example, the query selects the request of each bid with a value higher than 200 from. The i-th assertion applies only to events of the type that is the i-th position of the relevant Event Type list.
ABSENCE
The ABSENCE type detects the absence of a particular event in the streamErfolg und Genauigkeit ist abhängig von den Heartbeats. Als Ausgabemodus ist nur SIMPLE möglich.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'ABSENCE', eventTypes = ['bid'],
outputMode = 'SIMPLE', time = 400}, bid) |
Threshold
COUNT
Beschreibung
Die Anfrage ist erfüllt, sobald mehr als 20 Gebote abgegeben wurden.
Mögliche Parameter
assertions, outputMode, return, inputPort
Besonderheiten
,
outputMode = 'SIMPLE', time = 400}, bid) |
In the example, the query recognizes the request if 400 milliseconds was no bid. Success and accuracy depends on the heartbeats. As output mode only SIMPLE is possible.
Threshold Pattern
COUNT
The COUNT type triggers as soon as the given number of events are detectedBeruht momentan auf dem Any-Pattern, das als Eingabe eine Aggregation von außen bekommt.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'FUNCTOR', eventTypes = ['aggr'], assertions = ['count_price > 20']}, AGGREGATE({aggregations = [['COUNT', 'price', 'count_price', 'double']]}, bid)) bid)) |
The request is fulfilled once more than 20 bids were submitted. Any currently based on the pattern, the aggregation gets as input from the outside.
VALUE-MAX
Beschreibung
Die Anfrage ist erfüllt, sobald der maximale Wert eines Gebots 300 übersteigt.
Mögliche Parameter
assertions, outputMode, return, inputPort
Besonderheiten
Beruht momentan auf dem Any-Pattern, das als Eingabe eine Aggregation von außen bekommt.
The VALUE-MAX type triggers as soon as the given value is exceeded.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'FUNCTOR', eventTypes = ['bid'], assertions = ['max_price > 300']}, AGGREGATE({aggregations=[['MAX', 'price', 'max_price', 'double']]}, bid)) |
VALUE-MIN
Beschreibung
Die Anfrage ist erfüllt, solange der minimale Wert eines Gebots größer als 50 und kleiner als 100 ist.
Mögliche Parameter
assertions, outputMode, return, inputPort
Besonderheiten
The request is fulfilled as soon as the maximum value of the bid exceeds 300. Any currently based on the pattern, the aggregation gets as input from the outside.
VALUE-MIN
The VALUE-MIN type triggers as soon as the given value fall below the given threshold.
Beruht momentan auf dem Any-Pattern, das als Eingabe eine Aggregation von außen bekommt.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'FUNCTOR', eventTypes = ['bid'], assertions = ['min_price > 50 && min_price < 100']}, AGGREGATE({aggregations=[['MIN', 'price', 'min_price', 'double']]}, bid)) |
VALUE-AVERAGE
Beschreibung
Die Anfrage ist erfüllt, wenn das arithmetische Mittel eines Gebotes kleiner als 140 ist.
Mögliche Parameter
assertions, outputMode, return, inputPort
Besonderheiten
Beruht momentan auf dem Any-Pattern, das als Eingabe eine Aggregation von außen bekommt.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'FUNCTOR', eventTypes = ['bid'], assertions = ['avg_price < 140']}, AGGREGATE({aggregations=[['AVG', 'price', 'avg_price', 'double']]}, bid)) |
Subset Selection Pattern
RELATIVE-N-HIGHEST
Beschreibung
Die Anfrage wählt alle sechs Sekunden die drei höchsten Gebote aus.
...
attribute, count, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Der Ausgabemodus SIMPLE ist zwar möglich, macht aber nicht soviel Sinn.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'RELATIVE_N_HIGHEST', eventTypes = ['bid'], attribute = 'price', count = 3, time = 6, timeUnit = 'SECONDS', outputmode = 'expressions', return = ['bid.timestamp', 'bid.bidder', 'bid.price']}, bid) |
RELATIVE-N-LOWEST
Beschreibung
Die Anfrage wählt alle sechs Sekunden aus den Geboten, die höher als 80 sind, die drei niedrigsten Gebote aus.
...
attribute, count, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Der Ausgabemodus SIMPLE ist zwar möglich, macht aber in diesem Kontext normalerweise keinen Sinn.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'RELATIVE_N_LOWEST', eventTypes = ['bid'], assertions = ['price > 80'], attribute = 'price', count = 3, time = 10, timeUnit = 'SECONDS', outputmode = 'TUPLE_CONTAINER'}, bid) |
Modale Pattern
ALWAYS
Beschreibung
Wenn innerhalb dem festen Intervall von drei Sekunden alle Gebote größer als 140 sind, werden diese von dem Pattern ausgegeben.
Benötigte Parameter
time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'ALWAYS', eventTypes = ['bid'], time = 3, timeUnit = 'SECONDS', assertions = ['bid.price > 140'], outputMode = 'INPUT'}, bid) |
SOMETIMES
Beschreibung
Das Pattern ist erfüllt, wenn innerhalb dem festen Intervall von zehn Sekunden mindestens ein Gebot größer als 280 ist.
Benötigte Parameter
time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'SOMETIMES', eventTypes = ['bid'], time = 10, timeUnit = 'SECONDS', assertions = ['bid.price > 280']}, bid) |
Temporal Order Pattern
SEQUENCE
Beschreibung
Die Anfrage wählt Attribute von Personen und den Geboten der jeweiligen Personen aus, bei denen die Person vor den Gebot auftritt und sein Gebot größer als 200 ist.
Besonderheiten
Die Anfrage basiert auf dem SASE-Operator. Der Parameter query erwartet eine Anfrage, die in der SASE-Anfragesprache formuliert ist. Vgl. SASE
Code Block | ||
---|---|---|
| ||
SASE({query = 'PATTERN SEQ(person p, bid b) WHERE skip_till_next_match(p,b) {p.id = b.bidder, b.price > 200} RETURN p.id, p.name, b.price', schema=[['id','Integer'],'name','String'], type='PersonEvent1'} , person, bid) |
FIRST-N
Beschreibung
Die Anfrage wählt alle zehn Sekunden die ersten drei Gebote aus, die größer als 100 sind und gibt die angegebenen Attribute aus.
Benötigte Parameter
count, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Der Ausgabemodus SIMPLE ist zwar möglich, macht aber in diesem Kontext normalerweise keinen Sinn.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'FIRST_N', eventTypes = ['bid'], time = 10, timeUnit = 'SECONDS', count = 3, assertions = ['bid.price > 100'], outputmode = 'EXPRESSIONS', return = ['bid.timestamp', 'bid.bidder', 'bid.price']}, bid) |
LAST-N
Beschreibung
Die Anfrage wählt alle zehn Sekunden die letzten drei relevanten Events aus. Dies können Gebote und Auktionen sein.
Benötigte Parameter
count, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Der Ausgabemodus SIMPLE ist zwar möglich, macht aber in diesem Kontext normalerweise keinen Sinn. Beinhaltet die Ausgabe verschiedene Event-Typen macht der Ausgabemodus TUPLE_CONTAINER Sinn, da bei dort das Schema der Daten keine Rolle spielt. Bei anderen Ausgabemodi entstehen unter Umständen null-Werte oder ähnliches.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'LAST_N', eventTypes = ['person', 'auction'], time = 10, timeUnit = 'SECONDS', count = 3, outputmode = 'TUPLE_CONTAINER'}, auction, person) |
Trend Pattern
INCREASING
Beschreibung
Das Pattern ist erfüllt, wenn die Werte der Gebote innerhalb des festen Zeitintervalls von 2 Sekunden streng monoton steigen.
...
attribute, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'INCREASING', eventTypes = ['bid'], attribute = 'price', time = 2, timeUnit = 'SECONDS'}, bid) |
DECREASING
Beschreibung
Das Pattern ist erfüllt, wenn die Werte der Gebote innerhalb des festen Zeitintervalls von 2 Sekunden streng monoton fallen.
...
attribute, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'DECREASING', eventTypes = ['bid'], attribute = 'price', time = 2, timeUnit = 'SECONDS'}, bid) |
STABLE
Beschreibung
Das Pattern ist erfüllt, wenn sich die Werte der Gebote innerhalb des festen Zeitintervalls von 2 Sekunden nicht ändern.
...
attribute, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'STABLE', eventTypes = ['bid'], attribute = 'price', time = 2, timeUnit = 'SECONDS'}, bid) |
NON-INCREASING
Beschreibung
Das Pattern ist erfüllt, wenn die Werte der Gebote innerhalb des festen Zeitintervalls von 2 Sekunden monoton fallen.
...
attribute, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'NON_INCREASING', eventTypes = ['bid'], attribute = 'price', time = 2, timeUnit = 'SECONDS'}, bid) |
NON-DECREASING
Beschreibung
Das Pattern ist erfüllt, wenn die Werte der Gebote innerhalb des festen Zeitintervalls von 2 Sekunden monoton steigen.
...
attribute, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'NON_DECREASING', eventTypes = ['bid'], attribute = 'price', time = 2, timeUnit = 'SECONDS'}, bid) |
NON-STABLE
Beschreibung
Das Pattern ist das Gegenstück zum Stable-Pattern. Es ist erfüllt, wenn sich die Werte von drei aufeinanderfolgenden Gebote ändern.
...
attribute, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'NON_STABLE', eventTypes = ['bid'], attribute = 'price', size = 3}, bid) |
MIXED
Beschreibung
Das Pattern ist erfüllt, wenn die Werte der Gebote innerhalb des festen Zeitintervalls von 2 Sekunden mindestens einmal streng monoton steigen und mindestens einmal streng monoton fallen.
...
attribute, time oder size
Mögliche Parameter
assertions, outputMode, return, inputPort, timeUnit
Besonderheiten
Ist der Ausgabemodus nicht SIMPLE, werden bei der Erfüllung des Patterns alle relevanten Events ausgegeben, die die Assertions erfüllen.
Code Block | ||
---|---|---|
| ||
PATTERN({type = 'MIXED', eventTypes = ['bid'], attribute = 'price', time = 2, timeUnit = 'SECONDS'}, bid) |