Event Processing Course Event Patterns (relates to chapter 9)

Slides:



Advertisements
Similar presentations
Computer Systems & Architecture Lesson 2 4. Achieving Qualities.
Advertisements

XML Data Management 8. XQuery Werner Nutt. Requirements for an XML Query Language David Maier, W3C XML Query Requirements: Closedness: output must be.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Semantics and Evaluation Techniques for Window Aggregates in Data Streams Jin Li, David Maier, Kristin Tufte, Vassilis Papadimos, Peter A. Tucker SIGMOD.
FPA – IFPUG CPM 4.1 Rules.
New Kind of Logic The first step to approch this questions consists of a new definition of logic operators able to explain the richness of the events happened.
Chapter 5 Types. 5-2 Topics in this Chapter Values vs. Variables Types vs. Representations Type Definition Operators Type Generators SQL Facilities.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Planning under Uncertainty
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
CMPT 431 Dr. Alexandra Fedorova Lecture VIII: Time And Global Clocks.
Dynamic policies through context-sensitive situations Opher Etzion IBM Research Laboratory in Haifa.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
1 Software Testing and Quality Assurance Lecture 30 - Introduction to Software Testing.
Event Processing Course Event Types (relates to chapter 3)
Copyright ©2009 Opher Etzion Event Processing Course Lecture 10 – Focal points on challenging topics (related to chapter 11)
Copyright ©2009 Opher Etzion Event Processing Course Engineering and implementation considerations (related to chapter 10)
Copyright ©2009 Opher Etzion Event Processing Course Filtering and transformation (Relates to Chapter 8)
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
Event Processing Course Event processing networks (relates to chapter 6)
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. SQL - part 2 - Database Management Systems I Alex Coman, Winter 2006.
Database Systems More SQL Database Design -- More SQL1.
Describing Syntax and Semantics
Event Processing Course Producers and consumers (relates to chapters 4 + 5)
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Hall, Accounting Information Systems, 7e ©2011 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly.
[ §6 : 1 ] 6. Basic Methods II Overview 6.1 Models 6.2 Taxonomy 6.3 Finite State Model 6.4 State Transition Model 6.5 Dataflow Model 6.6 User Manual.
CHAPTER 7: SORTING & SEARCHING Introduction to Computer Science Using Ruby (c) Ophir Frieder at al 2012.
Protein Structure Alignment by Incremental Combinatorial Extension (CE) of the Optimal Path Ilya N. Shindyalov, Philip E. Bourne.
Interaction Modeling. Sequence Models  There are two kinds of sequence models: scenarios and sequence diagrams  A scenario is a sequence of events that.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
1 Data Modeling : ER Model Lecture Why We Model  We build models of complex systems because we cannot comprehend any such system in its entirety.
Faculty of Informatics and Information Technologies Slovak University of Technology Peter Kajsa and Ľubomír Majtás Design.
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Lambdas and Streams. Functional interfaces Functional interfaces are also known as single abstract method (SAM) interfaces. Package java.util.function.
Sorting HKOI Training Team (Advanced)
1 2. Independence and Bernoulli Trials Independence: Events A and B are independent if It is easy to show that A, B independent implies are all independent.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
Codes Codes are used for the following purposes: - to detect errors - to correct errors after detection Error Control Coding © Erhan A. Ince Types: -Linear.
CS212: Object Oriented Analysis and Design Lecture 13: Relationship between Classes.
Simulation of a Generic Cellular Manufacturing System Using Rockwell Arena Simulation Software This document provides a generic simulation model of a cellular.
Formal Specification of Intrusion Signatures and Detection Rules By Jean-Philippe Pouzol and Mireille Ducassé 15 th IEEE Computer Security Foundations.
NA62 Trigger Algorithm Trigger and DAQ meeting, 8th September 2011 Cristiano Santoni Mauro Piccini (INFN – Sezione di Perugia) NA62 collaboration meeting,
Selection Relational Expressions A condition or logical expression is an expression that can only take the values true or false. A.
CSE 1301 Lecture 8 Conditionals & Boolean Expressions Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
IS 230Lecture 6Slide 1 Lecture 7 Advanced SQL Introduction to Database Systems IS 230 This is the instructor’s notes and student has to read the textbook.
CSCI 256 Data Structures and Algorithm Analysis Lecture 6 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Chapter 6 The Relational Algebra Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
1 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression.
CS3773 Software Engineering Lecture 06 UML State Machines.
Map-Reduce examples 1. So, what is it? A two phase process geared toward optimizing broad, widely distributed parallel computing platforms Apache Hadoop.
1 Chapter 5-1 Greedy Algorithms Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Risk Management Gateway (RMG) Overview. The Risk Management Gateway (RMG) is a web-based dashboard used to monitor, configure and control Futures & Options.
CLUSTERING HIGH-DIMENSIONAL DATA Elsayed Hemayed Data Mining Course.
Aggregator Stage : Definition : Aggregator classifies data rows from a single input link into groups and calculates totals or other aggregate functions.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Logical Database Design and the Rational Model
Internet of Things Amr El Mougy Alaa Gohar.
Chapter (6) The Relational Algebra and Relational Calculus Objectives
Datamining : Refers to extracting or mining knowledge from large amounts of data Applications : Market Analysis Fraud Detection Customer Retention Production.
UML Class Diagrams: Basic Concepts
COT 5611 Operating Systems Design Principles Spring 2012
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Event-Based Architecture Definition Language
Time And Global Clocks CMPT 431.
Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract, Computer,
COT 5611 Operating Systems Design Principles Spring 2014
Presentation transcript:

