Mondrian 4 测试的简单demo(Saiku简单测试Schema文件)

## 整理此文章方便大家做测试(手写Mondrian Schema自测),不必每次都向saiku上传文件了

## 关键文件
* foodmart4.xml  测试对应的schema文件
* foodmart-sql.zip    测试对应的数据库脚本

maven项目:
pom文件

    4.0.0
    cn.firewarm
    testMondrian
    war
    0.0.1-SNAPSHOT
    testMondrian Maven Webapp
    http://maven.apache.org
    
        
            mine
            public Releases
            default
            http://nexus.liuyingguang.cn:8081/nexus/content/groups/public/
        
        
            mine-meteorite-bi-release
            public Releases
            default
            http://nexus.liuyingguang.cn:8081/nexus/content/repositories/meteorite-bi-release/
        
    
    
        
            org.pentaho
            mondrian
            4.5.0.2-208
        
        
            mysql
            mysql-connector-java
            5.1.9
        
    
    
        testMondrian
    


foodmart4.xml文件


    

    
        
|| ' ' || + ' ' + || ' ' || CONCAT(, ' ', ) + ' ' + CONCAT(CONCAT(, ' '), ) || ' ' ||
Iif( = 0, 0, ) case when = 0 then 0 else end
-
[yyyy] [yyyy].[Qq] [yyyy].[Qq].[mm] [yyyy] [yyyy].[ww] [yyyy].[ww].[dd] yyyy/mm/dd Verkaufen Ventes Ventes Cube des ventes Cube Verkaufen Cube den Verkaufen [Measures].[Store Sales] - [Measures].[Store Cost] [Measures].[Store Sales] - [Measures].[Store Cost] [Store].[Stores].[All Stores] TopCount([Warehouse].[Warehouse Name].MEMBERS, 5, [Measures].[Warehouse Sales])


简单java代码测试:
package testMondrian;


import java.io.PrintWriter;  
import mondrian.olap.Connection;  
import mondrian.olap.DriverManager;  
import mondrian.olap.Query;  
import mondrian.olap.Result;  


/** 
 *
 * @author Liuyg 
 * @mail [email protected] 
 * @version  
 * @time May 18, 2015
 *
 */
public class Test {
	public static void main(String[] args) {  
	    
  Connection connection = DriverManager.getConnection( "Provider=mondrian;Jdbc=jdbc:mysql://192.168.100.217:3307/zuhu?user=root&password=root;Catalog=C:/Users/lighting/Desktop/report.xml;", null); Query query = connection.parseQuery( "SELECT NON EMPTY {Hierarchize({[Measures].[calls]})} ON COLUMNS,NON EMPTY {Hierarchize({[times].[day].Members})} ON ROWS FROM [call_data] "); Result result = connection.execute(query); PrintWriter pw = new PrintWriter(System.out); result.print(pw); pw.flush();
   }   }

返回结果示例:
Axis #0:
{}
Axis #1:
{[Measures].[Store Sqft]}
Axis #2:
{[Store Type].[Store Type].[All Store Type]}
{[Store Type].[Store Type].[Deluxe Supermarket]}
{[Store Type].[Store Type].[Gourmet Supermarket]}
{[Store Type].[Store Type].[Mid-Size Grocery]}
{[Store Type].[Store Type].[Small Grocery]}
{[Store Type].[Store Type].[Supermarket]}
Row #0: 571,596
Row #1: 146,045
Row #2: 47,447
Row #3: 109,343
Row #4: 75,281
Row #5: 193,480





by 刘迎光
OpenBI交流群: 495266201
博客saiku专栏: http://blog.csdn.net/column/details/openbi.html

你可能感兴趣的:(OLAP,mondrian,saiku,OpenBI)