| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| |
| --> |
| <x_base_cube name="sales" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> |
| <properties> |
| <property name="cube.sales.timed.dimensions.list" value="order_time,delivery_time" /> |
| <property name="cube.timedim.partition.order_time" value="ot" /> |
| <property name="cube.timedim.partition.delivery_time" value="dt" /> |
| <property name="cube.timedim.relation.order_time" value="delivery_time+[-20 days,-1 hour]" /> |
| <!-- means dt-20days <= ot <= dt-1hour --> |
| </properties> |
| <measures> |
| <measure name="unit_sales" _type="BIGINT" default_aggr="SUM" display_string="Unit Sales" format_string="#,###"/> |
| <measure name="store_sales" _type="DOUBLE" default_aggr="SUM" display_string="Store Sales" format_string="#,###.##"/> |
| <measure name="store_cost" _type="DOUBLE" default_aggr="SUM" display_string="Store Cost" format_string="#,###.00" |
| start_time='2015-03-01T00:00:00' /> |
| <measure name="line_item_quantity" _type="INT" default_aggr="SUM" display_string="Line item quantity"/> |
| <measure name="line_item_product_price" _type="FLOAT" default_aggr="SUM" display_string="Line item product price"/> |
| <measure name="line_item_discount_amount" _type="FLOAT" default_aggr="SUM" display_string="Line item discount"/> |
| <measure name="line_item_tax" _type="FLOAT" default_aggr="SUM" display_string="Line item tax"/> |
| <measure name="max_line_item_price" _type="FLOAT" default_aggr="MAX" display_string="Maximum Line item price"/> |
| <measure name="max_line_item_discount" _type="FLOAT" default_aggr="MAX" |
| display_string="Maximum Line item discount"/> |
| <measure name="rating" _type="FLOAT" default_aggr="AVG" |
| display_string="Rating"/> |
| </measures> |
| <dim_attributes> |
| <dim_attribute name="customer_id" _type="INT" /> |
| <dim_attribute name="product_id" _type="INT" /> |
| <dim_attribute name="promotion_id" _type="INT" /> |
| <dim_attribute name="order_id" _type="INT" /> |
| <dim_attribute name="order_line_number" _type="INT" /> |
| <dim_attribute name="order_time" _type="TIMESTAMP" /> |
| <dim_attribute name="delivery_time" _type="TIMESTAMP" /> |
| <dim_attribute name="customer_city_id" _type="INT" start_time='2015-03-01T00:00:00' /> |
| <dim_attribute name="production_city_id" _type="INT" /> |
| <dim_attribute name="delivery_city_id" _type="INT" /> |
| <dim_attribute name="customer_city_name" _type="string" description="City name to which the customer belongs" |
| display_string="Customer City"> |
| <chain_ref_column chain_name="customer_city" ref_col="name" /> |
| <chain_ref_column chain_name="customer_details" ref_col="customer_city_name" /> |
| </dim_attribute> |
| <dim_attribute name="customer_interest" _type="string" description="Customer's interest" |
| display_string="Customer Interest"> |
| <chain_ref_column chain_name="customer_interests_chain" ref_col="name" /> |
| </dim_attribute> |
| <dim_attribute name="production_location"> |
| <hierarchy> |
| <dim_attribute name="production_city_name" _type="STRING" description="City name in which the product was produced" |
| display_string="Production City"> |
| <chain_ref_column chain_name="production_city" ref_col="name" /> |
| </dim_attribute> |
| <dim_attribute name="production_state" _type="STRING" description="State name in which the product was produced" |
| display_string="Production State"/> |
| <dim_attribute name="production_country" _type="STRING" description="Country name in which the product was produced" |
| display_string="Production Country"/> |
| </hierarchy> |
| </dim_attribute> |
| <dim_attribute name="delivery_city_name" _type="STRING" description="City name to which the product was delivered" |
| display_string="Delivery City"> |
| <chain_ref_column chain_name="delivery_city" ref_col="name" /> |
| </dim_attribute> |
| </dim_attributes> |
| <expressions> |
| <expression name="profit" _type="DOUBLE" display_string="Profit"> |
| <expr_spec expr="store_sales - store_cost"/> |
| </expression> |
| <expression name="promotion_sales" _type="DOUBLE" display_string="Promotion sales"> |
| <expr_spec expr="sum(case when promotion_id = 0 then 0 else store_sales end)" start_time='2015-04-12T00:00:00'/> |
| <expr_spec expr="sum(case when promotion_id = -1 then 0 when promotion_id = -1 then 0 else store_sales end)" |
| end_time="2015-04-12T00:00:00"/> |
| </expression> |
| </expressions> |
| <join_chains> |
| <join_chain name="customer_details"> |
| <paths> |
| <path> |
| <edges> |
| <edge> |
| <from table="sales" column="customer_id" /> |
| <to table="customer" column="id" /> |
| </edge> |
| </edges> |
| </path> |
| </paths> |
| </join_chain> |
| <join_chain name="customer_interests_chain"> |
| <paths> |
| <path> |
| <edges> |
| <edge> |
| <from table="sales" column="customer_id" /> |
| <to table="customer" column="id" /> |
| </edge> |
| <edge> |
| <from table="customer" column="id" /> |
| <to table="customer_interests" column="customer_id" maps_to_many="true" /> |
| </edge> |
| <edge> |
| <from table="customer_interests" column="interest_id" /> |
| <to table="interests" column="id" /> |
| </edge> |
| </edges> |
| </path> |
| </paths> |
| </join_chain> |
| <join_chain name="product_details"> |
| <paths> |
| <path> |
| <edges> |
| <edge> |
| <from table="sales" column="product_id" /> |
| <to table="product" column="id" /> |
| </edge> |
| </edges> |
| </path> |
| </paths> |
| </join_chain> |
| <join_chain name="customer_city"> |
| <paths> |
| <path> |
| <edges> |
| <edge> |
| <from table="sales" column="customer_city_id" /> |
| <to table="city" column="id" /> |
| </edge> |
| </edges> |
| </path> |
| <path> |
| <edges> |
| <edge> |
| <from table="sales" column="customer_id" /> |
| <to table="customer" column="id" /> |
| </edge> |
| <edge> |
| <from table="customer" column="city_id" /> |
| <to table="city" column="id" /> |
| </edge> |
| </edges> |
| </path> |
| </paths> |
| </join_chain> |
| <join_chain name="delivery_city"> |
| <paths> |
| <path> |
| <edges> |
| <edge> |
| <from table="sales" column="delivery_city_id" /> |
| <to table="city" column="id" /> |
| </edge> |
| </edges> |
| </path> |
| </paths> |
| </join_chain> |
| <join_chain name="production_city"> |
| <paths> |
| <path> |
| <edges> |
| <edge> |
| <from table="sales" column="production_city_id" /> |
| <to table="city" column="id" /> |
| </edge> |
| </edges> |
| </path> |
| </paths> |
| </join_chain> |
| </join_chains> |
| </x_base_cube> |