数据仓库的数据模型与数据组织(40P)
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
区(880) 商店(2000)
指标和事实:
预测销售量、实际销售量、预测偏差
2020年8月20日星期四
Data Mining: Concepts and Techniques
9
A Concept Hierarchy: Dimension (location)
all region
all
Europe
...
location_key units_sold
dollars_sold avg_sales
item
item_key item_name brand type supplier_type
location
location_key street city province_or_street country
Measures
2020年8月20日星期四
Sales Fact Table
time_key item_key
branch_key
item
item_key item_name brand type supplier_type
Shipping Fact Table
time_key item_key
shipper_key from_location
Data Mining: Concepts and Techniques
11
星型图模型(逻辑模型)
〖例〗销售分析的星型图模型。
产品维 地区维
时间维
销售分析:
实际销售 预测销售 预测偏差
组别维 其他维
2020年8月20日星期四
Data Mining: Concepts and Techniques
12
更详细的 技术细节
信息包图
星型图模型
物理数据模 型
概念模型 逻辑模型 物理模型
2020年8月20日星期四
Data Mining: Concepts and Techniques
5
信息包图(概念模型)
信息包图:是数据仓库的数据模型的第一层或最高层。由于大 多数商务数据是多维的,但传统的数据模型表示三维以上的数 据有一定困难。而信息包图简化了这一过程并且允许用户设计 多维信息包并与开发者和其他用户建立联系。这种模型集中在 用户对信息包的需要,信息包提供了分析人员思维模式的可视 化表示。
define dimension time as (time_key, day, day_of_week, month, quarter, year) define dimension item as (item_key, item_name, brand, type, supplier_type) define dimension branch as (branch_key, branch_name, branch_type) define dimension location as (location_key, street, city, province_or_state,
item
item_key item_name brand type supplier_key
supplier
supplier_key supplier_type
location
location_key street city_key
city
city_key city province_or_street country
North_America
country
Germany ... Spain
Canada ... Mexico
city
Frankfurt ...
Vancouver ... Toronto
office
L. Chan ... M. Wind
2020年8月20日星期四
Data Mining: Concepts and Techniques
time,item,supplier
item,location,supplier
time, item, location, supplier
2020年8月20日星期四
Data Mining: Concepts and Techniques
4-D(base) cuboid
3
数据仓库的数据模型-
与数据库系统数据模型的区别
6
信息包图
信息包: 维度
类别
指标和事实
空白信息包图样式
2020年8月20日星期四
Data Mining: Concepts and Techniques
7
信息包图
〖例〗试画出销售分析的信息包图。 解:首先根据销售分析的实际需求,确定信息包的维度、类别
和指标与事实: (1)维度:包括日期维、销售地点维、销售产品维、年龄组
2020年8月20日星期四
Data Mining: Concepts and Techniques
8
销售分析的信息包图
信息包: 销售分析 维度
类别
日期 年(10)
销售地点 国家(15)
销售产品 年龄组别 性别 产品类(6) 年龄组(8) 性别组(2)
季度 区域(45) 产品组(48) (40)
月(120) 城市(280) 产品(240)
define dimension time as (time_key, day, day_of_week, month, quarter, year)
define dimension item as (item_key, item_name, brand, type, supplier(supplier_key, supplier_type))
2020年8月20日星期四
Data Mining: Concepts and Techniques
16
Example of Fact Constellation
time
time_key day day_of_the_week month quarter year
branch
branch_key branch_name branch_type
Example of Star Schema
time
time_key day day_of_the_week month quarter year
branch
branch_key branch_name branch_type
Measures
Sales Fact Table time_key item_key branch_key
define dimension time as (time_key, day, day_of_week, month, quarter, year)
define dimension item as (item_key, item_name, brand, type, supplier_type)
define dimension branch as (branch_key, branch_name, branch_type)
2020年8月20日星期四
Data Mining: Concepts and Techniques
15
Defining a Snowflake Schema in DMQL
define cube sales_snowflake [time, item, branch, location]:
dollars_sold = sum(sales_in_dollars), avg_sales = avg(sales_in_dollars), units_sold = count(*)
units_shipped
shipper
shipper_key shipper_name location_key shipper_type 17
Defining a Fact Constellation in DMQL
define cube sales [time, item, branch, location]: dollars_sold = sum(sales_in_dollars), avg_sales = avg(sales_in_dollars), units_sold = count(*)
别维、性别维等。 (2)类别:确定各维的详细类别,如:日期维包括年(10)、
季度(40)、月(120)等类别,括号中的数字分别指出 各类别的数量;销售地点维包括国家(15)、区域(45)、 城市(280)、区(880)、商店(2000)等类别,括号 中的数字同样分别指出各类别的数量;类似地,可以确定销 售产品、年龄组别维、性别维等的详细类别。 (3)指标和事实:确定用于进行分析的数值化信息,包括预 测销售量、实际销售量和预测偏差等。
工作: 确定系统边界:决策类型、需要的信息、原始信息 确定主题域及其内容:主题域的公共键码、联系、属性组 确定维度:如时间维、销售位置维、产品维、组别维等 确定类别:相应维的详细类别 确定指标和事实:用于进行分析的数值化信息
2020年8月20日星期四
Data Mining: Concepts and Techniques
1
数据仓库中的数据组织
高度综合级
轻度综合级
多级数据
当前综合级 早期细节级
2020年8月20日星期四
Data Mining: Concepts and Techniques
2
Cube: A Lattice of Cuboids
all
0-D(apex) cuboid
time
item
location supplier
2020年8月20日星期四
Data Mining: Concepts and Techniques
13
Defining a Star Schema in DMQL
define cube sales_star [time, item, branch, location]:
dollars_sold = sum(sales_in_dollars), avg_sales = avg(sales_in_dollars), units_sold = count(*)
define dimension location as (location_key, street, city, province_or_state, country)
2020年8月20日星期四
Data Mining: Concepts and Techniques
14
Example of Snowflake Schema
time
time_key day day_of_the_week month quarter year
branch
branch_key branch_name branch_type
Measures
Sales Fact Table
time_key item_key branch_key location_key units_sold dollars_sold avg_sales
location_key units_sold
dollars_sold avg_sales
location
location_key street city province_or_street country
Data Mining: Concepts and Techniques
to_location dollars_cost
10
星型图模型(逻辑模型)
星型图:数据仓库的数据模型的第二层是向最终的 数据结构添加某些细节的星型图模型。与传统的关 系模型相比,星型图模型简化了用户分析所需的关 系,从支持决策的角度去定义数据实体,更适合大 量复杂查询。
星形图包括了三种逻辑实体:
指标
维度
详细类别
2020年8月20日星期四
第二章 数据仓库的数据模型与数据组织
本章要点
数据仓库的数据模型 概念模型 逻辑模型 物理模型
数据仓库数据组织的基本概念 粒度 维度 元数据 数据分割
数据仓库的数据组织 数据仓库的数据组织方式 数据仓库的数据存储组织2020年8月20日星期四
Data Mining: Concepts and Techniques
数据仓库的数据模型中不包含纯操作型数据。
数据仓库的数据模型扩充了码结构,增加了时间 属性作为码的一部分。
数据仓库的数据模型中增加了一些面向主题的导 出数据。
2020年8月20日星期四
Data Mining: Concepts and Techniques
4
数据仓库的数据模型
面向用户的需求
细 化 层 次
define dimension branch as (branch_key, branch_name, branch_type)
define dimension location as (location_key, street, city(city_key, province_or_state, country))
1-D cuboids
time,item
time,location
item,location
location,supplier
time,supplier
item,supplier
2-D cuboids
time,item,location
time,location,supplier
3-D cuboids