Mondrian简介概要.ppt
文本预览下载声明
建立模式(schema)文件 一个模式定义了一个多维数据库. 它包含一个逻辑模型(logical model)、一组数据立方(consisting of cubes)、层次(hierarchies)、和成员(members), 并映射到物理模型(关系数据库)上。 简单的说,配置一个模式就是配置一个关系数据结构到多维数据结构的映射。 注: 关于mondrian的模式及模式的配置,您可以通过阅读mondrian的基本模式.pptx来了解。这里我们只对其进行了简单介绍。 2.7.1 创建模式文件: 模式文件的创建很简单。首先在WEB-INF下新建一个queries的文件夹,然后在该文件夹下创建一个名为tezz.xml的文件。再按下面的步骤将xml元素添加入即可。 将模式文件tezz.xml创建在这里 配置模式文件: 添加数据立方Sales: 往tezz.xml中添加如下代码: ?xml version=1.0 encoding=UTF-8? Schema name=tezz Cube name=Sales !-- 事实表sale(fact table) -- Table name=sale / /Cube /Schema 该模式的名称 数据立方的名称 数据立方Sales在关系数据库中对应的事实表的表名称 添加数据立方Sales的维: 添加客户维: !-- 客户维 -- Dimension name=客户性别 foreignKey=cusId Hierarchy hasAll=true allMemberName=所有性别 primaryKey=cusId Table name=Customer/Table Level name=gender column=gender/Level /Hierarchy /Dimension ?xml version=1.0 encoding=UTF-8? Schema name=tezz Cube name=Sales !-- 事实表sale(fact table) -- Table name=sale / /Cube /Schema 复制到 该维的名称 事实表sale中用于引用维表Customer的外键列 表示该维的所有成员 维表Customer的主键 维表Customer在关系数据库中的名称 级别的名称 级别gender在维表Customer中的列名称 添加产品维(因为产品维由两个表连接而成,因此比客户维复杂些): !-- 产品类别维 -- Dimension name=产品类别 foreignKey=proId Hierarchy hasAll=true allMemberName=所有产品 primaryKey=proId primaryKeyTable=product join leftKey=proTypeId rightKey=proTypeId Table name=product / Table name=producttype/Table /join Level name=proTypeId column=proTypeId nameColumn=proTypeName uniqueMembers=true table=producttype / Level name=proId column=proId nameColumn=proName uniqueMembers=true table=product / /Hierarchy /Dimension 将上面的代码复制在客户维的下面即可 因为Product维有两个表,所以您必须在这里指定该维的主表 Join元素,用于将两个以上的表连接起来 需要指定包含该级别的表 添加度量(共有三个度量:数量、平均单价和总销售额): !-- 产品数量度量 -- Measure name=数量 column=number aggregator=sum datatype=Numeric / Measure name=总销售额 aggregator=sum formatString=¥#,##0.00 !-- unitPrice*number所得值的列 -- MeasureExpression SQL dialect=generic(unitPrice*number)/SQL /MeasureExpression /Measure CalculatedMember name=平均单价 dimension=Measures Formula[Measures].[总销售额] / [M
显示全部