Top Banner
Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research Group
39

Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

Composite Event Specification in Active Database Systems: A Petri Nets Approach

Xiaoou Li,

Joselito Medina Marín,

Lorena Chavarría

Petri Nets Research Group

Page 2: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 2

Sección de ComputaciónDepartamento de Ingeniería Eléctrica  Centro de Investigación y de Estudios Avanzados del IPN  MEXICO 

http://www.cs.cinvestav.mx/

Page 3: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 3

Outline:

Motivation Event-Condition-Action (ECA) rules Conditional Colored Petri Nets (CCPN) ECA-PN Simulator (ECAPNSim) Termination analysis Complexity analysis Conclusion

Page 4: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 4

Motivation

OurOur experience: experience: X. Li, W. Yu and F. Lara, “Dynamic X. Li, W. Yu and F. Lara, “Dynamic knowledge inference and learning under knowledge inference and learning under adaptive fuzzy Petri net framework”, adaptive fuzzy Petri net framework”, IEEE Trans. SMC-CIEEE Trans. SMC-C, 30(4), 442-450, 2000, 30(4), 442-450, 2000

CCPNCCPN

ECAPNSimECAPNSim Applications

• The knowledge and execution The knowledge and execution models of ECA rules are models of ECA rules are separated;separated;• Rule base management is Rule base management is application-dependent.application-dependent.

Page 5: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 5

ECA rules

ON event

IF condition

THEN action

ON update BONUS_amount, IF update.amount > 100, THEN update EMP set rank = old.rank + 1

where emp_id = update.emp_id;

Page 6: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 6

ECA rule execution

User Transactions DB

DBAction

Condition over

DB State

C-A of Rule

Other Actions

Event Detector

Fire RuleEvent

Other Events

Action

Page 7: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 7

Events in ECA rules

Primitive events Composite events

1. Conjunction: e1 e22. Disjunction: e1 e23. Sequence: seq(e1, e2)4. Simultaneous: sim (e1, e2)5. History: times(n, e1) in [d1, d2]6. Negation: ~e1 in [d1, d2]7. Any: any(m, e1, e2, …, en), n>m

Page 8: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 8

Conditional Colored Petri Nets-CCPN

CCPN={Σ, P, T, A, N, C, Con, Action, D}

Con is a condition function. ∀t T∈ rule: Type(Con(t))=B, where Con function evaluates the

rule condition; ∀t T∈ comp: Type(Con(t))=B, where Con function evaluates the

temporal condition.

D assigns a time interval [d1, d2] to t T∈ comp.

Action is an action function. ∀t T∈ rule, p∈ : Type(Action(t))=C(p)MS.

Token element TE (p,c,timestemp)

t

Page 9: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 9

CCPN elements

Composite transition

Rule transition

Primitive place

Copy place

Virtual place

Composite place

Copy transition

Normal arc

Inhibitor arc

Page 10: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 10

Modeling ECA rules with CCPN

ON event

IF condition

THEN action

T1 RULE 1

Page 11: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 11

Modeling ECA rules with CCPN

rule 001,ON update BONUS_amount, IF update.amount > 100, THEN update EMP set rank = old.rank + 1

where emp_id = update.emp_id;

p1

p2

T1p1: update_BONUS_amountT1: rule 001condition on T1: update.amount > 100p2: update_EMP_rank token color in p1: any BONUS_amounttoken color in p2: EMP_rank = old.rank + 1

where emp_id = update.emp_id

Page 12: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 12

Modeling Composite events with CCPN…

Conjunction Disjuntion

Color ec : e1 e2

e1 e2

ec

T1

e1 e2

ec

Color ec : e1 e2

T1 T2

Page 13: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 13

Modeling Composite events with CCPN…

Negation

Color ec : ~e1 in [d1, d2]

e1

ec

T1

Sequence

Color ec : seq(e1, e2)

e1 e2

ec

T1 if (e1) < (e2)

Page 14: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 14

Modeling Composite events with CCPN…

Simultaneous

Color ec : sim (e1, e2)

e1 e2

ec

if (e1) = (e2) T1

Color ec : times(n, e1) in [d1, d2]

e1

ec

n

T1

History

Page 15: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 15

Modeling Composite events with CCPN…

Any

Color ec : any(m, e1, e2, …, en)

e0

m

e1 e2 en…

ec

T2T1 Tn

T0

Page 16: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 16

Conversion from ECA rules to CCPN

Algorithm:

Input:X.eca

Output: CCPN

Page 17: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 17

Modeling ECA rules with composite events…

Tables

EMPLOYEE (emp_id, name, rank, salary); SALES (emp_id, date, sale);

Rulesrule 001, ON or(e0:e1), IF update.salary > 50000, THEN update EMPLOYEE set salary

= update.salary * 0.20 where

emp_id = update.emp_id;rule 002, ON and(e0:e2), IF insert.number > 10,THEN update EMPLOYEE set salary

= insert.salary * 1.10 where

emp_id = insert.emp_id;

Events

e0 : insert_EMPLOYEE; e1 : update_EMPLOYEE_salary; e2 : insert_SALES;

Page 18: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 18

Modeling ECA rules with composite events…

Page 19: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 19

Usefulness of CCPN

ECA rule execution simulation and supervision Static and dynamic property analysis ECA rule interaction complexity analysis An engine of an active database system

Page 20: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 20

Database

Composite Event Detector

ECAPNSimTransactions

CCPN Manager

ECA ruleeditor

Terminationanalyzer

ECA - CCPNconvertor

Explanationcomponent

