模式定义
多维模式是使用数据挖掘查询语言 (DMQL) 定义的。立方体定义和维度定义这两个原语可用于定义数据仓库和数据集市。
多维数据集定义的语法
define cube < cube_name > [ < dimension-list > }: < measure_list >
维度定义的语法
define dimension < dimension_name > as ( < attribute_or_dimension_list > )
星型模式定义
我们讨论的星型模式可以使用数据挖掘查询语言(DMQL)定义如下 -
define cube sales star [time, item, branch, location]:
dollars sold = sum(sales in dollars), units sold = count(*)
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, country)
雪花模式定义
雪花模式可以使用 DMQL 定义如下 -
define cube sales snowflake [time, item, branch, location]:
dollars sold = sum(sales in dollars), units sold = count(*)
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))
define dimension branch as (branch key, branch name, branch type)
define dimension location as (location key, street, city (city key, city, province or state, country))
事实星座模式定义
事实星座模式可以使用 DMQL 定义如下 -
define cube sales [time, item, branch, location]:
dollars sold = sum(sales in dollars), units sold = count(*)
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,country)
define cube shipping [time, item, shipper, from location, to location]:
dollars cost = sum(cost in dollars), units shipped = count(*)
define dimension time as time in cube sales
define dimension item as item in cube sales
define dimension shipper as (shipper key, shipper name, location as location in cube sales, shipper type)
define dimension from location as location in cube sales
define dimension to location as location in cube sales