Database Reference
In-Depth Information
Role-playing dimensions are defined in Mondrian using the concept of shared
dimensions as we show below, where the shared dimension is
Time
:
<
Cube name=
'
Sales
'
>
1
<
Dimensions
>
2
<
Dimension name=
'
Order Date
'
source=
'
Time
'
/
>
3
<
Dimension name=
'
Due Date
'
source=
'
Time
'
/
>
4
<
Dimension name=
'
Shipped Date
'
source=
'
Time
'
/
>
5
<
Dimension name=
'
Employee
'
table=
'
Employee
'
key=
'
Employee Key
'
>
6
...
7
<
/Dimension
>
8
<
/Dimensions
>
9
...
10
<
/Cube
>
11
As we have seen, snowflake dimensions involve more than one table.
For example, the
Product
dimension involves tables
Product
and
Category
.
When defining dimensions based on
snowflake schemas
in Mondrian, it is
necessary to define in which table we can find the dimension attributes, as
shown next:
<
Dimension name=
'
Product
'
table=
'
Product
'
key=
'
Product Key
'
>
1
<
Attributes
>
2
<
Attribute name=
'
Category Name
'
keyColumn=
'
CategoryName
'
3
table=
'
Category
'
/
>
4
5
...
6
<
Attribute name=
'
Product Name
'
keyColumn=
'
ProductName
'
/
>
7
...
8
<
/Attributes
>
9
<
Hierarchies
>
10
<
Hierarchy name=
'
Categories
'
hasAll=
'
true
'
>
11
<
Level name=
'
Category
'
attribute=
'
Category Name
'
/
>
12
<
Level name=
'
Product
'
attribute=
'
Product Name
'
/
>
13
<
/Hierarchy
>
14
<
/Hierarchies
>
15
<
/Dimension
>
As can be seen above, the definition of attribute
Category Name
states that it
comes from table
Category
(lines 3-4). On the other hand, when defining the
attribute
Product Name
the table is not specified, by default it will be found
in the table defined in the
Dimension
element, that is, the
Product
table.
We show next how a
parent-child
(or
recursive
)
hierarchy
can
be defined in Mondrian using the
Supervision
hierarchy in the
Employee
dimension:
<
Dimension name=
'
Employee
'
table=
'
Employee
'
key=
'
Employee Key
'
>
1
<
Attributes
>
2
<
Attribute name=
'
Employee Key
'
keyColumn=
'
EmployeeKey
'
/
>
3
...
4
<
Attribute name=
'
Supervisor Key
'
keyColumn=
'
SupervisorKey
'
/
>
5
<
/Attributes
>
6
Search WWH ::
Custom Search