Skip to content

Commit

Permalink
MONDRIAN:
Browse files Browse the repository at this point in the history
Parent-child hierarchies are now working.
Document access-control and parent-child hierarchies in the Schema Guide.
Implement and test the Descendants function, in all of its glorious modes.
Functions now use List rather than Vector to store collections.

[git-p4: depot-paths = "//open/mondrian/": change = 406]
  • Loading branch information
julianhyde committed Mar 30, 2003
1 parent c2e788e commit 5924ae3
Show file tree
Hide file tree
Showing 44 changed files with 1,904 additions and 845 deletions.
8 changes: 4 additions & 4 deletions build.sh
Expand Up @@ -3,7 +3,7 @@
# This software is subject to the terms of the Common Public License
# Agreement, available at the following URL:
# http://www.opensource.org/licenses/cpl.html.
# (C) Copyright 2003 Julian Hyde
# Copyright (C) 2003 Julian Hyde
# All Rights Reserved.
# You must accept the terms of that agreement to use this software.

Expand Down Expand Up @@ -36,9 +36,9 @@ if [ ! -d "${JUNIT_HOME}" ]; then
exit 1
fi

export TOMCAT_HOME="${PREFIX}/jakarta-tomcat-4.1.18"
if [ ! -d "${TOMCAT_HOME}" ]; then
echo "TOMCAT_HOME (${TOMCAT_HOME}) does not exist"
export CATALINA_HOME="${PREFIX}/jakarta-tomcat-4.1.18"
if [ ! -d "${CATALINA_HOME}" ]; then
echo "CATALINA_HOME (${CATALINA_HOME}) does not exist"
exit 1
fi

Expand Down
95 changes: 91 additions & 4 deletions demo/FoodMart.xml
@@ -1,13 +1,18 @@
<?xml version="1.0"?>
<Schema>
<!--
== $Id$
== This software is subject to the terms of the Common Public License
== Agreement, available at the following URL:
== http://www.opensource.org/licenses/cpl.html.
== (C) Copyright 2000-2002 Kana Software, Inc. and others.
== Copyright (C) 2000-2003 Kana Software, Inc. and others.
== All Rights Reserved.
== You must accept the terms of that agreement to use this software.
==
== todo:
== 1. <CalculatedMember/>
== 2. <Measure aggregator="distinct count"/>
-->
<Schema>

<!-- Shared dimensions -->

Expand Down Expand Up @@ -120,7 +125,7 @@ WHERE "product"."product_class_id" = "product_class"."product_class_id"
<Level name="State Province" column="state_province" uniqueMembers="true"/>
<Level name="City" column="city" uniqueMembers="false"/>
<Level name="Name" uniqueMembers="true">
<ExpressionView>
<KeyExpression>
<SQL dialect="oracle">
"fname" || ' ' || "lname"
</SQL>
Expand All @@ -136,7 +141,7 @@ CONCAT(`customer`.`fname`, " ", `customer`.`lname`)
<SQL dialect="generic">
"lname"
</SQL>
</ExpressionView>
</KeyExpression>
<Property name="Gender" column="gender"/>
<Property name="Marital Status" column="marital_status"/>
<Property name="Education" column="education"/>
Expand Down Expand Up @@ -227,6 +232,87 @@ CONCAT(`customer`.`fname`, " ", `customer`.`lname`)

</Cube>

<Cube name="HR">
<Table name="salary"/>
<!-- Use private "Time" dimension because key is different than public
"Time" dimension. -->
<Dimension name="Time" foreignKey="pay_date">
<Hierarchy hasAll="false" primaryKey="the_date">
<Table name="time_by_day"/>
<Level name="Year" column="the_year" type="Numeric" uniqueMembers="true"/>
<Level name="Quarter" column="quarter" uniqueMembers="false"/>
<Level name="Month" column="month_of_year" uniqueMembers="false" type="Numeric"/>
</Hierarchy>
</Dimension>