Event Processing Course Event Patterns (relates to chapter 9)

Copyright ©2009 Opher Etzion 2 Lecture outline About patterns The notion of pattern Pattern types Patterns in FFD Some code examples

Copyright ©2009 Opher Etzion 3 The many faces of patterns in event processing Software Engineering Design Patterns Business User Patterns Pattern in the “pattern detecting” meaning We’ll concentrate on this one Say a few words about this one And leave this one for another opportunity Event processing function patterns We’ll start with this one

Copyright ©2009 Opher Etzion 4 Event processing patterns – the idea

Copyright ©2009 Opher Etzion 5 The EPA picture

Copyright ©2009 Opher Etzion 6 EPA signature The EPA signature consists of Where: EPA identifier is a unique name for the EPA instance EPA type: one of {filtering, transformation, pattern matching} Context: The set of criteria to partition the events of the input event types among the EPA instances. IET: a collection of input event types that the EPA receives from producers, channels or other EPAs OET: a collection of output event types derived by the EPA, and routed to channels, other EPAs or consumers. Relevance assertion: an assertion that is used to filter in the events instance in IET that are relevant for this specific EPA instance Pattern signature is defined in the next slide and defines the pattern logic. Derivation expression: Creation of the derived events.

Copyright ©2009 Opher Etzion 7 Pattern signature EVENT PATTERN An event pattern is a template specifying one or more combinations of events. Given any collection of events, you may be able to find one or more subsets of those events that match a particular pattern. We say that such a subset satisfies the pattern The pattern signature is formally defined as a tuple, PATTERN TYPE The pattern type is a label that determines the meaning and intention of the pattern and specifies the particular kind of matching function to be used. RELEVANT EVENT TYPES LIST The relevant event types list is a list of event types that forms part of the pattern matching function. The order of these event types has importance for some pattern functions. Some pattern types require additional values to be provided in the form of pattern parameters. PATTERN PARAMETERS Pattern parameters provide additional values used in the definition of the pattern function. The parameters that may be specified, and their meanings, vary depending on the pattern type. PATTERN POLICY A pattern policy is a named parameter that disambiguates the semantics of the pattern and the pattern matching process.

