6 Create a new Schema using Eclipse plugin ...... http://research.cip.cgiar.org/
docs/downloads/xampp-linux-1.4.7.tar.gz or.
Quick Tutorial about Mondrian Datamart International Potato Center (CIP)...© 2006
I
Quick Tutorial for Datamart
Table of Contents Part I Introduction
4
Part II Install pre-requisites & Mondrian
4
1 Download and................................................................................................................................... Installing pre-requisites for Mondrian 4 2 Download and................................................................................................................................... Installing Mondrian 6 For Windows .......................................................................................................................................................... For Linux ..........................................................................................................................................................
6 7
3 Download and................................................................................................................................... Upload Database for Mondrian 8 Download and .......................................................................................................................................................... Upload Microsoft Access data Download and .......................................................................................................................................................... Upload MySQL data
8 9
4 Modify code ................................................................................................................................... 10 5 Install Driver................................................................................................................................... for MySQL 11 6 Test Mondrian ................................................................................................................................... Sample 12 7 Enable print ................................................................................................................................... and export to Excel and PDF 12
13
Part III Install Mondrian Plugin 1 Install
................................................................................................................................... 13
2 Test Plugin ................................................................................................................................... 14 Create new "Simple" .......................................................................................................................................................... Project Open FoodMart.mondrian ..........................................................................................................................................................
14 15
16
Part IV Create a simple cube
1 General overview ................................................................................................................................... 17 2 Copy database ................................................................................................................................... from CD 17 3 Create System ................................................................................................................................... ODBC 17 4 Create a passport ................................................................................................................................... folder 18 5 Modify mondrian.jsp ................................................................................................................................... 19 6 Create a new................................................................................................................................... Schema using Eclipse plugin 20 Create a simple .......................................................................................................................................................... project Create a *.mondrian .......................................................................................................................................................... file Create root schema ..........................................................................................................................................................
20 21 23
7 Adding measures ................................................................................................................................... & dimensions 24 Example 1 .......................................................................................................................................................... Step to modify ......................................................................................................................................................... schema Create cube "Passport" ......................................................................................................................................... Create the fact table ......................................................................................................................................... "passport_FactTable" Create the dimension ......................................................................................................................................... "FAO" Create the hierarchy ................................................................................................................................... for "FAO" dimension Create table of ................................................................................................................................... hierarchy Create level of hierarchy ................................................................................................................................... Create the measure ......................................................................................................................................... "Accs" Final code......................................................................................................................................................... view Example 2 ..........................................................................................................................................................
24 24 24 25 26 26 27 28 29 30 31
International Potato Center (CIP)...© 2006
Contents
II
Step to modify ......................................................................................................................................................... schema Create the dimension ......................................................................................................................................... "Invitro" Create the hierarchy ................................................................................................................................... "Invitro" Create table of ................................................................................................................................... hierarchy Create level of hierarchy ................................................................................................................................... Final code......................................................................................................................................................... view Example 3 .......................................................................................................................................................... Step to midified ......................................................................................................................................................... schema Create the measure ......................................................................................................................................... "Species" Final code......................................................................................................................................................... view Example 4 .......................................................................................................................................................... Step to modified ......................................................................................................................................................... schema Create a dimension ......................................................................................................................................... "taxonomy" Create the hierarchy ................................................................................................................................... for "Taxonomy" dimension Create table of ................................................................................................................................... hierarchy Create level genus ................................................................................................................................... of hierarchy Create level family ................................................................................................................................... of hierarchy Final code......................................................................................................................................................... view Example 5 .......................................................................................................................................................... Step to modify ......................................................................................................................................................... schema Create level species ......................................................................................................................................... of hierarchy Final code......................................................................................................................................................... view Example6 .......................................................................................................................................................... Create the......................................................................................................................................................... dimension "location" with two tables Create the hierarchy ......................................................................................................................................... for "Location" dimension Create Join for ................................................................................................................................... "Location" dimension Create Table: Country ................................................................................................................................... Create Table: Region ................................................................................................................................... Create levels of................................................................................................................................... hierarchy Create Level: Continent ................................................................................................................................... Create Level: Region ................................................................................................................................... Create Level: Country ................................................................................................................................... Final code......................................................................................................................................................... view Example 7 .......................................................................................................................................................... Create the......................................................................................................................................................... dimension "location" with three tables Create the hierarchy ......................................................................................................................................... for "Location" dimension Create First Join ................................................................................................................................... for "Location" dimension Create Table: Continent ................................................................................................................................... Create Second ................................................................................................................................... Join for "Location" dimension Create Table: Country ................................................................................................................................... Create Table: Region ................................................................................................................................... Create levels of................................................................................................................................... the hierarchy Create Level: Continent ................................................................................................................................... Create Level: Region ................................................................................................................................... Create Level: Country ................................................................................................................................... Final Code ......................................................................................................................................................... view
31 31 32 33 34 35 36 36 36 38 38 38 38 39 40 41 42 44 44 44 45 46 47 47 48 48 49 50 51 52 52 54 55 55 55 56 57 59 59 61 61 63 63 64 64 66
8 Publish schema ................................................................................................................................... 66 9 Create Job Script ................................................................................................................................... to Fill Database 67
Part V Install JRubik
67
1 Pre-requisites ................................................................................................................................... 68 Verify if you have .......................................................................................................................................................... the right version of Java Link for the Pre.......................................................................................................................................................... requisites programs
68 69
International Potato Center (CIP)...© 2006
II
III
Quick Tutorial for Datamart 2 Download and ................................................................................................................................... modify JRubik 69 Download JRubik .......................................................................................................................................................... Change the Windows .......................................................................................................................................................... User Modify mnu56802.xml ..........................................................................................................................................................
69 70 70
3 Download and ................................................................................................................................... Install MySQL Database 71 Download Database .......................................................................................................................................................... Install Database ..........................................................................................................................................................
71 71
4 Test JRubik ................................................................................................................................... 71
Part VI Related Links
73
International Potato Center (CIP)...© 2006
Introduction
1
4
Introduction
This quick tutorial pretends to teach: · How to install the pre-requisites for Mondrian · How to modify and deploy a Datamart Authors: Kathleen Polo, Juan Gonzales and Edwin Rojas We welcome any comments and/or suggestions. Please mail to
[email protected] Copyright 2006 International Potato Center (CIP) Research Informatics Unit (RIU) www.cipotato.org
2
Install pre-requisites & Mondrian
2.1
Download and Installing pre-requisites for Mondrian We have used these products to install Mondrian. Install all products in this order. Product
Version
Links to Download
http://research.cip.cgiar.org/docs/downloads/xampp-win32-1.4.9-installer.ex Windows e or Xampp: http://www.apachefriends.org/en/xampp-windows.html or 1.4.9 :\Install\Pre-requisites\Windows Xampp ________ ___________________________________________________________ _ http://research.cip.cgiar.org/docs/downloads/xampp-linux-1.4.7.tar.gz or http://www.apachefriends.org/en/xampp-linux.html or Linux :\Instal\Pre-requisites\Linux Xampp: 1.4.9
International Potato Center (CIP)...© 2006
5
Quick Tutorial for Datamart
http://research.cip.cgiar.org/docs/downloads/j2sdk-1_4_2_07-windows-i586p.exe or Windows http://developer.java.sun.com. We downloaded j2sdk1.4.2_07 or JDK: :\Install\Pre-requisites\Windows 1.4.2_07
JDK
________ ___________________________________________________________ _ http://research.cip.cgiar.org/docs/downloads/j2sdk-1_4_2_07-linux-i586.zip or Linux http://developer.java.sun.com. We downloadd j2sdk1.4.2_07 or JDK: :\Install\Pre-requisites\Linux 1.4.2_0 7 To install view README.java.txt
http://research.cip.cgiar.org/docs/downloads/xampp-tomcat-addon-1.4.9-inst aller.exe or Windows http://sourceforge.net/project/showfiles.php?group_id=61776&package_id=1 Tomcat: 13693 or 5.0.27 :\Install\Pre-requisites\Windows Addon:1.4.9
Tomcat Add-on
________ _______________________________________________________ _ http://research.cip.cgiar.org/docs/downloads/xampp_tomcat-5.0.27-addon-0. 3.tar.gz or Tomcat: 5.0.27 http://addons.xampp.org/cgi-bin/search.pl?pid=9 or Addon:0.3 :\Install\Pre-requisites\Linux To install view README.tomcat.txt Linux
Other programs for download, to be use later. http://research.cip.cgiar.org/docs/downloads/mysql-connector-java-3.0.1 6-ga.zip or Windows http://dev.mysql.com/downloads/connector/j/3.0.html or 3.0.16 :\Install\Pre-requisites\Windows ________ ________________________________________________________ MySql-Connect _ or Linux http://research.cip.cgiar.org/docs/downloads/mysql-connector-java-3.0.1 3.06.16 6-ga.zip or http://dev.mysql.com/downloads/connector/j/3.0.html or :\Install\Pre-requisites\Linux
Linux 2.6.2
http://www.phpmyadmin.net/home_page/downloads.php or :\Install\Pre-requisites\Linux
International Potato Center (CIP)...© 2006
Install pre-requisites & Mondrian
6
Windows http://download.eclipse.org/eclipse/downloads/drops/R-3.0.1-200409161 3.0.1 125/index.php or :\Install\Pre-requisites\Windows ________ ________________________________________________________ _ Linux 3.0.1
Mondrian schema Eclipse Plugin
http://download.eclipse.org/eclipse/downloads/drops/R-3.0.1-200409161 125/index.php We downloaded SDK-3.0.1-linux-gtk.zip or :\Install\Pre-requisites\Linux
http://research.cip.cgiar.org/docs/downloads/mondrian-schema-1.0.1.zip Windows or 1.0.1 http://sourceforge.net/projects/jpivot or :\Install\Pre-requisites\Windows
2.2
Download and Installing Mondrian
2.2.1
For Windows NOTE: C:\apachefriends\xampp\tomcat is called TOMCAT_HOME 1. Download mondrian-1.1.5 from SourceForge (http://sourceforge.net/projects/mondrian) or http://research.cip.cgiar.org/docs/downloads/mondrian-1.1.5.zip (mondrian-1.1.5.zip) or :\Install\Mondrian\, and unzip it to C:\. 2. Copy mondrian.war from C:\mondrian-1.1.5\lib and paste it in TOMCAT_HOME\webapps\ 3. Start Xampp and Tomcat and hit http://localhost:8080/mondrian
International Potato Center (CIP)...© 2006
7
Quick Tutorial for Datamart
4. Shutdown Tomcat and Xampp
2.2.2
For Linux 1.Download mondrian-1.1.5 from SourceForge (http://sourceforge.net/projects/mondrian) or http://research.cip.cgiar.org/docs/downloads/ (mondrian-1.1.5.zip) or :\Install\Mondrian\, and unzip it. 2.Copy mondrian.war from mondrian/lib and paste it in opt/lampp/webapps 3. Start Xampp and Tomcat and hit http://localhost:8080/mondrian
International Potato Center (CIP)...© 2006
Install pre-requisites & Mondrian
8
4. Shutdown Tomcat and Xampp
2.3
Download and Upload Database for Mondrian
2.3.1
Download and Upload Microsoft Access data 1.Start ODBC Administrator, and create a System ODBC DSN called MondrianFoodMart point to C :\mondrian-1.1.5\demo\access\MondrianFoodMart.mdb. , to select the file MondrianFoodmart.mdb use de Select button.
International Potato Center (CIP)...© 2006
9
2.3.2
Quick Tutorial for Datamart
Download and Upload MySQL data 1.Download mondrian-data from http://research.cip.cgiar.org/docs/downloads/ (mondrian-data.zip) or :\Install\Mondrian\, copy the fles in C:\ directory if you are a windows user. 2.Start Xampp 3.Create user and give privileges
International Potato Center (CIP)...© 2006
Install pre-requisites & Mondrian
\bin>mysql -u root -h localhost mysql>GRANT ALL PRIVILEGES ON *.* TO foodmart@localhost IDENTIFIED BY 'foodmart'; Query OK, 0 rows affected (0.06 sec) 3. Create tables and indexes,load the data, run sanity checks: For Linux mysql> source /mondrian-data/demo/mysql/foodmart.sql For Windows mysql> source c:\mondrian-data\demo\mysql\foodmart.sql mysql> commit; mysql> show tables;
NOTE: On Red Hat Linux(including Fedora) you must to delete the user created(foodmart) in phpmyadmin. Then you have to create new user in phpmyadmin, too.
2.4
Modify code For Windows and Linux: Before you load the data base, you have to modify the file "mondrian.jsp" located in TOMCAT_HOME\webapps\mondrian\WEB-INF\queries
International Potato Center (CIP)...© 2006
10
11
Quick Tutorial for Datamart
For MySQL: select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns, {([Promotion Media].[All Media], [Product].[All Products])} ON rows from Sales where ([Time].[1997]) Test Query uses Mondrian OLAP For Access: select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns, {([Promotion Media].[All Media], [Product].[All Products])} ON rows from Sales where ([Time].[1997]) Test Query uses Mondrian OLAP
2.5
Install Driver for MySQL After you had installed Mondrian, loaded the database In Linux download the mysql's driver (mysql-connector-java-3.0.16-ga-bin.jar from /mysql-connector-java-3.0.16-ga ), and copy it in opt/lampp/lib/tomcat/common/lib In Windows download the mysql's driver (mysql-connector-java-3.0.16-ga-bin.jar from /mysql-connector-java-3.0.16-ga), and copy it in TOMCAT_HOME\commom\lib
International Potato Center (CIP)...© 2006
Install pre-requisites & Mondrian
2.6
12
Test Mondrian Sample 1.- Delete /mondrian from TOMCAT_HOME\work\Catalina\localhost 2.- Restart Xampp and Tomcat 3.- Hit http://localhost:8080/mondrian
2.7
Enable print and export to Excel and PDF When you load mondrian for first time, the print, set print and excel buttoms don't work, for make it work you must add the red lines in the file web.xml located in: TOMCAT_HOME\webapps\mondrian\WEB-INF.
International Potato Center (CIP)...© 2006
13
Quick Tutorial for Datamart
... Print Print Default configuration create for servlet. com.clarmont.olap.servlet.print DisplayChart org.jfree.chart.servlet.DisplayChart GetChart GetChart Default configuration create for servlet. com.clarmont.olap.servlet.GetChart MDXQueryServlet mondrian.web.servlet.MDXQueryServlet connectString Provider=mondrian;Jdbc=jdbc:odbc:MondrianFoodMart;Catalog=/WEB-INF/queries/FoodMart.xml;JdbcDrivers=sun.jdbc.od bc.JdbcOdbcDriver;RoleXX='California manager'; MondrianXmlaServlet mondrian.xmla.XmlaServlet Print /Print DisplayChart /DisplayChart GetChart /GetChart MDXQueryServlet /mdxquery MondrianXmlaServlet /xmla index.jsp ...
3
Install Mondrian Plugin
3.1
Install Pre-requisites: Download and Install Eclipse version 3.x and the EMF&SDO version 2.x(required).
International Potato Center (CIP)...© 2006
Install Mondrian Plugin
14
Download and unzip the mondrian-schema.zip into Eclipse installation directory, this will install the plugin. Download it from http://research.cip.cgiar.org/docs/downloads/ or http://sourceforge.net/projects/jpivot or :\Install\Pre-requisites\Windows Start up eclipse and in the menu click on Help->About Eclipse Plattform->Plug-in Details. Mondrian Schema Editor Plugin must appear in the list of installed plugins.
3.2
Test Plugin The plugin is registered with the ".mondrian" file extension, this means you will have to rename TOMCAT_HOME\webapps\mondrian\WEB-INF\queries\Foodmart.xml into Foodmart.mondrian so Eclipse can associate the file with the plugin. If you prefere, download the file Foodmart.mondrian : http://research.cip.cgiar.org/docs/mondrian/FoodMart.mondrian
3.2.1
Create new "Simple" Project Using the editor to create a new "Simple" proyect
Select a directory
International Potato Center (CIP)...© 2006
15
3.2.2
Quick Tutorial for Datamart
Open FoodMart.mondrian Choose a project directory that contains Foodmart.mondrian. In the Package Explorer select Foodmart.mondrian and open it.
Now the Eclipse workbench should look similar to the followind screenshot and you should be able to edit the Mondrian Schema
International Potato Center (CIP)...© 2006
Install Mondrian Plugin
4
Create a simple cube We're going to create a simple OLAP cube for passport data, for this we need to: · Modify the source code of mondrian.jsp · Create a schema for the OLAP model with Eclipse For this example we're using a sample database of potato from CIP
International Potato Center (CIP)...© 2006
16
17
Quick Tutorial for Datamart
4.1
General overview
4.2
Copy database from CD From :\examples\olapdb\ copy the Access database file "cippassportolap.mdb" to TOMCAT_HOME\webapps\mondrian\WEB-INF\queries\ or download from web: http://research.cip.cgiar.org/docs/downloads/examples_mondrian/cippassportolap.mdb
4.3
Create System ODBC Create a new system ODBC with the name "cippassportolap" that refer to the Access database "cippassportolap.mdb", to select the file cippassportolap.mdb use de Select button.
International Potato Center (CIP)...© 2006
Create a simple cube
4.4
Create a passport folder Now you have to create a new folder, but this will be a back-up of mondrian folder located in TOMCAT_HOME/webapp, here we're giong to work
International Potato Center (CIP)...© 2006
18
19
4.5
Quick Tutorial for Datamart
Modify mondrian.jsp Windows In TOMCAT_HOME\webapps\passport\web-inf\queries\mondrian.jsp you must to modify the code, red code indentify the changes. Note: "passport.xml" is the model OLAP schema.
select {[Measures].[Accs]} ON columns, Union({[FAO].[All FAO]}, [FAO].[All FAO].Children) ON rows from [passport] Test Query uses Mondrian OLAP
International Potato Center (CIP)...© 2006
Create a simple cube
20
Linux In opt/lampp/lib/tomcat/webapp/passport/WEB-INF/queries/mondrian.jsp you must to modify the code, red code indentify the changes. select {[Measures].[Accs]} ON columns, Union({[FAO].[All FAO]}, [FAO].[All FAO].Children) ON rows from [passport] Test Query uses Mondrian OLAP
4.6
Create a new Schema using Eclipse plugin
4.6.1
Create a simple project First of all, you have to shutdown Tomcat, then you have to create a new simple project in your workspace, in this example the proyect is called passport_olap
International Potato Center (CIP)...© 2006
21
4.6.2
Quick Tutorial for Datamart
Create a *.mondrian file After to create the project if doesn't appear a file named passport.mondrian you must create the file
Now you have to open passport.mondrian with text editor form :
International Potato Center (CIP)...© 2006
Create a simple cube
Now in the text editor wrtite the folowing code to create a root schema />
Now using the Mondrian editor form to check if the schema has created succesfuly:
International Potato Center (CIP)...© 2006
22
23
Quick Tutorial for Datamart
You must see a tree like this:
4.6.3
Create root schema Then you have to open passport.mondrian with Mondrian Model Editor, here you can create the schema, cubes, dimensions,etc.
International Potato Center (CIP)...© 2006
Create a simple cube
4.7
Adding measures & dimensions
4.7.1
Example 1 For the example, we're going to create a cube with one dimension and one measure
4.7.1.1
Step to modify schema
4.7.1.1.1 Create cube "Passport"
After to create a root schema, create the cube "Passport" and add the properties.
International Potato Center (CIP)...© 2006
24
25
Quick Tutorial for Datamart
4.7.1.1.2 Create the fact table "passport_FactTable"
Create the fact table "passport_FactTable"
International Potato Center (CIP)...© 2006
Create a simple cube
4.7.1.1.3 Create the dimension "FAO"
Create the dimension "FAO".
4.7.1.1.3.1 Create the hierarchy for "FAO" dimension
Create the hierarchy for FAO dimension
International Potato Center (CIP)...© 2006
26
27
Quick Tutorial for Datamart
After to create the hierarchy of dimension, you have to create the table of the dimension
International Potato Center (CIP)...© 2006
Create a simple cube
After to create the table of dimension, you have to create the level of the hierarchy.
International Potato Center (CIP)...© 2006
28
29
Quick Tutorial for Datamart
4.7.1.1.4 Create the measure "Accs"
Create the measure "Accs" to count the number of germplasm.
International Potato Center (CIP)...© 2006
Create a simple cube
4.7.1.2
Final code view And this cube has the following code.
International Potato Center (CIP)...© 2006
30
31
Quick Tutorial for Datamart
To download the example I Click Here (http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise1.txt) or from :\Examples\Schemas
4.7.2
Example 2 Now we're going to create a cube with two dimension and one measure.
4.7.2.1
Step to modify schema We will continue modified the example 1, we have a schema with one cube, one dimension and one measure. Now we can create a new dimension
4.7.2.1.1 Create the dimension "Invitro"
Create the dimension"Invitro"
International Potato Center (CIP)...© 2006
Create a simple cube
4.7.2.1.1.1 Create the hierarchy "Invitro"
Create the hierarchy for Invitro dimension
International Potato Center (CIP)...© 2006
32
33
Quick Tutorial for Datamart
After to create the hierarchy of dimension, you have to create the table of the dimension
International Potato Center (CIP)...© 2006
Create a simple cube
After to create the tabla of dimension, you have to create the level of the hierarchy.
International Potato Center (CIP)...© 2006
34
35
4.7.2.2
Quick Tutorial for Datamart
Final code view And this is its source code
International Potato Center (CIP)...© 2006
Create a simple cube
36
To download the example II Click Here (http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise2.txt) or from :\Examples\Schemas
4.7.3
Example 3 This example has a cube with two dimensions and two measures.
4.7.3.1
Step to midified schema We will continue modified the example 2, we have a schema with one cube, two dimension and one measure. Now we can create a new measure.
4.7.3.1.1 Create the measure "Species"
Create the measure "Species" to count the number of germplasm.
International Potato Center (CIP)...© 2006
37
Quick Tutorial for Datamart
International Potato Center (CIP)...© 2006
Create a simple cube
4.7.3.2
38
Final code view
To download the example III Click Here (http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise3.txt) or from :\Examples\Schemas
4.7.4
Example 4 This example has a cube with three dimensions, two levels and two measures.
4.7.4.1
Step to modified schema We will continue modified the example 3, we have a schema with one cube, two dimension and two measures. Now we will create a new dimension with two levels.
4.7.4.1.1 Create a dimension "taxonomy"
Create the dimension "Taxonomy".
International Potato Center (CIP)...© 2006
39
Quick Tutorial for Datamart
4.7.4.1.1.1 Create the hierarchy for "Taxonomy" dimension
Create the hierarchy for "Taxonomy" dimension
International Potato Center (CIP)...© 2006
Create a simple cube
After to create the hierarchy of dimension, you have to create the table of the dimension
International Potato Center (CIP)...© 2006
40
41
Quick Tutorial for Datamart
After to create the table of dimension, you have to create the level of the hierarchy.
International Potato Center (CIP)...© 2006
Create a simple cube
After to create the table of dimension, you have to create the level of the hierarchy.
International Potato Center (CIP)...© 2006
42
43
Quick Tutorial for Datamart
International Potato Center (CIP)...© 2006
Create a simple cube
4.7.4.2
44
Final code view
To download the example IV Click Here (http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise4.txt) or from :\Examples\Schemas
4.7.5
Example 5 In this case we have one cube, three dimensions, three levels and two measures
4.7.5.1
Step to modify schema We will continue modified the example 4, we have a schema with one cube, three dimension and two measures. Now we will create a new level of the "Taxonomy" dimension.
International Potato Center (CIP)...© 2006
45
Quick Tutorial for Datamart
4.7.5.1.1 Create level species of hierarchy
After to create the table of dimension, you have to create the level of the hierarchy.
International Potato Center (CIP)...© 2006
Create a simple cube
4.7.5.2
Final code view
To download the example V Click Here (http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise5.txt) or from :\Examples\Schemas NOTE: that the example V is the same to passport.xml
International Potato Center (CIP)...© 2006
46
47
4.7.6
Quick Tutorial for Datamart
Example6 For one cube with three levels and three dimensions where the [Location] dimension is a "snowflake dimension" with two tables [Country] and [Region] .
4.7.6.1
Create the dimension "location" with two tables Create the dimension "location"
International Potato Center (CIP)...© 2006
Create a simple cube
48
4.7.6.1.1 Create the hierarchy for "Location" dimension
Create the hierarchy for "Location" dimension the Foreing Key CountryID joins the FactTable with the dimension.
4.7.6.1.1.1 Create Join for "Location" dimension
After create the hierarchy, you have to create the join for conect the tables of the dimension: [Country] and [Region].
International Potato Center (CIP)...© 2006
49
Quick Tutorial for Datamart
1.- Table [Country]
International Potato Center (CIP)...© 2006
Create a simple cube
2- Table [Region]
International Potato Center (CIP)...© 2006
50
51
Quick Tutorial for Datamart
4.7.6.1.1.2 Create levels of hierarchy
Create the levels of the hierarchy: [Continent], [Region] and [Country]
International Potato Center (CIP)...© 2006
Create a simple cube
1.- Level: [Continent]
2.- Level: [Region]
International Potato Center (CIP)...© 2006
52
53
Quick Tutorial for Datamart
International Potato Center (CIP)...© 2006
Create a simple cube
3.- Level: [Country]
International Potato Center (CIP)...© 2006
54
55
4.7.6.2
Quick Tutorial for Datamart
Final code view
To download the example V Click Here (http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise6.txt)
4.7.7
Example 7
4.7.7.1
Create the dimension "location" with three tables Create the dimension "location"
International Potato Center (CIP)...© 2006
Create a simple cube
56
4.7.7.1.1 Create the hierarchy for "Location" dimension
Create the hierarchy for "Location" dimension the Foreing Key CountryID joins the FactTable with the dimension.
International Potato Center (CIP)...© 2006
57
Quick Tutorial for Datamart
4.7.7.1.1.1 Create First Join for "Location" dimension
After create the hierarchy, you have to create the join to conect the [Continent] table with the two table join: [Region] and [Country]
International Potato Center (CIP)...© 2006
Create a simple cube
International Potato Center (CIP)...© 2006
58
59
Quick Tutorial for Datamart
Now we are going to create the join for conect the tables of the dimension: [Country] and [Region].
International Potato Center (CIP)...© 2006
Create a simple cube
International Potato Center (CIP)...© 2006
60
61
Quick Tutorial for Datamart
1.- Table [Country]
2.- Table [Region]
International Potato Center (CIP)...© 2006
Create a simple cube
International Potato Center (CIP)...© 2006
62
63
Quick Tutorial for Datamart
4.7.7.1.1.2 Create levels of the hierarchy
Create the levels of the hierarchy: [Continent], [Region] and [Country] 1.- Level: [Continent]
International Potato Center (CIP)...© 2006
Create a simple cube
2.- Level: [Region]
3.- Level: [Country]
International Potato Center (CIP)...© 2006
64
65
Quick Tutorial for Datamart
International Potato Center (CIP)...© 2006
Create a simple cube
4.7.7.2
66
Final Code view
To download the example V Click Here (http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise7.txt)
4.8
Publish schema When you end the edition of the *.mondrian file, you must rename changing the extention from .mondrian to .xml. After you change the *.xml file, copy this file at TOMCAT_HOME\webapps\mondrian\web-inf\queries, then you have to shutdown Tomcat and then start Tomcat again to load Mondrian and see the changes in the file.
International Potato Center (CIP)...© 2006
67
4.9
Quick Tutorial for Datamart
Create Job Script to Fill Database The job script is to copy data from relational databases or flat files(Excel, Text) to OLAP database. This script can be developed in Java, Visual Basic , PHP in the language you prefer. The script must be scheduled to run every day automatically.
5
Install JRubik JRubik is the java/swing dektop version of Mondrian OLAP.
International Potato Center (CIP)...© 2006
Install JRubik
5.1
68
Pre-requisites The programs you need to use Rubik are: 1- Java 1.4.2 or superior versions. 2- Database a.- MySQL, you can use the Xammp that includes MySQL or b.- Microsoft Access that comes included with the jrubik.zip
5.1.1
Verify if you have the right version of Java Open the Command Prompt and write: java -version
You must see that the version is 1.4.2 or a superior version, if you don't have the right version you must download and install it.
International Potato Center (CIP)...© 2006
69
5.1.2
Quick Tutorial for Datamart
Link for the Pre- requisites programs Pre- requisites, if you don't have MySQL you can install Xampp.
5.2
Download and modify JRubik
5.2.1
Download JRubik 1-. Download JRubik from http://research.cip.cgiar.org/docs/mondrian/jrubik.zip 2-. Extract jrubik.zip files in c:\ , this direccion is know as JRUBIK_HOME
International Potato Center (CIP)...© 2006
Install JRubik
5.2.2
70
Change the Windows User Change the directory name "erojas" located at C:\jrubik\data\resources\mdxbookmark with your user name (user windows session).
5.2.3
Modify mnu56802.xml Read only to conect to MySQL If the user "root" has a password you must change the default password at JRUBIK_HOME\data\resources\mdxmenu\ICIS\car56792\mnu56802.xml
In red the user and the password ... ...
International Potato Center (CIP)...© 2006
71
Quick Tutorial for Datamart
5.3
Download and Install MySQL Database
5.3.1
Download Database Download MySQL Database from http://research.cip.cgiar.org/docs/mondrian/icis_mondrian_data.zip
5.3.2
Install Database Extract and copy the files on MYSQL_HOME\data\
5.4
Test JRubik Run the file C:\jrubik\run.bat MySQL
International Potato Center (CIP)...© 2006
Install JRubik
Microsoft Access
International Potato Center (CIP)...© 2006
72
73
6
Quick Tutorial for Datamart
Related Links http://mondrian.sourceforge.net Mondrian http://jpivot.sourceforge.net/mondrian-schema/ Mondrian-Schema http://developer.java.sun.com JDK http://addons.xampp.org/cgi-bin/index.pl Addons for XAMPP
International Potato Center (CIP)...© 2006
Related Links
74
XAMPP-WINDOWS
http://www.apachefriends.org/en/xampp-windows .html
XAMPP-LINUX
http://www.apachefriends.org/en/xampp-linux.ht ml http://www.sourceforge.net SourceForge
International Potato Center (CIP)...© 2006