Tools Environment

CCPN editor/visualizer

ECA rules developer

ECAPNSim Kernel

CCPNBase

Console

Rule ExecutionComponent

event signalling CCPN retrieval event rule execution

User

ECAPNSim architecture

Complexityanalyzer

Page 21: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 21

ECA rule Editor

ECA - CCPNConvertor

CCPNEditor / Visualizer

ECA rules developer

ECAPNSim Kernel

CCPNbase

Termination Analyzer – The Engine

Incidence matrix generator

Paths Searcher

Paths Analyzer

Cyclic Paths Detector

RefinedCycles

CCPNManager

ECA rule Compiler

ECA rules developer

ECAbase

Static tools

Data flow

CCPN elements retrieval and storage

Explanation component

ECAPNSim Buildtime Tools

Page 22: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 22

Rule Execution Component

DB

Event Detector

CCPN Manager

Simulation mode

CCPN editor/

visualizer

User

Real mode

CCPNbase

Console

Dataflow at runtime

ConditionEvaluator

ActionExecutor

With token information

Random evaluation

Condition evaluator

Token gameanimation

ECAPNSim Kernel Static tools

ECA rules developer

ECAPNSim

ECAPNSim Runtime Tools

Page 23: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 23

Applications of CCPN

TraditionalDB

ECAPNSim Active DB+ =

Page 24: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 24

A realized active database system

System: Access

Relations: EMP(emp_id, name, rank, salary);

BONUS(emp_id, amount);

SALES(emp_id, month, number);

Page 25: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 25

A realized active database system…

CPN04.ecarule 001,

ON update_BONUS_amount, IF update.amount > 100, THEN update EMP set rank = old.rank + 1 where emp_id = update.emp_id;

rule 002, ON update_EMP_rank, IF update.rank > 5, THEN update BONUS set amount = old.amount + update.rank * 10 where emp_id =

update.emp_id;rule 003,

ON insert_SALES, IF insert.number > 50, THEN update EMP set rank = old.rank+1 where emp_id = insert.emp_id;

rule 004, ON update_EMP_rank, IF update.rank = 15, THEN update EMP set salary = old.salary*1.1 where emp_id = update.emp_id;

Page 26: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 26

Termination Analysis with CCPN

Page 27: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 27

Termination Analysis with CCPN…

Page 28: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 28

Complexity Analysis with CCPN

Definition of parameters: distance, potential, anchor.

Calculation of the parameters based on incidence matrix

Validation based on Zuse’s software measurement framework

Implementation Case study: 50 rules

Page 29: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 29

Complexity Analysis…

//Definition of tablesDEP ( ElDep CHAR( length), Prod CHAR( length) , Presupuesto float ) ; TRABAJA ( ElProy CHAR( length), ElEmp CHAR( length)) ;EMP ( SuDep CHAR( length), ElEmp CHAR( length), Salario float, Bono

float ) ;PROYECTO ( ElProy CHAR( length), Presupuesto float ) ;

//Definition of eventse0 : delete_DEP ; e1 : delete_TRABAJA ; e2 : delete_EMP ; e3 : insert_EMP;e4 : update_EMP_Salario; e5 : or(e3:e4) ;e6 : update_DEP_Prod; e7 : and(e6:e3);e8 : update_DEP_Presupuesto; e9 : insert_DEP;e10 : or(e8:e9);e11 : update_PROYECTO_Presupuesto;

Page 30: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 30

Complexity Analysis…//Definition of rulesrule 000, ON e0, IF true, THEN delete from EMP where EMP.SuDep = DEP.ElDep;rule 001, ON e1,IF true, THEN delete from PROYECTO where PROYECTO.ElProy = TRABAJA.ElProy;rule 002, ON e2, IF true, THEN delete from TRABAJA where EMP.ElEmp = TRABAJA.ElEmp;rule 003, ON e5, IF EMP.Salario > 15000, THEN delete from EMP where EMP.ElEmp = new.EMP.ElEmp;

Page 31: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 31

Complexity Analysis…

//Definition of rulesrule 004, ON e7, IF DEP.Prod > 90 & EMP.SuDep = DEP.ElDep, THEN update EMP set value Bono = 100 where EMP.ElEmp = new.EMP.ElEmp;rule 005, ON e10, IF true, THEN update PROYECTO set value Presupuesto = 0.1 * PROYECTO.Presupuesto

where PROYECTO.ElProy = TRABAJA.ElProy; rule 006, ON e11, IF true, THEN update EMP set value Salario = 0.01 * PROYECTO.Presupuesto where

PROYECTO.ElProy = TRABAJA.ElProy;

Page 32: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 32

Complexity analysis…

Page 33: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 33

Complexity Analysis…

Page 34: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 34

Complexity Analysis…

Page 35: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 35

Complexity Analysis…

Page 36: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 36

Complexity Analysis…

Page 37: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 37

Complexity Analysis…

Page 38: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 38

Conclusion

CCPN is a modified CPN, maybe it can be converted into a CPN

As an executable model, CCPN may be applied on a lot of systems where knowledge is represented by ECA rules

ECAPNSim is application-independent Composite events complexity can be measured

in CCPN framework

Page 39: Composite Event Specification in Active Database Systems: A Petri Nets Approach Xiaoou Li, Joselito Medina Marín, Lorena Chavarría Petri Nets Research.

CPN'04, Aarhus, 10/10/2004 39

Future works

To find practice database applications to prove and improve ECAPNSim

To improve UI More work on complexity analysis

condition temporal composite events

To apply CCPN on workflow systems