<Dimension name="Store" foreignKey="employee_id" >
<Hierarchy hasAll="true" primaryKey="employee_id" primaryKeyTable="employee">
<Join leftKey="store_id" rightKey="store_id">
<Table name="employee"/>
<Table name="store"/>
</Join>
<Level name="Store Country" table="store" column="store_country" uniqueMembers="true"/>
<Level name="Store State" table="store" column="store_state" uniqueMembers="true"/>
<Level name="Store City" table="store" column="store_city" uniqueMembers="false"/>
<Level name="Store Name" table="store" column="store_name" uniqueMembers="true">
<Property name="Store Type" table="store" column="store_type"/>
<Property name="Store Manager" table="store" column="store_manager"/>
<Property name="Store Sqft" table="store" column="store_sqft" type="Numeric"/>
<Property name="Grocery Sqft" table="store" column="grocery_sqft" type="Numeric"/>
<Property name="Frozen Sqft" table="store" column="frozen_sqft" type="Numeric"/>
<Property name="Meat Sqft" table="store" column="meat_sqft" type="Numeric"/>
<Property name="Has coffee bar" table="store" column="coffee_bar" type="Boolean"/>
<Property name="Street address" table="store" column="store_street_address" type="String"/>
</Level>
</Hierarchy>
</Dimension>

<Dimension name="Pay Type" foreignKey="employee_id">
<Hierarchy hasAll="true" primaryKey="employee_id" primaryKeyTable="employee">
<Join leftKey="position_id" rightKey="position_id">
<Table name="employee"/>
<Table name="position"/>
</Join>
<Level name="Pay Type" table="position" column="pay_type" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<DimensionUsage name="Store Type" source="Store Type" foreignKey="store_id"/>
<Dimension name="Position" foreignKey="employee_id">
<Hierarchy hasAll="true" primaryKey="employee_id">
<Table name="employee"/>
<Level name="Management Role" uniqueMembers="true" column="management_role"/>
<Level name="Position Title" uniqueMembers="false" column="position_title"/>
</Hierarchy>
</Dimension>
<Dimension name="Department" foreignKey="department_id">
<Hierarchy hasAll="true" primaryKey="department_id">
<Table name="department"/>
<Level name="Department Description" uniqueMembers="true" column="department_id"/>
</Hierarchy>
</Dimension>
<Dimension name="Employees" foreignKey="employee_id">
<Hierarchy hasAll="true" allMemberName="All Employees" primaryKey="employee_id">
<Table name="employee"/>
<Level name="Employee Id" type="Numeric" uniqueMembers="true" column="employee_id" parentColumn="supervisor_id" nameColumn="full_name" nullParentValue="0">
<Property name="Marital Status" column="marital_status"/>
<Property name="Position Title" column="position_title"/>
<Property name="Gender" column="gender"/>
<Property name="Salary" column="salary"/>
<Property name="Education Level" column="education_level"/>
<Property name="Management Role" column="management_role"/>
</Level>
</Hierarchy>
</Dimension>
<Measure name="Org Salary" column="salary_paid" aggregator="sum" formatString="Currency" />
<Measure name="Count" column="employee_id" aggregator="count" formatString="#,#"/>
<!-- todo: change aggregator="distinct count"-->
<Measure name="Number of Employees" column="employee_id" aggregator="count" formatString="#,#"/>
<CalculatedMember name="Employee Salary" dimension="[Measures]" formatString="Currency"
formula="(employees.currentmember.datamember, [Measures].[Org Salary])"/>
<CalculatedMember name="Avg Salary" dimension="[Measures]" formatString="Currency"
formula="[Measures].[Org Salary]/[Measures].[Number of Employees]"/>
</Cube>

<VirtualCube name="Warehouse and Sales">
<VirtualCubeDimension name="Time"/>
<VirtualCubeDimension name="Store"/>
Expand All @@ -236,6 +322,7 @@ CONCAT(`customer`.`fname`, " ", `customer`.`lname`)
<VirtualCubeMeasure cubeName="Warehouse" name="[Measures].[Units Shipped]"/>
</VirtualCube>


