mondrian中的多层次结构说没有找到层次结构
问题描述:
我在mondrian模式中有以下维度。蒙德里安创建连接说mondrian中的多层次结构说没有找到层次结构
mondrian.olap.MondrianException:蒙德里安错误:内部错误:层次“[产品]”未找到
<Dimension name="Product" foreignKey="item_id">
<Hierarchy hasAll="true" primaryKey="item_code" primaryKeyTable="m_item_master">
<Join leftKey="item_code" rightKey="item_code">
<Table name="m_item_master"/> <!--dummy_master--> <!--m_item_master-->
<Table name="m_item_relation"/>
</Join>
<Level name="Department" table="m_item_relation" column="department"/>
<Level name="Class" table="m_item_relation" column="category"/>
<Level name="Item" table="m_item_master" column="item_code" ordinalColumn="item_code" nameColumn="name" uniqueMembers="true" type="Numeric"/>
</Hierarchy>
<Hierarchy name="Base Item" hasAll="false" primaryKey="item_code" primaryKeyTable="m_item_master">
<Join leftKey="item_code" rightKey="item_code">
<Table name="m_item_master"/> <!--dummy_master--> <!--m_item_master-->
<Table name="m_item_relation"/>
</Join>
<Level name="Department" table="m_item_relation" column="department" captionColumn="department"/>
<Level name="Item" table="m_item_master" column="item_code" ordinalColumn="item_code" nameColumn="name" uniqueMembers="true" captionColumn="name" type="Numeric"/>
<Property name="Price" table="m_item_master" column="price" />
</Hierarchy>
</Dimension>
我使用蒙德里安-4.0.0-快照版本,并试图与最新的mondrian 4.2.0.0-204版本一样。
注意: 此外,我在mondrian连接创建本身时出现此错误。所以它不涉及任何传递给它的MDX查询。
答
好的。这是我发现的错误。澄清,蒙德里安确实支持多层次,但对于上述模式,我们似乎有与关联的角色不同的问题。
<Role name="myrole">
<SchemaGrant access="none">
<CubeGrant cube="Transaction" access="all">
<HierarchyGrant hierarchy="[Product]" access="custom" rollupPolicy="partial">
<MemberGrant member="[Product].[Cottage Foods]" access="all"/>
<MemberGrant member="[Product].[Vegetables]" access="all"/>
....
</HierarchyGrant>
....
</CubeGrant>
</SchemaGrant>
</Role>
在上面的作用,虽然默认层次结构发生在蒙德里安维的名字,我们为[Dimension.Hierarchy]中的角色,但不只是层次的名字,如果你有内部的多个层次指定它们尺寸。在我们的情况下,它应该如下。
<Role name="myrole">
<SchemaGrant access="none">
<CubeGrant cube="Transaction" access="all">
<HierarchyGrant hierarchy="[Product.Product]" access="custom" rollupPolicy="partial">
<MemberGrant member="[Product.Product].[Cottage Foods]" access="all"/>
<MemberGrant member="[Product.Product].[Vegetables]" access="all"/>
....
</HierarchyGrant>
....
</CubeGrant>
</SchemaGrant>
</Role>
这就解决了上述问题。