Copyright ©2009 Opher Etzion 8 An example Pattern name: Manual Assignment Preparation Pattern Type: Relative N highest Context: Bid Interval Participant event set: Delivery Bid Pattern parameter: N = 5; value = Ranking Cardinality: Single deferred

Copyright ©2009 Opher Etzion 9 Pattern types Pattern Logical Operators Threshold Subset Selection ModalTemporalSpatial Spatio Temporal

Copyright ©2009 Opher Etzion 10 Logical operators  all: The all pattern is satisfied when the relevant event set contains at least one instance of each event type in the participant set all: RET = {ET1…,ETn}; PS  MS = {E1,…,En}. The all pattern type is a function, where (E1…En)  MS iff  i: ETi  PET:  Ei  MS, such that: Type (Ei) = ETi  any: The any pattern is satisfied if the relevant event set contains an instance of any of the event types in the participant set any: RET = {ET1… ETn}; PS  MS = {E}. The any pattern type is a function, where E  MS iff  i: ETi  RET: such that: Type (E) = ETi.  Absence: The absence pattern is satisfied when there are no relevant events absence: (RET = {ET1…ETn}; RS  MS = { }. The absence pattern type is a function, where PS = , i.e. there are no relevant events of any of the types in RET.

Copyright ©2009 Opher Etzion 11 The not selected terminal example Events are emitted on the not selected terminal if they are not selected by any matching set.

Copyright ©2009 Opher Etzion 12 Threshold patterns The count pattern is satisfied when the number of instances in the relevant event set satisfies the count threshold assertion. The value max pattern is satisfied when the maximal value of a specific attribute over all the relevant events satisfies the value max threshold assertion The value min pattern is satisfied when the minimal value of a specific attribute over all the relevant events satisfies the value min threshold assertion. The value average pattern is satisfied when the value of a specific attribute, averaged over all the relevant events, satisfies the value average threshold assertion.

Copyright ©2009 Opher Etzion 13 Threshold patterns definitions Threshold pattern (PS, Threshold aggregate type pattern, binary operation, attribute name, threshold )  MS = PS iff the assertion: (aggregate type [attribute name] (PS), binary relation, threshold) is evaluated to true, where Aggregate types are: {count, value max, value min, value average, functor} and binary relations are {>, <, =, , ,  }.

Copyright ©2009 Opher Etzion 14 Subset selection patterns The relative N highest values pattern is satisfied by the events which have the N highest value of a specific attribute over all the relevant events, where N is an argument. –relative N highest value pattern [attribute]: (PS = {E1…Em})  MS, where >> is a descending order of the events in PS by the value of attribute, and Ei  MS iff its position in >>  N. The relative N lowest values pattern is satisfied by the event which has the minimal value of a specific attribute over all the relevant events –relative N lowest value pattern [attribute]: (PS = {E1…Em})  MS, where >> is an ascending order of the events in PS by the value of attribute, and Ei  MS iff its position in >>  N.

Copyright ©2009 Opher Etzion 15 Modal patterns The always pattern is satisfied when all the relevant events satisfy the always pattern assertion –always pattern [assertion]: (PS = { E 1 …E m })  MS, returns the entire RS iff  i: assertion (E i ) is evaluates to true The sometimes pattern is satisfied when there is at least one relevant event that satisfies the sometimes pattern assertion –sometimes pattern [assertion]: (PS = { E 1 …E m })  MS, returns the entire RS iff  i: assertion (E i ) is evaluates to true.

Copyright ©2009 Opher Etzion 16 Dimensional patterns – temporal The sequence pattern is satisfied when the relevant event set contains at least one event instance for each event type in the participant set, and the order of the event instances is identical to the order of the event types in the participant set. –sequence pattern: RET = {ET 1,…,ET n } PS  MS = {E1,…,En}. The sequence pattern type is a function, where  i: ET i  RET:  Ei  PS, such that: Type (E i ) = ET i, and  i, j: i > j IFF ETi >>ETj, where >> is a ascending order of the events according to the pattern order policy

Copyright ©2009 Opher Etzion 17 Trends patterns The increasing pattern is satisfied by an attribute A if for all the relevant events, e1 << e2  e1.A < e2.A The decreasing pattern is satisfied by an attribute A if for all the relevant events, e1 e2.A The stable pattern is satisfied by an attribute A if for all the relevant events, e1 << e2  e1.A = e2.A The non increasing pattern is satisfied by an attribute A if for all relevant events e1 << e2  e1.A  e2.A The non decreasing pattern is satisfied by an attribute A if for all relevant events e1 << e2  e1.A  e2.A The mixed pattern is satisfied by an attribute A, if the relevant event set contains event instances e1, e2, e3, e4 such that: e1 e4.A

Copyright ©2009 Opher Etzion 18 Trends pattern examples Fever – decreasing Blood pressure: –Systolic – increasing –Diastolic – non increasing Pulse – non decreasing Respiratory rate: stable Pain scale: mixed

Copyright ©2009 Opher Etzion 19 Spatial patterns The min distance pattern is satisfied when the minimal distance of all the relevant events from a given point satisfies the min distance threshold assertion The max distance pattern is satisfied when the maximal distance of all the relevant events from a given point satisfies the max distance threshold assertion The average distance pattern is satisfied when the average distance of all the relevant events from a given point satisfies the average distance threshold assertion

Copyright ©2009 Opher Etzion 20 Relative distance patterns The r elative min distance pattern is satisfied when the minimal distance between any two relevant events satisfies the min distance threshold assertion. The relative max distance pattern is satisfied when the maximal distance between any two relevant events satisfies the max threshold assertion The relative average distance pattern is satisfied when the average distance between any two relevant events satisfies the relative average threshold assertion

Copyright ©2009 Opher Etzion 21 Spatiotemporal patterns The moving in a constant direction pattern is satisfied if there exists a direction from the set {north, south, east, west, northeast, northwest, southeast, southwest} such that for any pair of relevant events e1, e2 we have e1 << e2  e2 lies in that direction relative to e1. The moving in a mixed direction pattern is satisfied if none of the eight moving in a consistent direction patterns is satisfied The stationary pattern is satisfied if the location of all relevant events is identical The moving toward pattern is satisfied when for any pair of relevant events e1, e2 we have e1 << e2  the location of e2 is closer to a certain object then the location of e1.

Copyright ©2009 Opher Etzion 22 A simple example: heavy trading scenario Given: –A stream of events of a single type, about the activity in the stock market for a certain stock. –An event is produced every 10 minutes when there is trade in the stock. –Each event consists of: quote (current stock-quote), volume (an accumulated volume of traded events within these 10 minutes). –A selection specification: “trigger an automatic trade program if the volume exceeds 300,000 3 times within an hour; pass as an argument the last quote and the sum of the 3 volume values”.  How many times the trade programming is triggered ;  Which arguments are used in each triggering? Why defining patterns is not that easy? Because we need to tune up the semantics

Copyright ©2009 Opher Etzion 23 Pattern policies Evaluation policy—This determines when the matching sets are produced. Cardinality policy—This determines how many matching sets are produced within a single context partition. Repeated type policy—This determines what happens if the matching step encounters multiple events of the same type. Consumption policy—This specifies what happens to a participant event after it has been included in a matching set. Order policy—This specifies how temporal order is defined.

Copyright ©2009 Opher Etzion 24 Evaluation policy An evaluation policy is a semantic abstraction that determines when the matching process is to be evaluated. The evaluation policy lets you choose whether a Patter detect agent generates output incrementally, or only at the end of the temporal context. The two policies are: Immediate—The pattern is tested for each time a new event is added to the participant event set. Deferred—The pattern is only tested for when the agent's temporal context partition (window) closes.

Copyright ©2009 Opher Etzion 25 Cardinality policies A cardinality policy is a semantic abstraction that controls how many matching sets are created. The possible policies are: single, unrestricted and bounded. The various policies are: Single—Only one matching set is generated. When this has been done no further action is performed within this context partition, so no more matching sets are generated. Unrestricted—Under this policy there are no restrictions on the quantity of matching sets that can be generated. Bounded—This policy specifies an upper bound on the number of matching sets that can be generated within a context partition. The Pattern detect agent continues generating matching sets until it reaches this bound.

Copyright ©2009 Opher Etzion 26 Repeated type policies A repeated type policy is a semantic abstraction that defines the behavior of a Pattern detect agent when an excess type condition occurs. The possible policies are: override, every, first, last, with maximal value, with minimal value. Override The participant event set keeps no more instances of any event type than the number implied by the relevant event types list. If a new event instance is encountered and the participant set already contains the required number of instances of that type, then the new instance replaces the oldest previous instance of that type. Every: Every instance is kept in the participant event set, so that all possible matching sets can be produced. First Every instance is kept in the participant event set, but only the earliest instances of each type are used for matching. Last Every instance is kept, but only the latest instances of each type are used for matching. With maximal value Every instance is kept, but only the event or events with the maximal value of the specified attribute are used for matching. With minimal value Every instance is kept, but only the event or events with the minimal value of the specified attribute are used for matching.

Copyright ©2009 Opher Etzion 27 Consumption policies A consumption policy is a semantic abstraction that defines whether an event instance is consumed as soon as it is included in a matching set, or whether it can be included in subsequent matching sets. Possible consumption policies are: consume, reuse and bounded reuse. The consumption policies are quite straightforward: Consume—Under this policy each event instance is removed from the participant event set once it has been included in a matching set. This means that it cannot take part in any further matching for this particular pattern within the same context. Reuse—under this policy, an event instance can participate in an unrestricted number of matching sets. Bounded reuse—under this policy, you can specify the number of times that an event can be used in matching sets for this particular pattern within the same context.

Copyright ©2009 Opher Etzion 28 Order policies An order policy is a semantic abstraction that defines the meaning of the << temporal order of the event instances in the participant event set. The possible policies are: by occurrence time, by detection time, by user-defined attribute, or by stream position. The order policy is applicable to all temporal or spatiotemporal patterns. The possible policies are: By occurrence time—The order of events in the participant event set is determined by comparing their occurrence time attributes, so that the order reflects the order in which the events happened in reality (as accurately as the temporal granularity allows). By detection time—The order of events in the participant event set is determined by comparing their detection time attributes, that is the order in which events are detected by the event processing system. Note that this order may not be identical to the order in which events happened in reality. By user-defined attribute—Some event payloads contain a timestamp, sequence number or some other attribute that increases over time, and this can be used to determine the order. For example the Delivery Request events in the Fast Flower Delivery application could be ordered using their Delivery Time attribute. By stream position—In this case the order to be used is the order in which the events are delivered to the event processing agent from the channel that feeds it. Some channel implementations are designed so that this order is the same as the order in which events were delivered to the channel

Copyright ©2009 Opher Etzion 29 FFD patterns Automatic assignment Manual assignment preparation Assignment not done Pickup Alert Delivery Alert Ranking Increase Ranking Decrease

Copyright ©2009 Opher Etzion 30 FFD patterns (cont). Improving note Permanent weak driver Idle driver Consistent weak driver Consistent strong driver Improving driver

Copyright ©2009 Opher Etzion 31 Apama example

Copyright ©2009 Opher Etzion 32 Streambase example

Copyright ©2009 Opher Etzion 33 Esper example /** * No bid after 2 mins of a request */ insert into AlertW(requestId, message, driver) select d.requestId, "no bidder", "" from pattern[ every d=DeliveryRequest -> (timer:interval(120 sec) and not DeliveryBid(requestId = d.requestId)) ];

Copyright ©2009 Opher Etzion 34 What have we learned Pattern in general Event pattern notions Pattern types Patterns in FFD Some code examples