Data Group IME-USP



WED-flow

WED-flow (Work, Event processing, Data-flow) is an alternative approach for the modeling and implementation of business processes. It provides transactional recovery through incremental evolution of exception handling, by combining the concepts of advanced transaction models, events, and data states. By carefully recording the detailed data states of each execution step, WED-flow composes backward and forward recovery mechanisms as reusable exception handling services to preserve the consistency of all databases involved in the application with well-defined correctness properties.

Travel Agency Example

Here we present a concise example of how to model and implement a PAIS using the WED-SQL language and its tools. This example illustrates in a simple manner the operational business model of a travel agency that sells vacation packages containing any combination of flight tickets reservation, hotel room reservation and car rental reservation. We will show in details how the composition of the WED-flow approach elements is able to precisely capture the behavior of processes and to describe their interactions. These interactions are the main guide that conducts the development of an executable model using the WED-SQL language.

The travel agency in this example offers three types of reservation services: flight ticket reservation, hotel room reservation and car rental reservation. These services are sold to its clients bundled in vacation packages. The clients are free to assemble a vacation package containing any combination of the offered services. Therefore, a client initiates the acquisition of a new package by informing the agency about his destination, which reservations should be included and the traveling dates. In turn, upon receiving a new order the agency will contact its partner companies and perform the requested reservations. Thereafter, if all the requested reservations were successfully performed, the client can make a payment, receive the confirmation documents and the instance will be finalized. Thus, the travel agency model will be described though WED-SQL language because there is a semantic equivalence between the WED-flow mathematical notation and the WED-SQL language.

Code below presents the WED-flow description that implements the travel agency example in WED-SQL. In line 1, the command 'CREATE WED-FLOW travel_agency' is responsible to instantiate the data meta-structure that will store the elements of this WED-flow declared between lines 4 and 35. This instantiation is required whenever a new WED-flow needs to be created. Once the execution engine manages multiple WED-flows, the command '\cw' in line 2 can be used to select in which WED-flow the remaining statements should be stored.

It is worth to mention that the command 'CREATE WED-TRANSITION <trans>' is used only to inform the execution engine about a given WED-transition. WED-transitions are responsible for executing self-contained and well-defined tasks. Currently, they are encapsulated by auxiliary services managed by the WED-SQL execution engine. Each WED-transition is identified by a unique name used by the execution engine to identify which auxiliary service must be activated in the presence of triggering data events.


CREATE WED−FLOW travel_agency ;
\cw travel_agency ;

CREATE WED−ATTRIBUTE depart ;
CREATE WED−ATTRIBUTE destination ;
CREATE WED−ATTRIBUTE reservations ;
CREATE WED−ATTRIBUTE res_flight ;
CREATE WED−ATTRIBUTE res_hotel ;
CREATE WED−ATTRIBUTE res_car ;
CREATE WED−ATTRIBUTE status ;

CREATE WED−TRANSITION init_request ;
CREATE WED−TRANSITION reserve_flight ;
CREATE WED−TRANSITION reserve_hotel ;
CREATE WED−TRANSITION reserve_car ;
CREATE WED−TRANSITION fin_request ;

CREATE WED−CONDITION Ci as ( depart IS NOT NULL ) AND ( return IS NOT NULL )
    AND ( depart::date < return:: date )
    AND ( destination IS NOT NULL ) AND ( reservations IS NOT NULL ) AND ( res_flight IS NULL ) ;

CREATE WED−CONDITION Cv as res_flight = 'request';
CREATE WED−CONDITION Ch as res_hotel = 'request' ;
CREATE WED−CONDITION Ca as res_car = 'request' ;
CREATE WED−CONDITION Cf as res_flight IN ( 'ignore' , 'requested' )
    AND res_hotel IN ( 'ignore' , 'requested' ) AND res_car IN ( 'ignore' , 'requested' )
    AND ( res_flight <> 'ignore' OR res_hotel <> 'ignore' OR res_car <> 'ignore' ) ;

CREATE WED−TRIGGER TGi as ( Ci , init_request ) ;
CREATE WED−TRIGGER TGv as ( Cv , reserve_flight ) ;
CREATE WED−TRIGGER TGh as ( Ch , reserve_hotel ) ;
CREATE WED−TRIGGER TGa as ( Ca , reserve_car ) ;
CREATE WED−TRIGGER TGf as ( Cf , fin_request ) ;

SET FINAL WED−STATE as status = ’done’ ;