⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 foodmart.xml

📁 本人写的另一个XML实例化小程序
💻 XML
字号:
<?xml version="1.0"?>
<Schema name="FoodMart">
  <Dimension name="Store">
    <Hierarchy hasAll="true" primaryKey="store_id">
      <Table name="store"/>
      <Level name="Store Country" column="store_country" uniqueMembers="true"/>
      <Level name="Store State" column="store_state" uniqueMembers="true"/>
      <Level name="Store City" column="store_city" uniqueMembers="false"/>
      <Level name="Store Name" column="store_name" uniqueMembers="true">
        <Property name="Store Type" column="store_type"/>
        <Property name="Store Manager" column="store_manager"/>
        <Property name="Store Sqft" column="store_sqft" type="Numeric"/>
        <Property name="Grocery Sqft" column="grocery_sqft" type="Numeric"/>
        <Property name="Frozen Sqft" column="frozen_sqft" type="Numeric"/>
        <Property name="Meat Sqft" column="meat_sqft" type="Numeric"/>
        <Property name="Has coffee bar" column="coffee_bar" type="Boolean"/>
        <Property name="Street address" column="store_street_address" type="String"/>
      </Level>
    </Hierarchy>
  </Dimension>
  <Dimension name="Store Size in SQFT">
    <Hierarchy hasAll="true" primaryKey="store_id">
      <Table name="store"/>
      <Level name="Store Sqft" column="store_sqft" type="Numeric" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>

  <Dimension name="Store Type">
    <Hierarchy hasAll="true" primaryKey="store_id">
      <Table name="store"/>
      <Level name="Store Type" column="store_type" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>

  <Dimension name="Time" type="TimeDimension">
    <Hierarchy hasAll="false" primaryKey="time_id">
      <Table name="time_by_day"/>
      <Level name="Year" column="the_year" type="Numeric" uniqueMembers="true"
          levelType="TimeYears"/>
      <Level name="Quarter" column="quarter" uniqueMembers="false"
          levelType="TimeQuarters"/>
      <Level name="Month" column="month_of_year" uniqueMembers="false" type="Numeric"
          levelType="TimeMonths"/>
    </Hierarchy>
    <Hierarchy hasAll="true" name="Weekly" primaryKey="time_id"
          defaultMember="[Time.Weekly].[All Time.Weeklys].[1997]">
      <Table name="time_by_day"/>
      <Level name="Year" column="the_year" type="Numeric" uniqueMembers="true"
          levelType="TimeYears"/>
      <Level name="Week" column="week_of_year" type="Numeric" uniqueMembers="false"
          levelType="TimeWeeks"/>
      <Level name="Day" column="day_of_month" uniqueMembers="false" type="Numeric"
          levelType="TimeDays"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Warehouse">
    <Hierarchy hasAll="true" primaryKey="warehouse_id">
      <Table name="warehouse"/>
      <Level name="Country" column="warehouse_country" uniqueMembers="true"/>
      <Level name="State Province" column="warehouse_state_province"
          uniqueMembers="true"/>
      <Level name="City" column="warehouse_city" uniqueMembers="false"/>
      <Level name="Warehouse Name" column="warehouse_name" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>

<!-- Sales -->
<Cube name="Sales">
  <Table name="sales_fact_1997"/>
  <DimensionUsage name="Store" source="Store" foreignKey="store_id"/>
  <DimensionUsage name="Store Size in SQFT" source="Store Size in SQFT"
      foreignKey="store_id"/>
  <DimensionUsage name="Store Type" source="Store Type" foreignKey="store_id"/>
  <DimensionUsage name="Time" source="Time" foreignKey="time_id"/>
  <DimensionUsage name="Product" source="Product" foreignKey="product_id"/>
  <Dimension name="Promotion Media" foreignKey="promotion_id">
    <Hierarchy hasAll="true" allMemberName="All Media" primaryKey="promotion_id" defaultMember="All Media">
      <Table name="promotion"/>
      <Level name="Media Type" column="media_type" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Promotions" foreignKey="promotion_id">
    <Hierarchy hasAll="true" allMemberName="All Promotions" primaryKey="promotion_id" defaultMember="[All Promotions]">
      <Table name="promotion"/>
      <Level name="Promotion Name" column="promotion_name" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Education Level" foreignKey="customer_id">
    <Hierarchy hasAll="true" primaryKey="customer_id">
      <Table name="customer"/>
      <Level name="Education Level" column="education" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Gender" foreignKey="customer_id">
    <Hierarchy hasAll="true" allMemberName="All Gender" primaryKey="customer_id">
      <Table name="customer"/>
      <Level name="Gender" column="gender" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Marital Status" foreignKey="customer_id">
    <Hierarchy hasAll="true" allMemberName="All Marital Status" primaryKey="customer_id">
      <Table name="customer"/>
      <Level name="Marital Status" column="marital_status" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Yearly Income" foreignKey="customer_id">
    <Hierarchy hasAll="true" primaryKey="customer_id">
      <Table name="customer"/>
      <Level name="Yearly Income" column="yearly_income" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>

  <Measure name="Unit Sales" column="unit_sales" aggregator="sum"
      formatString="Standard"/>
  <Measure name="Store Cost" column="store_cost" aggregator="sum"
      formatString="#,###.00"/>
  <Measure name="Store Sales" column="store_sales" aggregator="sum"
      formatString="#,###.00"/>
  <Measure name="Sales Count" column="product_id" aggregator="count"
      formatString="#,###"/>
  <Measure name="Customer Count" column="customer_id"
      aggregator="distinct count" formatString="#,###"/>
  <CalculatedMember
      name="Profit"
      dimension="Measures">
    <Formula>[Measures].[Store Sales] - [Measures].[Store Cost]</Formula>
    <CalculatedMemberProperty name="FORMAT_STRING" value="$#,##0.00"/>
  </CalculatedMember>
  <CalculatedMember
      name="Profit last Period"
      dimension="Measures"
      formula="COALESCEEMPTY((Measures.[Profit], [Time].PREVMEMBER),    Measures.[Profit])"
      visible="false">
    <CalculatedMemberProperty name="FORMAT_STRING" value="$#,##0.00"/>
  </CalculatedMember>
  <CalculatedMember
      name="Profit Growth"
      dimension="Measures"
      formula="([Measures].[Profit] - [Measures].[Profit last Period]) / [Measures].[Profit last Period]"
      visible="true"
      caption="Gewinn-Wachstum">
    <CalculatedMemberProperty name="FORMAT_STRING" value="0.0%"/>
  </CalculatedMember>
