Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International...
Transcript of Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International...
![Page 1: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/1.jpg)
International Potato Center (CIP)...© 2006
Quick Tutorialabout Mondrian
Datamart
![Page 2: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/2.jpg)
Quick Tutorial for DatamartI
International Potato Center (CIP)...© 2006
Table of ContentsPart I Introduction 4
Part II Install pre-requisites & Mondrian 4
................................................................................................................................... 41 Download and Installing pre-requisites for Mondrian
................................................................................................................................... 62 Download and Installing Mondrian
.......................................................................................................................................................... 6For Windows
.......................................................................................................................................................... 7For Linux
................................................................................................................................... 83 Download and Upload Database for Mondrian
.......................................................................................................................................................... 8Download and Upload Microsoft Access data
.......................................................................................................................................................... 9Download and Upload MySQL data
................................................................................................................................... 104 Modify code
................................................................................................................................... 115 Install Driver for MySQL
................................................................................................................................... 126 Test Mondrian Sample
................................................................................................................................... 127 Enable print and export to Excel and PDF
Part III Install Mondrian Plugin 13
................................................................................................................................... 131 Install
................................................................................................................................... 142 Test Plugin
.......................................................................................................................................................... 14Create new "Simple" Project
.......................................................................................................................................................... 15Open FoodMart.mondrian
Part IV Create a simple cube 16
................................................................................................................................... 171 General overview
................................................................................................................................... 172 Copy database from CD
................................................................................................................................... 173 Create System ODBC
................................................................................................................................... 184 Create a passport folder
................................................................................................................................... 195 Modify mondrian.jsp
................................................................................................................................... 206 Create a new Schema using Eclipse plugin
.......................................................................................................................................................... 20Create a simple project
.......................................................................................................................................................... 21Create a *.mondrian file
.......................................................................................................................................................... 23Create root schema
................................................................................................................................... 247 Adding measures & dimensions
.......................................................................................................................................................... 24Example 1
......................................................................................................................................................... 24Step to modify schema
......................................................................................................................................... 24Create cube "Passport"
......................................................................................................................................... 25Create the fact table "passport_FactTable"
......................................................................................................................................... 26Create the dimension "FAO"
................................................................................................................................... 26Create the hierarchy for "FAO" dimension
................................................................................................................................... 27Create table of hierarchy
................................................................................................................................... 28Create level of hierarchy
......................................................................................................................................... 29Create the measure "Accs"
......................................................................................................................................................... 30Final code view
.......................................................................................................................................................... 31Example 2
![Page 3: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/3.jpg)
IIContents
II
International Potato Center (CIP)...© 2006
......................................................................................................................................................... 31Step to modify schema
......................................................................................................................................... 31Create the dimension "Invitro"
................................................................................................................................... 32Create the hierarchy "Invitro"
................................................................................................................................... 33Create table of hierarchy
................................................................................................................................... 34Create level of hierarchy
......................................................................................................................................................... 35Final code view
.......................................................................................................................................................... 36Example 3
......................................................................................................................................................... 36Step to midified schema
......................................................................................................................................... 36Create the measure "Species"
......................................................................................................................................................... 38Final code view
.......................................................................................................................................................... 38Example 4
......................................................................................................................................................... 38Step to modified schema
......................................................................................................................................... 38Create a dimension "taxonomy"
................................................................................................................................... 39Create the hierarchy for "Taxonomy" dimension
................................................................................................................................... 40Create table of hierarchy
................................................................................................................................... 41Create level genus of hierarchy
................................................................................................................................... 42Create level family of hierarchy
......................................................................................................................................................... 44Final code view
.......................................................................................................................................................... 44Example 5
......................................................................................................................................................... 44Step to modify schema
......................................................................................................................................... 45Create level species of hierarchy
......................................................................................................................................................... 46Final code view
.......................................................................................................................................................... 47Example6
......................................................................................................................................................... 47Create the dimension "location" with two tables
......................................................................................................................................... 48Create the hierarchy for "Location" dimension
................................................................................................................................... 48Create Join for "Location" dimension
................................................................................................................................... 49Create Table: Country
................................................................................................................................... 50Create Table: Region
................................................................................................................................... 51Create levels of hierarchy
................................................................................................................................... 52Create Level: Continent
................................................................................................................................... 52Create Level: Region
................................................................................................................................... 54Create Level: Country
......................................................................................................................................................... 55Final code view
.......................................................................................................................................................... 55Example 7
......................................................................................................................................................... 55Create the dimension "location" with three tables
......................................................................................................................................... 56Create the hierarchy for "Location" dimension
................................................................................................................................... 57Create First Join for "Location" dimension
................................................................................................................................... 59Create Table: Continent
................................................................................................................................... 59Create Second Join for "Location" dimension
................................................................................................................................... 61Create Table: Country
................................................................................................................................... 61Create Table: Region
................................................................................................................................... 63Create levels of the hierarchy
................................................................................................................................... 63Create Level: Continent
................................................................................................................................... 64Create Level: Region
................................................................................................................................... 64Create Level: Country
......................................................................................................................................................... 66Final Code view
................................................................................................................................... 668 Publish schema
................................................................................................................................... 679 Create Job Script to Fill Database
Part V Install JRubik 67
................................................................................................................................... 681 Pre-requisites
.......................................................................................................................................................... 68Verify if you have the right version of Java
.......................................................................................................................................................... 69Link for the Pre- requisites programs
![Page 4: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/4.jpg)
Quick Tutorial for DatamartIII
International Potato Center (CIP)...© 2006
................................................................................................................................... 692 Download and modify JRubik
.......................................................................................................................................................... 69Download JRubik
.......................................................................................................................................................... 70Change the Windows User
.......................................................................................................................................................... 70Modify mnu56802.xml
................................................................................................................................... 713 Download and Install MySQL Database
.......................................................................................................................................................... 71Download Database
.......................................................................................................................................................... 71Install Database
................................................................................................................................... 714 Test JRubik
Part VI Related Links 73
![Page 5: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/5.jpg)
Introduction 4
International Potato Center (CIP)...© 2006
1 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
Xampp
WindowsXampp:
1.4.9
_________
LinuxXampp:
1.4.9
http://research.cip.cgiar.org/docs/downloads/xampp-win32-1.4.9-installer.exe orhttp://www.apachefriends.org/en/xampp-windows.html or<CD>:\Install\Pre-requisites\Windows
___________________________________________________________
http://research.cip.cgiar.org/docs/downloads/xampp-linux-1.4.7.tar.gz orhttp://www.apachefriends.org/en/xampp-linux.html or<CD>:\Instal\Pre-requisites\Linux
![Page 6: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/6.jpg)
Quick Tutorial for Datamart5
International Potato Center (CIP)...© 2006
JDK
WindowsJDK:
1.4.2_07
_________
LinuxJDK:
1.4.2_07
http://research.cip.cgiar.org/docs/downloads/j2sdk-1_4_2_07-windows-i586-p.exe or http://developer.java.sun.com. We downloaded j2sdk1.4.2_07 or<CD>:\Install\Pre-requisites\Windows
___________________________________________________________
http://research.cip.cgiar.org/docs/downloads/j2sdk-1_4_2_07-linux-i586.ziporhttp://developer.java.sun.com. We downloadd j2sdk1.4.2_07 or <CD>:\Install\Pre-requisites\LinuxTo install view README.java.txt
TomcatAdd-on
WindowsTomcat:
5.0.27Addon:1.4.9
_________
LinuxTomcat:
5.0.27Addon:0.3
http://research.cip.cgiar.org/docs/downloads/xampp-tomcat-addon-1.4.9-installer.exe orhttp://sourceforge.net/project/showfiles.php?group_id=61776&package_id=113693 or<CD>:\Install\Pre-requisites\Windows
_______________________________________________________
http://research.cip.cgiar.org/docs/downloads/xampp_tomcat-5.0.27-addon-0.3.tar.gz orhttp://addons.xampp.org/cgi-bin/search.pl?pid=9 or <CD>:\Install\Pre-requisites\LinuxTo install view README.tomcat.txt
Other programs for download, to be use later.
MySql-Connect
or
Windows3.0.16
_________
Linux3.06.16
http://research.cip.cgiar.org/docs/downloads/mysql-connector-java-3.0.16-ga.zip orhttp://dev.mysql.com/downloads/connector/j/3.0.html or<CD>:\Install\Pre-requisites\Windows
________________________________________________________
http://research.cip.cgiar.org/docs/downloads/mysql-connector-java-3.0.16-ga.zip orhttp://dev.mysql.com/downloads/connector/j/3.0.html or<CD>:\Install\Pre-requisites\Linux
Linux2.6.2 http://www.phpmyadmin.net/home_page/downloads.php or
<CD>:\Install\Pre-requisites\Linux
![Page 7: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/7.jpg)
Install pre-requisites & Mondrian 6
International Potato Center (CIP)...© 2006
Windows3.0.1
_________
Linux3.0.1
http://download.eclipse.org/eclipse/downloads/drops/R-3.0.1-200409161125/index.php or<CD>:\Install\Pre-requisites\Windows________________________________________________________
http://download.eclipse.org/eclipse/downloads/drops/R-3.0.1-200409161125/index.php We downloaded SDK-3.0.1-linux-gtk.zip or<CD>:\Install\Pre-requisites\Linux
Mondrianschema
Eclipse Plugin
Windows1.0.1
http://research.cip.cgiar.org/docs/downloads/mondrian-schema-1.0.1.ziporhttp://sourceforge.net/projects/jpivot or<CD>:\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<CD>:\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
![Page 8: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/8.jpg)
Quick Tutorial for Datamart7
International Potato Center (CIP)...© 2006
4. Shutdown Tomcat and Xampp
2.2.2 For Linux
1.Download mondrian-1.1.5 from SourceForge (http://sourceforge.net/projects/mondrian) orhttp://research.cip.cgiar.org/docs/downloads/ (mondrian-1.1.5.zip) or <CD>:\Install\Mondrian\, andunzip 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
![Page 9: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/9.jpg)
Install pre-requisites & Mondrian 8
International Potato Center (CIP)...© 2006
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.mdbuse de Select button.
![Page 10: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/10.jpg)
Quick Tutorial for Datamart9
International Potato Center (CIP)...© 2006
2.3.2 Download and Upload MySQL data
1.Download mondrian-data from http://research.cip.cgiar.org/docs/downloads/ (mondrian-data.zip)or <CD>:\Install\Mondrian\, copy the fles in C:\ directory if you are a windows user.
2.Start Xampp
3.Create user and give privileges
![Page 11: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/11.jpg)
Install pre-requisites & Mondrian 10
International Potato Center (CIP)...© 2006
<MYSQL_HOME>\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 Linuxmysql> source /mondrian-data/demo/mysql/foodmart.sql
For Windowsmysql> 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) inphpmyadmin. 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
![Page 12: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/12.jpg)
Quick Tutorial for Datamart11
International Potato Center (CIP)...© 2006
For MySQL:
<%@ page session="true" contentType="text/html; charset=ISO-8859-1" %><%@ taglib uri="http://www.tonbeller.com/jpivot" prefix="jp" %><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<jp:mondrianQuery id="query01" jdbcDriver="com.mysql.jdbc.Driver"jdbcUrl="jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart"catalogUri="/WEB-INF/queries/FoodMart.xml">
select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns, {([Promotion Media].[All Media], [Product].[All Products])} ON rowsfrom Saleswhere ([Time].[1997])</jp:mondrianQuery>
<c:set var="title01" scope="session">Test Query uses Mondrian OLAP</c:set>
For Access:
<%@ page session="true" contentType="text/html; charset=ISO-8859-1" %><%@ taglib uri="http://www.tonbeller.com/jpivot" prefix="jp" %><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<jp:mondrianQuery id="query01" jdbcDriver="sun.jdbc.odbc.JdbcOdbcDriver" jdbcUrl="jdbc:odbc:MondrianFoodMart" catalogUri="/WEB-INF/queries/FoodMart.xml">
select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns, {([Promotion Media].[All Media], [Product].[All Products])} ON rowsfrom Saleswhere ([Time].[1997])</jp:mondrianQuery>
<c:set var="title01" scope="session">Test Query uses Mondrian OLAP</c:set>
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 <MYSQLCONNECTOR_HOME>/mysql-connector-java-3.0.16-ga ), and copy it inopt/lampp/lib/tomcat/common/lib
In Windows download the mysql's driver (mysql-connector-java-3.0.16-ga-bin.jar from <MYSQLCONNECTOR_HOME>/mysql-connector-java-3.0.16-ga), and copy it inTOMCAT_HOME\commom\lib
![Page 13: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/13.jpg)
Install pre-requisites & Mondrian 12
International Potato Center (CIP)...© 2006
2.6 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 itwork you must add the red lines in the file web.xml located in: TOMCAT_HOME\webapps\mondrian\WEB-INF.
![Page 14: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/14.jpg)
Quick Tutorial for Datamart13
International Potato Center (CIP)...© 2006
...<!-- jfreechart provided servlet -->
<servlet> <servlet-name>Print</servlet-name> <display-name>Print</display-name> <description>Default configuration create for servlet.</description> <servlet-class>com.clarmont.olap.servlet.print</servlet-class> </servlet>
<servlet> <servlet-name>DisplayChart</servlet-name> <servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class> </servlet>
<servlet> <servlet-name>GetChart</servlet-name> <display-name>GetChart</display-name> <description>Default configuration create for servlet.</description> <servlet-class>com.clarmont.olap.servlet.GetChart</servlet-class> </servlet> <servlet> <servlet-name>MDXQueryServlet</servlet-name> <servlet-class>mondrian.web.servlet.MDXQueryServlet</servlet-class> <init-param> <param-name>connectString</param-name> <param-value>Provider=mondrian;Jdbc=jdbc:odbc:MondrianFoodMart;Catalog=/WEB-INF/queries/FoodMart.xml;JdbcDrivers=sun.jdbc.odbc.JdbcOdbcDriver;RoleXX='California manager';</param-value> </init-param> </servlet>
<servlet> <servlet-name>MondrianXmlaServlet</servlet-name> <servlet-class>mondrian.xmla.XmlaServlet</servlet-class> </servlet>
<servlet-mapping> <servlet-name>Print</servlet-name> <url-name>/Print</url-name> </servlet-mapping> <servlet-mapping> <servlet-name>DisplayChart</servlet-name> <url-pattern>/DisplayChart</url-pattern> </servlet-mapping>
<servlet-mapping> <servlet-name>GetChart</servlet-name> <url-name>/GetChart</url-name> </servlet-mapping>
<servlet-mapping> <servlet-name>MDXQueryServlet</servlet-name> <url-pattern>/mdxquery</url-pattern> </servlet-mapping>
<servlet-mapping> <servlet-name>MondrianXmlaServlet</servlet-name> <url-pattern>/xmla</url-pattern> </servlet-mapping>
<welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
...
3 Install Mondrian Plugin
3.1 Install
Pre-requisites: Download and Install Eclipse version 3.x and the EMF&SDO version 2.x(required).
![Page 15: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/15.jpg)
Install Mondrian Plugin 14
International Potato Center (CIP)...© 2006
Download and unzip the mondrian-schema.zip into Eclipse installation directory, this will install theplugin. Download it from http://research.cip.cgiar.org/docs/downloads/ orhttp://sourceforge.net/projects/jpivot or <CD>:\Install\Pre-requisites\Windows
Start up eclipse and in the menu click on Help->About Eclipse Plattform->Plug-in Details. MondrianSchema 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 soEclipse 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
![Page 16: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/16.jpg)
Quick Tutorial for Datamart15
International Potato Center (CIP)...© 2006
3.2.2 Open FoodMart.mondrian
Choose a project directory that contains Foodmart.mondrian. In the Package Explorer selectFoodmart.mondrian and open it.
Now the Eclipse workbench should look similar to the followind screenshot and you should be able toedit the Mondrian Schema
![Page 17: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/17.jpg)
Install Mondrian Plugin 16
International Potato Center (CIP)...© 2006
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
![Page 18: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/18.jpg)
Quick Tutorial for Datamart17
International Potato Center (CIP)...© 2006
4.1 General overview
4.2 Copy database from CD
From <CD>:\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.
![Page 19: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/19.jpg)
Create a simple cube 18
International Potato Center (CIP)...© 2006
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
![Page 20: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/20.jpg)
Quick Tutorial for Datamart19
International Potato Center (CIP)...© 2006
4.5 Modify mondrian.jsp
Windows
In TOMCAT_HOME\webapps\passport\web-inf\queries\mondrian.jsp you must to modify thecode, red code indentify the changes.
Note:"passport.xml" is the model OLAP schema.
<%@ page session="true" contentType="text/html; charset=ISO-8859-1" %><%@ taglib uri="http://www.tonbeller.com/jpivot" prefix="jp" %><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<jp:mondrianQuery id="query01" jdbcDriver="sun.jdbc.odbc.JdbcOdbcDriver"jdbcUrl="jdbc:odbc:cippassportolap" catalogUri="/WEB-INF/queries/passport.xml">
select {[Measures].[Accs]} ON columns, Union({[FAO].[All FAO]}, [FAO].[All FAO].Children) ON rowsfrom [passport]
</jp:mondrianQuery>
<c:set var="title01" scope="session">Test Query uses Mondrian OLAP</c:set>
![Page 21: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/21.jpg)
Create a simple cube 20
International Potato Center (CIP)...© 2006
Linux
In opt/lampp/lib/tomcat/webapp/passport/WEB-INF/queries/mondrian.jsp you must to modify thecode, red code indentify the changes.
<%@ page session="true" contentType="text/html; charset=ISO-8859-1" %><%@ taglib uri="http://www.tonbeller.com/jpivot" prefix="jp" %><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<jp:mondrianQuery id="query01" jdbcDriver="com.mysql.jdbc.Driver"jdbcUrl="jdbc:mysql://localhost/cippassportolap?user=foodmart&passport=foodmart"catalogUri="/WEB-INF/queries/passport.xml">
select {[Measures].[Accs]} ON columns, Union({[FAO].[All FAO]}, [FAO].[All FAO].Children) ON rowsfrom [passport]
</jp:mondrianQuery>
<c:set var="title01" scope="session">Test Query uses Mondrian OLAP</c:set>
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 yourworkspace, in this example the proyect is called passport_olap
![Page 22: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/22.jpg)
Quick Tutorial for Datamart21
International Potato Center (CIP)...© 2006
4.6.2 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 :
![Page 23: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/23.jpg)
Create a simple cube 22
International Potato Center (CIP)...© 2006
Now in the text editor wrtite the folowing code to create a root schema
<?xml version="1.0"?> <Schema name="Passport">
</Schema> />
Now using the Mondrian editor form to check if the schema has created succesfuly:
![Page 24: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/24.jpg)
Quick Tutorial for Datamart23
International Potato Center (CIP)...© 2006
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 theschema, cubes, dimensions,etc.
![Page 25: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/25.jpg)
Create a simple cube 24
International Potato Center (CIP)...© 2006
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.
![Page 26: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/26.jpg)
Quick Tutorial for Datamart25
International Potato Center (CIP)...© 2006
4.7.1.1.2 Create the fact table "passport_FactTable"
Create the fact table "passport_FactTable"
![Page 27: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/27.jpg)
Create a simple cube 26
International Potato Center (CIP)...© 2006
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
![Page 28: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/28.jpg)
Quick Tutorial for Datamart27
International Potato Center (CIP)...© 2006
After to create the hierarchy of dimension, you have to create the table of the dimension
![Page 29: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/29.jpg)
Create a simple cube 28
International Potato Center (CIP)...© 2006
After to create the table of dimension, you have to create the level of the hierarchy.
![Page 30: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/30.jpg)
Quick Tutorial for Datamart29
International Potato Center (CIP)...© 2006
4.7.1.1.4 Create the measure "Accs"
Create the measure "Accs" to count the number of germplasm.
![Page 31: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/31.jpg)
Create a simple cube 30
International Potato Center (CIP)...© 2006
4.7.1.2 Final code view
And this cube has the following code.
![Page 32: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/32.jpg)
Quick Tutorial for Datamart31
International Potato Center (CIP)...© 2006
To download the example I Click Here(http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise1.txt) or from <CD>:\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 andone measure. Now we can create a new dimension
4.7.2.1.1 Create the dimension "Invitro"
Create the dimension"Invitro"
![Page 33: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/33.jpg)
Create a simple cube 32
International Potato Center (CIP)...© 2006
4.7.2.1.1.1 Create the hierarchy "Invitro"
Create the hierarchy for Invitro dimension
![Page 34: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/34.jpg)
Quick Tutorial for Datamart33
International Potato Center (CIP)...© 2006
After to create the hierarchy of dimension, you have to create the table of the dimension
![Page 35: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/35.jpg)
Create a simple cube 34
International Potato Center (CIP)...© 2006
After to create the tabla of dimension, you have to create the level of the hierarchy.
![Page 36: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/36.jpg)
Quick Tutorial for Datamart35
International Potato Center (CIP)...© 2006
4.7.2.2 Final code view
And this is its source code
![Page 37: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/37.jpg)
Create a simple cube 36
International Potato Center (CIP)...© 2006
To download the example II Click Here(http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise2.txt)
or from <CD>:\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 onemeasure. 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.
![Page 38: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/38.jpg)
Quick Tutorial for Datamart37
International Potato Center (CIP)...© 2006
![Page 39: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/39.jpg)
Create a simple cube 38
International Potato Center (CIP)...© 2006
4.7.3.2 Final code view
To download the example III Click Here(http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise3.txt)or from <CD>:\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 twomeasures. Now we will create a new dimension with two levels.
4.7.4.1.1 Create a dimension "taxonomy"
Create the dimension "Taxonomy".
![Page 40: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/40.jpg)
Quick Tutorial for Datamart39
International Potato Center (CIP)...© 2006
4.7.4.1.1.1 Create the hierarchy for "Taxonomy" dimension
Create the hierarchy for "Taxonomy" dimension
![Page 41: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/41.jpg)
Create a simple cube 40
International Potato Center (CIP)...© 2006
After to create the hierarchy of dimension, you have to create the table of the dimension
![Page 42: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/42.jpg)
Quick Tutorial for Datamart41
International Potato Center (CIP)...© 2006
After to create the table of dimension, you have to create the level of the hierarchy.
![Page 43: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/43.jpg)
Create a simple cube 42
International Potato Center (CIP)...© 2006
After to create the table of dimension, you have to create the level of the hierarchy.
![Page 44: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/44.jpg)
Quick Tutorial for Datamart43
International Potato Center (CIP)...© 2006
![Page 45: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/45.jpg)
Create a simple cube 44
International Potato Center (CIP)...© 2006
4.7.4.2 Final code view
To download the example IV Click Here(http://research.cip.cgiar.org/docs/downloads/examples_mondrian/exercise4.txt)
or from <CD>:\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 andtwo measures. Now we will create a new level of the "Taxonomy" dimension.
![Page 46: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/46.jpg)
Quick Tutorial for Datamart45
International Potato Center (CIP)...© 2006
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.
![Page 47: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/47.jpg)
Create a simple cube 46
International Potato Center (CIP)...© 2006
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 <CD>:\Examples\Schemas
NOTE: that the example V is the same to passport.xml
![Page 48: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/48.jpg)
Quick Tutorial for Datamart47
International Potato Center (CIP)...© 2006
4.7.6 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"
![Page 49: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/49.jpg)
Create a simple cube 48
International Potato Center (CIP)...© 2006
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 thedimension.
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].
![Page 50: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/50.jpg)
Quick Tutorial for Datamart49
International Potato Center (CIP)...© 2006
1.- Table [Country]
![Page 51: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/51.jpg)
Create a simple cube 50
International Potato Center (CIP)...© 2006
2- Table [Region]
![Page 52: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/52.jpg)
Quick Tutorial for Datamart51
International Potato Center (CIP)...© 2006
4.7.6.1.1.2 Create levels of hierarchy
Create the levels of the hierarchy: [Continent], [Region] and [Country]
![Page 53: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/53.jpg)
Create a simple cube 52
International Potato Center (CIP)...© 2006
1.- Level: [Continent]
2.- Level: [Region]
![Page 54: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/54.jpg)
Quick Tutorial for Datamart53
International Potato Center (CIP)...© 2006
![Page 55: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/55.jpg)
Create a simple cube 54
International Potato Center (CIP)...© 2006
3.- Level: [Country]
![Page 56: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/56.jpg)
Quick Tutorial for Datamart55
International Potato Center (CIP)...© 2006
4.7.6.2 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"
![Page 57: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/57.jpg)
Create a simple cube 56
International Potato Center (CIP)...© 2006
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 thedimension.
![Page 58: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/58.jpg)
Quick Tutorial for Datamart57
International Potato Center (CIP)...© 2006
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 tablejoin: [Region] and [Country]
![Page 59: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/59.jpg)
Create a simple cube 58
International Potato Center (CIP)...© 2006
![Page 60: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/60.jpg)
Quick Tutorial for Datamart59
International Potato Center (CIP)...© 2006
Now we are going to create the join for conect the tables of the dimension: [Country] and [Region].
![Page 61: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/61.jpg)
Create a simple cube 60
International Potato Center (CIP)...© 2006
![Page 62: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/62.jpg)
Quick Tutorial for Datamart61
International Potato Center (CIP)...© 2006
1.- Table [Country]
2.- Table [Region]
![Page 63: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/63.jpg)
Create a simple cube 62
International Potato Center (CIP)...© 2006
![Page 64: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/64.jpg)
Quick Tutorial for Datamart63
International Potato Center (CIP)...© 2006
4.7.7.1.1.2 Create levels of the hierarchy
Create the levels of the hierarchy: [Continent], [Region] and [Country]
1.- Level: [Continent]
![Page 65: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/65.jpg)
Create a simple cube 64
International Potato Center (CIP)...© 2006
2.- Level: [Region]
3.- Level: [Country]
![Page 66: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/66.jpg)
Quick Tutorial for Datamart65
International Potato Center (CIP)...© 2006
![Page 67: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/67.jpg)
Create a simple cube 66
International Potato Center (CIP)...© 2006
4.7.7.2 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 changesin the file.
![Page 68: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/68.jpg)
Quick Tutorial for Datamart67
International Potato Center (CIP)...© 2006
4.9 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.
![Page 69: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/69.jpg)
Install JRubik 68
International Potato Center (CIP)...© 2006
5.1 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 mustdownload and install it.
![Page 70: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/70.jpg)
Quick Tutorial for Datamart69
International Potato Center (CIP)...© 2006
5.1.2 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
![Page 71: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/71.jpg)
Install JRubik 70
International Potato Center (CIP)...© 2006
5.2.2 Change the Windows User
Change the directory name "erojas" located at C:\jrubik\data\resources\mdxbookmark with your username (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 ...
<RubikConnection driver="com.mysql.jdbc.Driver"url="jdbc:mysql://localhost/icis_mondrian" userName="root" password=""catalog="file:./data/resources/catalogs/FoodMart.xml" />
...
![Page 72: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/72.jpg)
Quick Tutorial for Datamart71
International Potato Center (CIP)...© 2006
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
![Page 73: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/73.jpg)
Install JRubik 72
International Potato Center (CIP)...© 2006
Microsoft Access
![Page 74: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/74.jpg)
Quick Tutorial for Datamart73
International Potato Center (CIP)...© 2006
6 Related Links
Mondrianhttp://mondrian.sourceforge.net
Mondrian-Schemahttp://jpivot.sourceforge.net/mondrian-schema/
JDK
http://developer.java.sun.com
Addons for XAMPPhttp://addons.xampp.org/cgi-bin/index.pl
![Page 75: Quick Tutorial for Datamart - CGIAR · PDF fileI Quick Tutorial for Datamart International Potato Center (CIP)...© 2006 Table of Contents Part IIntroduction 4 Part IIInstall pre-requisites](https://reader031.fdocuments.us/reader031/viewer/2022021818/5ab129037f8b9abc2f8c4f4c/html5/thumbnails/75.jpg)
Related Links 74
International Potato Center (CIP)...© 2006
XAMPP-WINDOWShttp://www.apachefriends.org/en/xampp-windows.html
XAMPP-LINUXhttp://www.apachefriends.org/en/xampp-linux.html
SourceForge
http://www.sourceforge.net