Creating a Data Cube

This section describes the following sections:

Overview

A data cube is an Online Analytical Processing (OLAP) concept to compute data in certain forms to support analytics. As data flows through the Session AI system, cubes used in the configured use cases get dynamically built and provide the required business data to the use case.

The following is an example of a data cube that represents data sets entered using three dimensions where each dimension represents an attribute. For example, Customer Location dimension, Product dimension, and Time dimension.

605

Let us see a detailed view of a cube and how the data point is measured. The X-axis represents the time dimension, the Y-axis represents the product dimension, and the Z-axis represents the customer location dimension. To identify how many customers from Chicago purchased Phones in Q1, you can query the cube and determine the data point.

709

We will now understand how to create and populate a cube, and query the cube to retrieve data using the following use case:

  • Build a cube and populate it with the number of products purchased by customers from various cities in three quarters.
  • Query the cube to retrieve the total number of products purchased for each data set. For example, the total number of Phones purchased by customers from Chicago in Q1 or the total number of Mouse purchased by customers from Toronto in Q2.

As illustrated in the above cube diagram, the three axes (dimensions) are:

  • Quarter: Q1, Q2, Q3
  • Products: Phone, Mouse, Computer
  • Cities: Chicago, Toronto, New York
StepsDescription
Create a cubeDefine a cube and view the newly defined cube.
Populate a cubePopulate incoming data from the events into the cube.
Query a cubeCreate a cube query and call this query to retrieve the data.

Creating a Cube

To create a cube, perform the following:

  • Define a cube
  • View the cube definition

Define a Cube

  1. In the Data menu, Click Cubes.
    The Cubes screen displays all the existing cubes.
  2. Click the Create New located in the left corner of the page.

The Cube window appears.

  1. Enter the unique name for the cube and provide the XML snippet under the Definition tab to build a cube.
  2. Click Save.

📘

Note

You cannot delete a data cube that has been used in any other template/interactions. To delete the data cube, you should first remove it from the parent configurations where it has been used.

A cube is defined using an XML syntax containing the following components:

  • Axes: The data dimension that is used to measure the data. The data is computed based on each unique value of the axis. In this example, the three axes are quarter, product, and city. Each axis contains the following:
    • id: Unique ID of the axis.
    • src: Name of the data item in the incoming data set.
    • type: Data type of the axis. For example, the string.
  • Datapoint: The measurement of the data based on the source defined. In this example, the datapoint is totalProductOrdered. It contains the following:
    • id: Unique ID of the datapoint.
    • src: Name of the data item in the incoming data set used for computation.
    • type: Data type of the datapoint. For example, the integer.
    • aggregator: Computation that is used to determine the data point. The aggregator used here is udc.system.aggregation:sum.
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Cube to capture products purchased from various cities in three quarters.
-->
<p:cube id="ProductsPurchased" type="" version="" xmlns:p="http://udichi/core/analytic/cube/def"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://udichi/core/analytic/cube/def ../../../../../../platform/schema/cube.xsd ">
  <p:dataPoint aggregator="udc.system.aggregation:sum" id="totalProductOrdered" src="placedOrder" type="system:int"/>
  <p:axis id="quarter" src="quarter" type="system:string"/>
  <p:axis id="product" src="product" type="system:string"/>
  <p:axis id="city" src="city" type="system:string"/>
</p:cube>

ZineOne supports the following aggregation methods:

  • udc.system.aggregation:set
  • udc.system.aggregation:concat
  • udc.system.aggregation:concatunique
  • udc.system.aggregation:sum
  • udc.system.aggregation:count
  • udc.system.aggregation:max
  • udc.system.aggregation:min
  • udc.system.aggregation:average
  • udc.system.aggregation:custom

You can also use the following API to create a cube. Any data cube created using the API also appears on the Cubes screen.

Resource URL

Example Request URL

Request Body
Enter the XML snippet.

Response
Status: 200 OK

View the Cube Definition

To ensure that the cube has been successfully defined in your namespace, you should call the cube definition using the GET method.

Resource URL

Example Request URL

Response
The XML used to define the cube should appear in the response section.