</Cube>

<Cube name="Warehouse">
  <Table name="inventory_fact_1997"/>

  <DimensionUsage name="Store" source="Store" foreignKey="store_id"/>
  <DimensionUsage name="Store Size in SQFT" source="Store Size in SQFT"
      foreignKey="store_id"/>
  <DimensionUsage name="Store Type" source="Store Type" foreignKey="store_id"/>
  <DimensionUsage name="Time" source="Time" foreignKey="time_id"/>
  <DimensionUsage name="Product" source="Product" foreignKey="product_id"/>
  <DimensionUsage name="Warehouse" source="Warehouse" foreignKey="warehouse_id"/>

  <Measure name="Store Invoice" column="store_invoice" aggregator="sum"/>
  <Measure name="Supply Time" column="supply_time" aggregator="sum"/>
  <Measure name="Warehouse Cost" column="warehouse_cost" aggregator="sum"/>
  <Measure name="Warehouse Sales" column="warehouse_sales" aggregator="sum"/>
  <Measure name="Units Shipped" column="units_shipped" aggregator="sum" formatString="#.0"/>
  <Measure name="Units Ordered" column="units_ordered" aggregator="sum" formatString="#.0"/>
  <Measure name="Warehouse Profit" column="&quot;warehouse_sales&quot;-&quot;inventory_fact_1997&quot;.&quot;warehouse_cost&quot;" aggregator="sum"/>
</Cube>

<!-- Test a cube based upon a single table. -->
<Cube name="Store">
  <Table name="store"/>
  <!-- We could have used the shared dimension "Store Type", but we
     want to test private dimensions without primary key. -->
  <Dimension name="Store Type">
    <Hierarchy hasAll="true">
      <Level name="Store Type" column="store_type" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>

  <!-- We don't have to specify primary key or foreign key since the shared
     dimension "Store" has the same underlying table as the cube. -->
  <DimensionUsage name="Store" source="Store"/>

  <Dimension name="Has coffee bar">
    <Hierarchy hasAll="true">
      <Level name="Has coffee bar" column="coffee_bar" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>

  <Measure name="Store Sqft" column="store_sqft" aggregator="sum"
      formatString="#,###"/>
  <Measure name="Grocery Sqft" column="grocery_sqft" aggregator="sum"
      formatString="#,###"/>

</Cube>

<Cube name="HR">
  <Table name="salary"/>
  <!-- Use private "Time" dimension because key is different than public
     "Time" dimension. -->
  <Dimension name="Time" type="TimeDimension" foreignKey="pay_date">
    <Hierarchy hasAll="false" primaryKey="the_date">
      <Table name="time_by_day"/>
      <Level name="Year" column="the_year" type="Numeric" uniqueMembers="true"
          levelType="TimeYears"/>
      <Level name="Quarter" column="quarter" uniqueMembers="false"
          levelType="TimeQuarters"/>
      <!-- Use the_month as source for the name, so members look like
           [Time].[1997].[Q1].[Jan] rather than [Time].[1997].[Q1].[1]. -->
      <Level name="Month" column="month_of_year" nameColumn="the_month"
          uniqueMembers="false" type="Numeric" levelType="TimeMonths"/>
    </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>
  <Dimension name="Store Type" foreignKey="employee_id">
    <Hierarchy hasAll="true" primaryKeyTable="employee" primaryKey="employee_id">
      <Join leftKey="store_id" rightKey="store_id">
        <Table name="employee"/>
        <Table name="store"/>
      </Join>
      <Level name="Store Type" table="store" column="store_type"
          uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>

  <Dimension name="Position" foreignKey="employee_id">
    <Hierarchy hasAll="true" allMemberName="All Position"
        primaryKey="employee_id">
      <Table name="employee"/>
      <Level name="Management Role" uniqueMembers="true"
          column="management_role"/>
      <Level name="Position Title" uniqueMembers="false"
          column="position_title" ordinalColumn="position_id"/>
    </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">
        <Closure parentColumn="supervisor_id" childColumn="employee_id">
          <Table name="employee_closure"/>
        </Closure>
        <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="#,#"/>
  <Measure name="Number of Employees" column="employee_id"
      aggregator="distinct 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>
</Schema>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -