from db nets to coloured petri nets with priorities
play

From DB-nets to Coloured Petri Nets with Priorities Marco Montali - PowerPoint PPT Presentation

From DB-nets to Coloured Petri Nets with Priorities Marco Montali and Andrey Rivkin KRDB Research Centre for Knowledge and Data Free University of Bozen-Bolzano, Italy . KRDB 3 From DB-nets to Coloured Petri Nets with Priorities 1 / 22


  1. From DB-nets to Coloured Petri Nets with Priorities Marco Montali and Andrey Rivkin KRDB Research Centre for Knowledge and Data Free University of Bozen-Bolzano, Italy . KRDB 3 From DB-nets to Coloured Petri Nets with Priorities 1 / 22

  2. Process-data dichotomy A well-known problem coming from the BPM community The leitmotiv: how to make processes and data work together? From DB-nets to Coloured Petri Nets with Priorities 2 / 22

  3. Process-data dichotomy Two research streams that address the dichotomy ◮ Petri nets : enrich PNs with some form of data that accounts for, e.g., fresh ID of objects ◮ Databases : enrich DBs with actions ν -CPN ν Fresh vars. Arcs Read arcs Queries Actions update fetch Relational DB with constraints From DB-nets to Coloured Petri Nets with Priorities 3 / 22

  4. ν -coloured Petri nets Almost like standard CPNs From DB-nets to Coloured Petri Nets with Priorities 4 / 22

  5. ν -coloured Petri nets Almost like standard CPNs Colours � data types D = � ∆ D , Γ D � from D (a finite set of types) ◮ ∆ D – a value domain (could be infinite!) ◮ Γ D – a finite set of predicate symbols ◮ Examples: string = � S , { = s }� , int = � Z , { = int , < int , succ }� From DB-nets to Coloured Petri Nets with Priorities 4 / 22

  6. ν -coloured Petri nets Almost like standard CPNs Colours � data types D = � ∆ D , Γ D � from D (a finite set of types) ◮ ∆ D – a value domain (could be infinite!) ◮ Γ D – a finite set of predicate symbols ◮ Examples: string = � S , { = s }� , int = � Z , { = int , < int , succ }� Arc inscriptions have no complex expressions, only variables From DB-nets to Coloured Petri Nets with Priorities 4 / 22

  7. ν -coloured Petri nets Almost like standard CPNs Colours � data types D = � ∆ D , Γ D � from D (a finite set of types) ◮ ∆ D – a value domain (could be infinite!) ◮ Γ D – a finite set of predicate symbols ◮ Examples: string = � S , { = s }� , int = � Z , { = int , < int , succ }� Arc inscriptions have no complex expressions, only variables Two kinds of (typed) variables : ◮ V D – “normal” variables ◮ Υ D – fresh variables (a la ν -PNs) ◮ unbounded variables in the output arc expressions account for external input and fresh data From DB-nets to Coloured Petri Nets with Priorities 4 / 22

  8. ν -coloured Petri nets Almost like standard CPNs Colours � data types D = � ∆ D , Γ D � from D (a finite set of types) ◮ ∆ D – a value domain (could be infinite!) ◮ Γ D – a finite set of predicate symbols ◮ Examples: string = � S , { = s }� , int = � Z , { = int , < int , succ }� Arc inscriptions have no complex expressions, only variables Two kinds of (typed) variables : ◮ V D – “normal” variables ◮ Υ D – fresh variables (a la ν -PNs) ◮ unbounded variables in the output arc expressions account for external input and fresh data Guards : quantifier- and relation-free FO formulas over D ’s From DB-nets to Coloured Petri Nets with Priorities 4 / 22

  9. ν -coloured Petri nets A simple net for logging in users in an online shop [ ¬ ( card = s ” ”)] � uid , card � � uid , card , ν cart � Users Log Logged In color ( Users ) = int × string color ( Logged ) = int × string × int “. . . log in only if you have credit card data” ν cart ∈ Υ D is used to create a (globally) new shopping cart ID From DB-nets to Coloured Petri Nets with Priorities 5 / 22

  10. Relational Database: schema A simplified online shop database User WithBonus ID: int card : string UID : int type : string { 50 % , 15eur , extra item } FK WithBonus User Product InWarehouse Name : string PID : int name : string cost : real FK InWarehouse Product A user may have only(!) one out of three predefined bonuses Product stores types of products available in the online shop From DB-nets to Coloured Petri Nets with Priorities 6 / 22

  11. Relational Database: queries Queries – FO expressions over D -typed DB schema R with explicitly identified free ( answer ) variables Examples: ◮ “get all products available in the warehouse and whose price has been defined” Q products ( pid , n , c ) :- Product ( n ) ∧ InWarehouse ( pid , n , c ) ∧ c � = null ◮ “get all registered users” Q users ( uid ) :- ∃ card . User ( id , card ) ◮ “get all bonus holders” Q wbonus ( uid , bt ′ ) :- WithBonus ( uid , bt ′ ) From DB-nets to Coloured Petri Nets with Priorities 7 / 22

  12. Relational Database: updates . . . via parametrized atomic actions From DB-nets to Coloured Petri Nets with Priorities 8 / 22

  13. Relational Database: updates . . . via parametrized atomic actions Specify 1 st which facts to delete and 2 nd which facts to add ◮ Like in STRIPS planning ◮ Follow the order ⇒ avoid situations in which one fact is both added and deleted Actions are transactional ◮ If an action application result violates database constraints ⇒ rollback! From DB-nets to Coloured Petri Nets with Priorities 8 / 22

  14. Relational Database: updates How to assign a bonus to a user? Use an action addb ( uid , bt ) s.t. addb · del = ∅ addb · add = { WithBonus ( uid , bt ) } User ID card 1. execute addb (122 , 50%) 122 5583-3290-2131-2333 184 4419-2311-1189-9923 add WithBonus (122 , 50%) 2. execute addb (184 , 50%) WithBonus add WithBonus (184 , 50%) UID UID UID UID type type type type UID type 122 122 122 – 50% 50% 50% – 122 50% 3. execute addb (122 , 15 eur ) 184 184 184 50% 50% 50% 122 15eur add WithBonus 122 , 15 eur ) constraint vioaltion: “only one bonus per user” ROLLBACK From DB-nets to Coloured Petri Nets with Priorities 9 / 22

  15. Relational Database: updates How to assign a bonus to a user? Use an action addb ( uid , bt ) s.t. addb · del = ∅ addb · add = { WithBonus ( uid , bt ) } User ID card 1. execute addb (122 , 50%) 122 5583-3290-2131-2333 184 4419-2311-1189-9923 add WithBonus (122 , 50%) 2. execute addb (184 , 50%) WithBonus add WithBonus (184 , 50%) UID UID UID UID type type type type UID type 122 122 122 – 50% 50% 50% – 122 50% 3. execute addb (122 , 15 eur ) 184 184 184 50% 50% 50% 122 15eur add WithBonus 122 , 15 eur ) constraint vioaltion: “only one bonus per user” ROLLBACK From DB-nets to Coloured Petri Nets with Priorities 9 / 22

  16. Relational Database: updates How to assign a bonus to a user? Use an action addb ( uid , bt ) s.t. addb · del = ∅ addb · add = { WithBonus ( uid , bt ) } User ID card 1. execute addb (122 , 50%) 122 5583-3290-2131-2333 184 4419-2311-1189-9923 add WithBonus (122 , 50%) 2. execute addb (184 , 50%) WithBonus add WithBonus (184 , 50%) UID UID UID UID type type type type UID type 122 122 122 – 50% 50% 50% – 122 50% 3. execute addb (122 , 15 eur ) 184 184 184 50% 50% 50% 122 15eur add WithBonus 122 , 15 eur ) constraint vioaltion: “only one bonus per user” ROLLBACK From DB-nets to Coloured Petri Nets with Priorities 9 / 22

  17. Relational Database: updates How to assign a bonus to a user? Use an action addb ( uid , bt ) s.t. addb · del = ∅ addb · add = { WithBonus ( uid , bt ) } User ID card 1. execute addb (122 , 50%) 122 5583-3290-2131-2333 184 4419-2311-1189-9923 add WithBonus (122 , 50%) 2. execute addb (184 , 50%) WithBonus add WithBonus (184 , 50%) UID UID UID UID type type type type UID type 122 122 122 – 50% 50% 50% – 122 50% 3. execute addb (122 , 15 eur ) 184 184 184 50% 50% 50% 122 15eur add WithBonus 122 , 15 eur ) constraint vioaltion: “only one bonus per user” ROLLBACK From DB-nets to Coloured Petri Nets with Priorities 9 / 22

  18. Relational Database: updates How to assign a bonus to a user? Use an action addb ( uid , bt ) s.t. addb · del = ∅ addb · add = { WithBonus ( uid , bt ) } User ID card 1. execute addb (122 , 50%) 122 5583-3290-2131-2333 184 4419-2311-1189-9923 add WithBonus (122 , 50%) 2. execute addb (184 , 50%) WithBonus add WithBonus (184 , 50%) UID UID UID UID type type type type UID type 122 122 122 – 50% 50% 50% – 122 50% 3. execute addb (122 , 15 eur ) 184 184 184 50% 50% 50% 122 15eur add WithBonus 122 , 15 eur ) constraint vioaltion: “only one bonus per user” ROLLBACK From DB-nets to Coloured Petri Nets with Priorities 9 / 22

  19. Relational Database: updates How to assign a bonus to a user? Use an action addb ( uid , bt ) s.t. addb · del = ∅ addb · add = { WithBonus ( uid , bt ) } User ID card 1. execute addb (122 , 50%) 122 5583-3290-2131-2333 184 4419-2311-1189-9923 add WithBonus (122 , 50%) 2. execute addb (184 , 50%) WithBonus add WithBonus (184 , 50%) UID UID UID UID type type type type UID type 122 122 122 – 50% 50% 50% – 122 50% 3. execute addb (122 , 15 eur ) 184 184 184 50% 50% 50% 122 15eur add WithBonus 122 , 15 eur ) constraint vioaltion: “only one bonus per user” ROLLBACK From DB-nets to Coloured Petri Nets with Priorities 9 / 22

Recommend


More recommend