Personal tools

Views

Flex 3:Feature Introductions: OLAPDataGrid

From Adobe Labs

Table of contents
[edit]

OLAP Introduction

On-Line Analytical Processing or OLAP analysis enables analyzing data selectively from various points-of-view. Such an analysis is often useful in data-mining, trend analysis and study of the relationship between various data items.

The heart of OLAP is in the concept of a cube. A cube keeps organized and summarized data into a multidimensional structure defined by a set of dimensions and measures. Storing pre-aggregated data facilitates quick answers to the multidimensional cross-tab queries.

Many state-of-the-art implementations for OLAP analysis are available which are known for delivering scalable, reliable and secure solutions through a combination of server and client technologies. They are capable of dealing with very large amount of data sets and providing very quick results. The data in all these solutions sits on non-volatile medium.

But many a times such an analysis is needed for comparatively smaller data sets and it is plausible to explore some lighter weight solutions. The new OLAP feature targets at providing an in-memory representation of a cube which is capable of providing answers to multidimensional queries.

It follows widely accepted server client model and thus the architecture of the OLAP feature can also be broken down into server and client components. On the server side, there is OLAP API which allows creation of an in-memory cube which can be queried with the help of query APIs. When such an in-memory cube (or OLAPCube) is queried the returned result can be fetched to the new OLAPDataGrid component which serves as a consumer of the query results.

Leveraging the capabilities of AdvancedDataGrid, OLAPDataGrid provides a customizable and configurable UI which is capable of consuming the result set of a multidimensional query and displaying it in a cross-tab fashion.


[edit]

Walk through via sample

Let's take an example to have a clearer picture about the capabilities of OLAP. Say we have the following flat data


Flat Data
Age Gender Marital Status Country Zip Code Area Code Through ADs? Purchased? Time Spent on URL
53 Male Married US 07074 973 Yes Yes 252
53 Male Married US 07074 973 Yes Yes 252
41 Female Married US 07074 973 Yes Yes 325
29 Male Single US 07074 973 No No 460
21 Male Single US 07074 973 No No 635
36 Male Single US 07078 973 No Yes 370
45 Male Single US 07078 973 No Yes 296
54 Male Married US 07078 973 No No 247
21 Female Single US 07078 212 No No 500
46 Male Married US 07078 212 Yes Yes 290
41 Female Married US 07078 718 Yes Yes 325
32 Male Single US 07078 212 No No 417

This data depicts website activity for a consumers product company. The Company logs the various details like gender, marital status of the customer along with whether the customer purchased something or not. In this flat form, it doesn't give any insight into which gender from which country purchases more products or whether most of the visitors are married or not or visitors coming through ads make more purchase or not? These questions are actually multidimensional queries and the analysis required is a cross-tab or in our words OLAP analysis of the data.

So let's see how answers to these queries can be given using OLAP.

  1. Define the Cube Schema - To build your cube you should first decide the dimensions of the cube. Dimension allows categorizing fields into independent entities like Time, Geography, Person etc. Each dimension is a collections of attributes, with each attribute corresponding to one column in the flat data table. For the sample data, let's say we choose three dimensions - Geography, Customer and Purchase.
    Dimensions →CustomerGeographyPurchase
    Attributes →AgeGenderMarital StatusCountryZip CodeArea CodeThrough ADs?Purchased?

    Refer to the samples to find out the code needed for this.

  2. Building the cube - Once the cube schema is defined, the next step is to provide a data source to the cube. After assigning the dataprovider, cube build process can be triggered by calling cube.refresh()
  3. Cube events (Optional) - During the build process the cube dispatches progress events like CUBE_PROGRESS and CUBE_COMPLETE which can be listened and appropriate actions like providing a progress feedback can be taken.

  4. BREAKTIME: Wasn't this easy? You have your cube built and ready to get queried. Let's see how this can be achieved.

  5. Creating a query - An OLAP Query has three parts: column axis, row axis and a slicer axis. While querying an OLAPCube we need to put OLAPSet on each of these axis.
    It will be easier to understand if we start with a simple example. Let us pick up Gender and Marital Status as two attributes and analyze our web activity data.
    Refer to in the sample 1 to find the code required for this.
    Complex queries can be made by using OLAPSet APIs like union, crossjoin and hierarchize.

  6. Displaying it using OLAPDataGrid - Once the query returns one can specify the returned result as dataProvider to the OLAPDataGrid component i.e olapGrid.dataProvider = result as IOLAPResult . Thus if we queried for a Gender vs Marital Status Analysis and the query result is given to the OLAPDataGrid Component, the resulting cross-tab would look like:
    GenderMarital Status
    MarriedSingleAll
    Male32119548.512759.5
    Female3274.52107.55831.5
    All6935.511655.518591

[edit]

Diving deeper

Now when the basic picture is clear, let's walk a bit more in OLAP and explore more features in OLAP

[edit]

FAQs

[edit]

Summary

This is a brief overview of the features offered by OLAP API AND OLAPDataGrid Component. Please refer to ASdocs and Help file for the detail description of each of these features.

OLAP API and OLAPDataGrid is a new feature, and we are looking forward for your valuable feedback for improving the feature for the future releases.

Retrieved from "http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:_OLAPDataGrid"