1.什么是星座模型?

2.哪些地方可以用到星座模型?

3.Mondrian怎么构建星座模型,构建过程又涉及到哪些理论概念。

答1:这里描述了维度模型常用的 星型、雪花、星座模型,简而言之就是多事实表模型。

[转载] 第二篇 数据仓库与数据集市建模

答2:例如有个场景,通过资产负债及损益表计算应收款周转天数。其中资产负债表和损益表都有对应单独的数据视图

计算公式如下:

应收款周转天数 = 360/(([Total 本期发生数],[营业收入])/(([Total 年初数],[应收账款])+([Total 期末数],[应收账款]))/2)

=360/损益表中项目为[营业收入]的本期发生数合计 /(资产负债表中项目为[应收账款]的年初数合计+年末数合计)/2

=360/损益表中项目为[营业收入]的本期发生数合计 /(资产负债表中项目为[应收账款]的年平均数

为了实现上述统计,如果使用传统物理模型去串表则容易产生数据冗余的情况。具体如何冗余自己脑补一下吧。为了解决上述问题则通过建立逻辑模型进行计算处理。

答3:

Mondrian实现理论上的星座模型过程涉及到哪些概念呢?见下图

1.退化维度的概念参考这里

维度-退化维度

组织这里为什么会被称为退化维度?因为在资产负债视图中,已经包含了组织编码和组织名称字段,不需要另外串表来实现,所以叫退化维度。基本一个资产负债视图事实表就替代了N个维度表。

见SQL查询资产负债视图

select * from 资产负债视图

2.共享维度的概念参考这里:

维度-共享维度

模型中建立了年度的共享维度,并在资产负债视图、损益视图都调用了年度共享维度。

实现方法就是在需要使用共享维度的Cube外面建一个维度,然后在各个Cube需要引用共享维度的使用添加对共享维度的引用。

为了模拟方便,手工建立了年度、月度的维度表

 1 create Table 年表
 2 (
 3 id int,
 4 年度 int
 5 )
 6
 7 create Table 月表
 8 (
 9 id int,
10 FYEARID int,
11 月份 int
12 )
13
14 insert into 年表(id,年度)
15 select 1,2018
16 union all
17 select 2,2019
18
19
20 insert into 月表(id,FYEARID,月份)
21 select 1,1,1
22 union all
23 select 2,1,2
24 union all
25 select 3,1,3
26 union all
27 select 4,1,4
28 union all
29 select 5,1,5
30 union all
31 select 6,1,6
32 union all
33 select 7,1,7
34 union all
35 select 8,1,8
36 union all
37 select 9,1,9
38 union all
39 select 10,1,10
40 union all
41 select 11,1,11
42 union all
43 select 12,1,12
44
45
46
47
48 select * from  年表
49 select * from  月表
50
51
52
53
54
55 insert into 月表(id,FYEARID,月份)
56 select 21,2,1
57 union all
58 select 22,2,2
59 union all
60 select 23,2,3
61 union all
62 select 24,2,4
63 union all
64 select 25,2,5
65 union all
66 select 26,2,6
67 union all
68 select 27,2,7
69 union all
70 select 28,2,8
71 union all
72 select 29,2,9
73 union all
74 select 30,2,10
75 union all
76 select 31,2,11
77 union all
78 select 32,2,12

View Code

3.重点就是建立虚拟立方体了,

其实这里虚拟立方体就是星座模型的载体。

Mondrain官方给了虚拟立方体的解释(Virtual OLAP Cubes) https://help.pentaho.com/Documentation/7.1/0N0/020/040/000

另外一个老外那里给了虚拟立方体的定义案例可以参考 https://diethardsteiner.github.io/mondrian/2017/03/20/Mondrian-Multivalued-Dimension-Attribute.html

其实前面的准备工作做好了,后面建立虚拟立方体的工作就很简单了。

首先,命名

然后加入共享维度,注意共享维度不需要填写 cubeName。

最后是调用资产负债Cube和损益Cube的度量值

例如:调用资产负债Cube的年初数度量值,cubeName选择资产负债Cube的名称【BalanceCube】。

而name这里写法,[注意]、[注意]、[注意],必须先填写前缀 [Mesures].  再加上各个Cube的度量值名称,外面加上中括号[]。

资产负债的年初数度量值写法应该是

[Mesures].[NCS]

损益的本期发生数写法则应该是

[Mesures].[BQFSS]

保存,上传到Saiku,预览一下模型。

至此,通过Mondrian构建星座模型的工作已成功完成,具体自己调整可以继续。

附上Schema文件

<Schema name="FinSchema" description="财务模式" measuresCaption="财务模式"><Dimension type="StandardDimension" visible="true" name="年度"><Hierarchy visible="true" hasAll="true" allMemberName="所有年度" allMemberCaption="所有年度" primaryKey="年度"><Table name="年表" schema="dbo" alias=""></Table><Level name="年度" visible="true" column="年度" nameColumn="年度" type="Integer" uniqueMembers="false"></Level></Hierarchy></Dimension><Cube name="BalanceCube" caption="资产负债Cube" visible="true" description="资产负债Cube" cache="true" enabled="true"><Table name="资产负债视图" schema="dbo"></Table><Dimension type="StandardDimension" visible="true" highCardinality="false" name="组织" caption="组织编码"><Hierarchy visible="true" hasAll="true" allMemberName="所有组织" allMemberCaption="所有组织"><Level name="组织编码" visible="true" column="组织编码" nameColumn="组织名称" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level><Level name="组织名称" visible="true" column="组织名称" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level></Hierarchy></Dimension><Dimension type="StandardDimension" visible="true" highCardinality="false" name="账簿"><Hierarchy name="BookHierarchy" visible="true" hasAll="true" allMemberName="所有账簿" allMemberCaption="所有账簿"><Level name="账簿名称" visible="true" column="账簿名称" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level></Hierarchy></Dimension><Dimension type="StandardDimension" visible="true" highCardinality="false" name="项目分类"><Hierarchy name="ItemTypeHierarchy" visible="true" hasAll="true" allMemberName="所有分类" allMemberCaption="所有分类"><Level name="项目分类" visible="true" column="项目分类" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level></Hierarchy></Dimension><Dimension type="StandardDimension" visible="true" highCardinality="false" name="项目名称"><Hierarchy name="ItemHierarchy" visible="true" hasAll="true" allMemberName="所有项目" allMemberCaption="所有项目"><Level name="项目名称" visible="true" column="项目名称" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level></Hierarchy></Dimension><DimensionUsage source="年度" name="年度" visible="true" foreignKey="年"></DimensionUsage><Measure name="NCS" column="年初数" aggregator="sum" visible="true"></Measure><Measure name="QMS" column="期末数" aggregator="sum" visible="true"></Measure></Cube><Cube name="ProfitCube" caption="利润Cube" visible="true" description="利润Cube" cache="true" enabled="true"><Table name="损益视图" schema="dbo"></Table><Dimension type="StandardDimension" visible="true" highCardinality="false" name="组织"><Hierarchy visible="true" hasAll="true" allMemberName="所有组织" allMemberCaption="所有组织"><Level name="组织编码" visible="true" column="组织编码" nameColumn="组织编码" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level><Level name="组织名称" visible="true" column="组织名称" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level></Hierarchy></Dimension><Dimension type="StandardDimension" visible="true" highCardinality="false" name="账簿"><Hierarchy visible="true" hasAll="true" allMemberName="所有账簿" allMemberCaption="所有账簿"><Level name="账簿名称" visible="true" column="账簿名称" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level></Hierarchy></Dimension><Dimension type="StandardDimension" visible="true" highCardinality="false" name="项目名称"><Hierarchy visible="true" hasAll="true" allMemberName="所有项目名称" allMemberCaption="所有项目名称"><Level name="项目名称" visible="true" column="项目名称" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never"></Level></Hierarchy></Dimension><DimensionUsage source="年度" name="年度" visible="true" foreignKey="年"></DimensionUsage><Measure name="BQFSS" column="本期发生数" datatype="Numeric" aggregator="sum" visible="true"></Measure></Cube><VirtualCube enabled="true" name="BPCube" description="财务资产负债损益模型"><VirtualCubeDimension name="年度"></VirtualCubeDimension><VirtualCubeMeasure cubeName="BalanceCube" name="[Measures].[NCS]" visible="true"></VirtualCubeMeasure><VirtualCubeMeasure cubeName="ProfitCube" name="[Measures].[BQFSS]" visible="true"></VirtualCubeMeasure></VirtualCube>
</Schema>

View Code

其实度量值可以用中文标示

转载于:https://www.cnblogs.com/Bruce_H21/p/10517655.html

使用Mondrian Virtual OLAP Cube 实现星座模型并在saiku展现分析相关推荐

  1. 全方位解读星型模型,雪花模型及星座模型

    ​1背景 在多维分析的商业智能解决方案中,根据事实表和维度表的关系,又可将常见的模型分为星型模型,雪花型模型及星座模型.在设计逻辑型数据的模型的时候,就应考虑数据是按照星型模型,雪花型模型还是星座模型 ...

  2. 数仓 建模思想之星型模型、雪花模型、星座模型

    数仓 建模思想之星型模型.雪花模型.星座模型 1. 背景 在大数据开发中,数据一般是分为事实表,维度表,实体表等表. 事实表顾名思义就是记录实际发生的事情如订单表,优惠券使用表等等. 维度表,顾名思义 ...

  3. 三大数据模型:星型模型、雪花模型、星座模型

    星型模型 星型模型中只有一张事实表,以及0张或多张维表,事实表与维表通过主键外键相关联,维表之间不存在关联关系,当所有维表都关联到事实表时,整个图形非常像一种星星的结构,所以称之为"星型模型 ...

  4. 数据仓库、OLAP和 数据挖掘、统计分析的关系和区别分析 .

    数据仓库.OLAP和 数据挖掘.统计分析的关系和区别分析 一.什么是数据挖掘 数据挖掘(Data Mining),又称为数据库中的知识发现(Knowledge Discovery in Databas ...

  5. R语言回归模型构建、回归模型基本假设(正态性、线性、独立性、方差齐性)、回归模型诊断、car包诊断回归模型、特殊观察样本分析、数据变换、模型比较、特征筛选、交叉验证、预测变量相对重要度

    R语言回归模型构建.回归模型基本假设(正态性.线性.独立性.方差齐性).回归模型诊断.car包诊断回归模型.特殊观察样本分析.数据变换.模型比较.特征筛选.交叉验证.预测变量相对重要度 目录

  6. AI+医疗:基于模型的医疗应用大规模分析 | 腾讯AI Lab学术论坛演讲

    来源:腾讯AI实验室 摘要:3月15日,腾讯AI Lab第二届学术论坛在深圳举行,聚焦人工智能在医疗.游戏.多媒体内容.人机交互等四大领域的跨界研究与应用. 3月15日,腾讯AI Lab第二届学术论坛 ...

  7. 用matlab分析时间响应教程,基于Matlab的多自由度耦合滑移模型的动力响应可靠度分析...

    Hi~我是mania 参考资料: (1)基于耦合滑移模型的岩体地震可靠性分析方法 (3)结构可靠度分析:方法与程序 简化模型及运动平衡方程 如下图1所示的多层隔震建筑,当受到地震作用时每层结构体都会产 ...

  8. python短期预测图_Python中利用长短期记忆模型LSTM进行时间序列预测分析

    原文链接:http://tecdat.cn/?p=6663 此示例中,神经网络用于使用2011年4月至2013年2月期间的数据预测都柏林市议会公民办公室的能源消耗. 每日数据是通过总计每天提供的15分 ...

  9. python django框架分析_Django框架模型简单介绍与使用分析

    本文实例讲述了Django框架模型简单介绍与使用.分享给大家供大家参考,具体如下: ORM介绍 ORM Object relational mapping 对象关系映射 把面向对象中的类和数据库表一一 ...

最新文章

  1. tensorflow学习笔记————分类MNIST数据集
  2. 拦截PHP各种异常和错误,发生致命错误时进行报警,万事防患于未然
  3. 拼车日滴滴派单的那些事
  4. CTL_CODE说明
  5. 整理了Linux常用命令变量
  6. Call to undefined function imagettftext()解决方法
  7. python爬虫的具体流程_[专栏作家]【Python】爬虫程序 (一)
  8. asp.net图书馆管理系统
  9. 【预测模型】基于Elman神经网络预测电力负荷matlab代码
  10. 关于在Ubuntu安装JLink驱动的最简便方法
  11. IPV4怎么转换成IPV6?
  12. 浏览器主页被篡改解决小妙招
  13. CAD VCL Multiplatform SDK 定制Crack
  14. mysql优化之in内子查询
  15. BadgeView使用介绍
  16. 1213:八皇后问题
  17. 2020年10月25日总结
  18. 防火墙添加ip白名单_宝塔防火墙IP白名单添加/导入云盾YUNDUN高防CDN节点IP段
  19. 【效率为王】超详细 Hexo + Github Pages 博客搭建教程
  20. 专访阿里云闵万里:云上逐鹿_ET大脑要做行业化、垂直化的创新运用

热门文章

  1. 一次性存入多少钱就可以有资格跟银行商谈利息了?
  2. 建议大家都玩一下自媒体
  3. 华为p40为何没有搭载鸿蒙系统?
  4. try-catch-finally机制
  5. 从git上clone项目到IDEA
  6. 安装win10和ubuntu双系统启动不了解决
  7. linux sd卡 分区变大,Linux 动态调整分区大小
  8. 学习PowerShell和SQL Server –简介
  9. sql server 面试_SQL Server复制面试问题与解答
  10. @sql 单元测试_SQL单元测试最佳实践