27.03.2014 Views

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

egories such as food, personal care, beverages, etc., and all<br />

sales of these products have a location and a price associated.<br />

In this context, a manager wants to know the sum of all<br />

sales of food and beverage in the cities of Rio de Janeiro and<br />

Sao Paulo, grouped by date. With a traditional approach,<br />

this query must be performed over an OLAP cube where<br />

the dimensions are category, city and date. In our system,<br />

this whole operation can be replaced by the production rule<br />

shown in Figure 3.<br />

1 - production rule "Sales of food and beverages for Rio and São Paulo"<br />

2 - when<br />

3 - City(name == "Rio de Janeiro" or name == "São Paulo")<br />

4 - Product(category == "food" or category == "beverage")<br />

5 - Sale($price = price)<br />

6 - do<br />

7 - update_cube($price, $timestamp, $this)<br />

Figure 3. A simple production rule for a sales<br />

management system<br />

In this figure, the rule are expressed in pseudocode. Line<br />

one identify the rule to represent the cube where all measures<br />

are stored. Lines two to five define the set of conditions<br />

(LHS of rule) that filter only desired data to be included<br />

into the particular cube. Specifically, line three filters<br />

data allowing only two cities (Rio de Janeiro and Sao<br />

Paulo), also defining city as a dimension. Line four filters<br />

only products from categories food and beverage, also<br />

defining the category dimension. Line five is used to temporarily<br />

store the price of the sale into a variable ($price)<br />

that will be used to increment data into the cube. Lines six<br />

and seven define the set of actions (RHS of rule) where the<br />

measures are updated using auxiliary functions (these functions<br />

are generalized and can be used for any domain). In<br />

line seven, the sum of prices is updated using a function<br />

called update cube, a timestamp (the $timestamp variable)<br />

and a reference to current rule (the $this variable).<br />

The timestamp is used to explicitly associate the computed<br />

measure with the time dimension, and the two<br />

other dimensions, city and category, are defined implicitly<br />

through the set of conditions.<br />

Considering that this rule has filtered some data from<br />

sales registries, computed measures are persisted as shown<br />

in table 1.<br />

In table 1, each rule represents a cube, the timestamp<br />

represents the time dimension and the measure column represents<br />

all business measures computed by the production<br />

rules. In the sales management example, the measure column<br />

contains the sum of prices of all sales of food and beverage<br />

sold in the cities of Rio de Janeiro and Sao Paulo in a<br />

specific date.<br />

In Figure 4 a generic representation of the OLAP cube<br />

generated for the sales management example is shown. In<br />

this figure, all sales of food and beverage are presented as<br />

Id Rule Measure Timestamp<br />

1 sales example 10 <strong>2012</strong>-06-10<br />

2 other rule 01 20 <strong>2012</strong>-06-11<br />

3 sales example 37 <strong>2012</strong>-06-12<br />

4 other rule 02 25 <strong>2012</strong>-06-13<br />

Table 1. Each rule identifies a particular cube.<br />

The timestamp represents the time dimension<br />

and the other ones are inferred from the<br />

LHS of the rule<br />

one single measure because of the manner in which the<br />

rule’s LHS was written, applying a disjunction on the product<br />

category: measures will be updated when category is<br />

”food” or ”beverage”. It was applied in the same manner<br />

to cities of Rio de Janeiro and Sao Paulo, according to the<br />

rule’s LHS shown in line three of Figure 3. Timestamp and<br />

measures are stored together as shown in 1.<br />

Rio de Janeiro<br />

or Sao Paulo<br />

Timestamp<br />

T1<br />

T2<br />

T3<br />

Food or Beverage<br />

Figure 4. Generic representation of the OLAP<br />

cube generated for the sales management example<br />

4.1. Run-time engine architecture<br />

To support our approach of dynamically building OLAP<br />

cubes by applying production rules to enterprise data, we<br />

developed a runtime architecture that is comprised of five<br />

modules: connector, adapter, engine, knowledge base and<br />

database.<br />

The connector is integrated into the enterprise system,<br />

and is responsible for collecting relevant data as events, that<br />

will be passed to the adapter. The later, for instance, splits<br />

all events into smaller unities, called facts, to be confronted<br />

with the rules stored in the knowledge base. The engine<br />

itself is responsible for matching the production rules with<br />

the facts generated by the adapter. All measures computed<br />

715

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!