PDA

View Full Version : Explaining the structure of Mondrian schemas



jhyde
05-20-2009, 12:10 AM
There are some major schema changes coming in Mondrian 4.0 (http://wiki.pentaho.com/display/analysis/Physical+Schema+Design+Discussion), and I'm writing up specifications for these so that everyone knows what's coming and has chance to influence it.

But before I do that, I thought I'd try to improve how we describe the structure of XML schemas in the present release, just a bit. I have tried a couple of things. First, I created an XML skeleton that shows which elements can occur inside which other elements:


<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Schema"Schema/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Cube"Cube/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Table"Table/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggName"AggName/a>
aggElements
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggPattern"AggPattern/a>
aggElements
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Dimension"Dimension/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Hierarchy"Hierarchy/a>
relation
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Closure"Closure/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Level"Level/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_KeyExpression"KeyExpression/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_NameExpression"NameExpression/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_CaptionExpression"CaptionExpression/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_OrdinalExpression"OrdinalExpression/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_ParentExpression"ParentExpression/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Property"Property/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_PropertyExpression"PropertyExpression/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_DimensionUsage"DimensionUsage/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Measure"Measure/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_MeasureExpression"MeasureExpression/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_MemberProperty"CalculatedMemberProperty/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_CalculatedMember"CalculatedMember/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Formula"Formula/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_MemberProperty"CalculatedMemberProperty/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_NamedSet"NamedSet/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Formula"Formula/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_VirtualCube"VirtualCube/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_CubeUsages"CubeUsages/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_CubeUsage"CubeUsage/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_VirtualCubeDimension"VirtualCubeDimension/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_VirtualCubeMeasure"VirtualCubeMeasure/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Role"Role/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SchemaGrant"SchemaGrant/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_CubeGrant"CubeGrant/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_HierarchyGrant"HierarchyGrant/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_MemberGrant"MemberGrant/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Union"Union/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_RoleUsage"RoleUsage/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_UserDefinedFunction"UserDefinedFunction/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Parameter"Parameter/a/>

relation ::=
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Table"Table/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_View"View/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_SQL"SQL/a/>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_InlineTable"InlineTable/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_ColumnDefs"ColumnDefs/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_ColumnDef"ColumnDef/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Rows"Rows/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Row"Row/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Value"Value/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_Join"Join/a>
relation

aggElement ::=
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggExclude"AggExclude/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggFactCount"AggFactCount/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggIgnoreColumn"AggIgnoreColumn/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggForeignKey"AggForeignKey/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggMeasure"AggMeasure/a>
<a href="http://mondrian.pentaho.org/documentation/schema.php#XML_AggLevel"AggLevel/a>


You can see the full version in the Mondrian schema guide (http://mondrian.pentaho.org/documentation/schema.php#Schema_files).

This approach shows where things are located, but it doesn't show how many of each element can belong to a particular parent element, or the order in which they are required. So, I wrote up a small BNF grammar (http://p4webhost.eigenbase.org:8080/open/mondrian/doc/schema.bnf) and used Clapham (http://clapham.hydromatic.net) to generate a railroad diagram (http://clapham.hydromatic.net/mondrian-3.1-bnf/). For comparison, the railroad diagram for the work-in-progress mondrian-4.0 schema is here (http://clapham.hydromatic.net/mondrian-4.0-bnf/).http://forums.pentaho.org//blogger.googleusercontent.com/tracker/5672165237896126100-6648165930275572690?l=julianhyde.blogspot.com


More... (http://julianhyde.blogspot.com/2009/05/explaining-structure-of-mondrian.html)