<!-- A California manager can only see customers and stores in California.
They cannot drill down on Gender. -->
<Role name="California manager">
Expand Down
72 changes: 36 additions & 36 deletions demo/FoodMartIndexes.sql
Expand Up @@ -2,7 +2,7 @@
# This software is subject to the terms of the Common Public License
# Agreement, available at the following URL:
# http://www.opensource.org/licenses/cpl.html.
# (C) Copyright 2002-2003 Kana Software, Inc. and others.
# Copyright (C) 2002-2003 Kana Software, Inc. and others.
# All Rights Reserved.
# You must accept the terms of that agreement to use this software.
#
Expand All @@ -11,13 +11,13 @@ CREATE INDEX i_account_parent ON account ( account_parent );
CREATE UNIQUE INDEX i_category_id ON category ( category_id );
CREATE INDEX i_category_parent ON category ( category_parent );
CREATE UNIQUE INDEX i_currency ON currency ( currency_id, date );
CREATE INDEX i_customer_account_num ON customer ( account_num );
CREATE INDEX i_customer_fname ON customer ( fname );
CREATE INDEX i_customer_lname ON customer ( lname );
CREATE INDEX i_customer_children_at_home ON customer ( num_children_at_home );
CREATE INDEX i_customer_account_num ON customer ( account_num );
CREATE INDEX i_customer_fname ON customer ( fname );
CREATE INDEX i_customer_lname ON customer ( lname );
CREATE INDEX i_customer_children_at_home ON customer ( num_children_at_home );
CREATE UNIQUE INDEX i_customer_id ON customer ( customer_id );
CREATE INDEX i_customer_postal_code ON customer ( postal_code );
CREATE INDEX i_customer_region_id ON customer ( customer_region_id );
CREATE INDEX i_customer_postal_code ON customer ( postal_code );
CREATE INDEX i_customer_region_id ON customer ( customer_region_id );
CREATE UNIQUE INDEX i_department_id ON department ( department_id );
CREATE UNIQUE INDEX i_employee_id ON employee ( employee_id );
CREATE INDEX i_employee_department_id ON employee ( department_id );
Expand All @@ -26,41 +26,41 @@ CREATE INDEX i_employee_supervisor_id ON employee ( supervisor_id );
CREATE INDEX i_expense_store_id ON expense_fact ( store_id );
CREATE INDEX i_expense_account_id ON expense_fact ( account_id );
CREATE INDEX i_expense_time_id ON expense_fact ( time_id );
CREATE INDEX i_inv_1997_product_id ON inventory_fact_1997 ( product_id );
CREATE INDEX i_inv_1997_store_id ON inventory_fact_1997 ( store_id );
CREATE INDEX i_inv_1997_time_id ON inventory_fact_1997 ( time_id );
CREATE INDEX i_inv_1997_warehouse_id ON inventory_fact_1997 ( warehouse_id );
CREATE INDEX i_inv_1998_product_id ON inventory_fact_1998 ( product_id );
CREATE INDEX i_inv_1998_store_id ON inventory_fact_1998 ( store_id );
CREATE INDEX i_inv_1998_time_id ON inventory_fact_1998 ( time_id );
CREATE INDEX i_inv_1998_warehouse_id ON inventory_fact_1998 ( warehouse_id );
CREATE INDEX i_inv_1997_product_id ON inventory_fact_1997 ( product_id );
CREATE INDEX i_inv_1997_store_id ON inventory_fact_1997 ( store_id );
CREATE INDEX i_inv_1997_time_id ON inventory_fact_1997 ( time_id );
CREATE INDEX i_inv_1997_warehouse_id ON inventory_fact_1997 ( warehouse_id );
CREATE INDEX i_inv_1998_product_id ON inventory_fact_1998 ( product_id );
CREATE INDEX i_inv_1998_store_id ON inventory_fact_1998 ( store_id );
CREATE INDEX i_inv_1998_time_id ON inventory_fact_1998 ( time_id );
CREATE INDEX i_inv_1998_warehouse_id ON inventory_fact_1998 ( warehouse_id );
CREATE UNIQUE INDEX i_position_id ON position ( position_id );
CREATE INDEX i_product_brand_name ON product ( brand_name );
CREATE INDEX i_product_brand_name ON product ( brand_name );
CREATE UNIQUE INDEX i_product_id ON product ( product_id );
CREATE INDEX i_product_class_id ON product ( product_class_id );
CREATE INDEX i_product_name ON product ( product_name );
CREATE INDEX i_product_SKU ON product ( SKU );
CREATE INDEX i_product_class_id ON product ( product_class_id );
CREATE INDEX i_product_name ON product ( product_name );
CREATE INDEX i_product_SKU ON product ( SKU );
CREATE UNIQUE INDEX i_promotion_id ON promotion ( promotion_id );
CREATE INDEX i_promotion_district_id ON promotion ( promotion_district_id );
CREATE INDEX i_promotion_district_id ON promotion ( promotion_district_id );
CREATE UNIQUE INDEX i_reserve_employee_id ON reserve_employee ( employee_id );
CREATE INDEX i_reserve_employee_dept_id ON reserve_employee ( department_id );
CREATE INDEX i_reserve_employee_store_id ON reserve_employee ( store_id );
CREATE INDEX i_reserve_employee_super_id ON reserve_employee ( supervisor_id );
CREATE INDEX i_sales_1997_customer_id ON sales_fact_1997 ( customer_id );
CREATE INDEX i_sales_1997_product_id ON sales_fact_1997 ( product_id );
CREATE INDEX i_sales_1997_promotion_id ON sales_fact_1997 ( promotion_id );
CREATE INDEX i_sales_1997_store_id ON sales_fact_1997 ( store_id );
CREATE INDEX i_sales_1997_time_id ON sales_fact_1997 ( time_id );
CREATE INDEX i_sales_dec_1998_customer_id ON sales_fact_dec_1998 ( customer_id );
CREATE INDEX i_sales_dec_1998_product_id ON sales_fact_dec_1998 ( product_id );
CREATE INDEX i_sales_dec_1998_promotion_id ON sales_fact_dec_1998 ( promotion_id );
CREATE INDEX i_sales_dec_1998_store_id ON sales_fact_dec_1998 ( store_id );
CREATE INDEX i_sales_dec_1998_time_id ON sales_fact_dec_1998 ( time_id );
CREATE INDEX i_sales_1998_customer_id ON sales_fact_1998 ( customer_id );
CREATE INDEX i_sales_1998_product_id ON sales_fact_1998 ( product_id );
CREATE INDEX i_sales_1998_promotion_id ON sales_fact_1998 ( promotion_id );
CREATE INDEX i_sales_1998_store_id ON sales_fact_1998 ( store_id );
CREATE INDEX i_sales_1998_time_id ON sales_fact_1998 ( time_id );
CREATE INDEX i_sales_1997_customer_id ON sales_fact_1997 ( customer_id );
CREATE INDEX i_sales_1997_product_id ON sales_fact_1997 ( product_id );
CREATE INDEX i_sales_1997_promotion_id ON sales_fact_1997 ( promotion_id );
CREATE INDEX i_sales_1997_store_id ON sales_fact_1997 ( store_id );
CREATE INDEX i_sales_1997_time_id ON sales_fact_1997 ( time_id );
CREATE INDEX i_sales_dec_1998_customer_id ON sales_fact_dec_1998 ( customer_id );
CREATE INDEX i_sales_dec_1998_product_id ON sales_fact_dec_1998 ( product_id );
CREATE INDEX i_sales_dec_1998_promotion_id ON sales_fact_dec_1998 ( promotion_id );
CREATE INDEX i_sales_dec_1998_store_id ON sales_fact_dec_1998 ( store_id );
CREATE INDEX i_sales_dec_1998_time_id ON sales_fact_dec_1998 ( time_id );
CREATE INDEX i_sales_1998_customer_id ON sales_fact_1998 ( customer_id );
CREATE INDEX i_sales_1998_product_id ON sales_fact_1998 ( product_id );
CREATE INDEX i_sales_1998_promotion_id ON sales_fact_1998 ( promotion_id );
CREATE INDEX i_sales_1998_store_id ON sales_fact_1998 ( store_id );
CREATE INDEX i_sales_1998_time_id ON sales_fact_1998 ( time_id );
CREATE UNIQUE INDEX i_store_id ON store ( store_id );
CREATE INDEX i_store_region_id ON store ( region_id );
CREATE INDEX i_store_region_id ON store ( region_id );
# End FoodMartIndexes.sql

0 comments on commit 5924ae3

Please sign in to comment.