The OtterServer includes a simulation of three pizza stores, each making pizzas from supplies ordered from three different sources. The REA (Resource Event Agent) business model, proposed in 1982 by William E. McCarthy, is applied in the form of two xontos (Executable Ontologies Defined in a Descriptive Logic Language): REA Exchange and REA Convert. These xontos provide the definitions and services required to run the simulation.
Model-Driven Design Using Business Patterns, an excellent book by Pavel Hruby, was the source for constructing the models used in the simulation. This book provides patterns that can be applied to many business processes.
The “Exchange” xonto provides the means to describe the contracts for selling pizzas and acquiring the ingredients to make the pizzas. This xonto has the following structure:
The simulation has two forms of the exchange model. One form is to define the exchange between a customer and a store:
Three contracts are defined, one for each store. When a pizza is purchased by a customer, the store pizza resource is decremented and the price of the pizza is paid for by the customer. The income from each purchase goes into the appropriate revenue accounts. This is triggered by the service “Order Pizza from Menu”.
The other application of the exchange model happens between the stores and their suppliers. Since there are three stores and three suppliers, the simulation includes a total of nine store and supplier contracts as shown below:
The stores restock the ingredients they need by ordering from their suppliers. Every order includes the number of units of each ingredient required by the store. Each store’s pizza ingredients are incremented and the appropriate expense account is decremented. This event is triggered by the service “Restock Ingredients”.
The REA “Convert” xonto is used to make pizzas. The general structure of this xonto is:
When pizzas are ordered by customers, this model is applied to make each pizza:
The service “Order Pizza” performs the convert for a specific pizza according to that pizza’s recipe. For each pizza produced, the pizza resource is increased and the ingredients used to make the pizza are decreased.
The simulation operates over several days. At the beginning of each day, each store’s ingredients are checked by the “Restock Ingredients” service to see if they fall below the economic order quantity. If so, an order is prepared for the suppliers to restock to a level that does not exceed the store’s storage capacity. The simulation then randomly creates specific pizza orders for the stores.
The viewer for the simulation slows down the process using time delays, allowing the details of the revenue and expenses incurred each day to be seen.
The REA models work perfectly as xontos, and sincere thanks are given to Pavel Hruby for describing these patterns. See reatechnology.com.