Skip to main content
Pentaho Documentation

Learn About Schema Structures

A schema defines a multi-dimensional database, containing a logical model and a physical model. The logical model contains the constructs used to write queries in MDX language: cubes, measures, dimensions, attributes, hierarchies, levels, and members. The physical model is a set of MongoDB collections that are the source of the data which is presented through the logical model. Each MongoDB collection should contain the data for an entire Cube, including all of the Facts and all of the Dimensions.

Analyzer for MongoDB schemas are represented in an XML file. An example schema, containing almost all of the constructs discussed here, is supplied as FoodMart.mongo.xml.

The Mondrian Documentation has a complete reference for these properties. Please note that the Mondrian properties file for Analyzer on MongoDB is located in ...\pentaho-solutions\system\osgi\bundles and is called mondrian.cfg. This is different than the primary mondrian.properties file in ...\pentaho-solutions\system\mondrian. This essentially means that if you are configuring Mondrian settings for both MongoDB connections as well as non-MongoDB connections, you should make sure to configure both properties files.

Schema Structure in XML

The <Schema> element is the root element of every schema. For example:


<Schema name="Rock Sales" metamodelVersion="4.0">

A schema has a name attribute and, optionally, a description. Currently, the only way to create a schema is to create it in an XML file in a text editor. The XML syntax is not too complicated, so this is not as difficult as it sounds, particularly if you use the FoodMart schema as a guiding example.

The order of these XML elements is not importantFile:/kitteh_period.jpg For example, as long as it occurs as a child of a <Schema> element, a <UserDefinedFunction> element might occur after one <Cube> element and after another.

This table lists the content and the structures of a schema in XML.

 

Table 1. XML Schema Reference
XML Schema Element Description
Schema
<Schema> The top-level collection of elements relating to a particular enterprise. Cubes belong to a Schema, as do Named Sets, Roles, User-defined functions, and Parameters.

Dimensions and Named Sets may also be defined privately within a particular Cube.

Physical Elements
<PhysicalSchema> Collection of table usages, linked via relationships, upon which the logical schema is constructed.
<Table> Defines a use of a table.
<ColumnDefs> Holder for <ColumnDef> elements.
<ColumnDef> Definition of a column in an <InlineTable> dataset.
Logical Elements
<Cube> A cube is a collection of dimensions and measures.
<Dimensions> Collection of <Dimension> elements.
<Dimension> A collection of <Attribute> s that may be used to subdivide a multidimensional data set, some of them organized into <Hierarchy> structures.
<Key> Column or columns that are the key of an <Attribute> , in lieu of Attribute.keyColumn.
<Attributes> A collection of <Attribute> elements.
<Attribute> Data item in a <Dimension>.
<Key> Column or columns that are the key of an <Attribute>, in lieu of Attribute.keyColumn.
<Column> Defines a column in the table.
<Name/> (as Key) Column that holds the name of an <Attribute>, in lieu of Attribute.nameColumn.
<Caption/> (as Key) Column that holds the caption of an <Attribute>, in lieu of Attribute.captionColumn.
<OrderBy/> (as Key) Column or columns that used to sort members of an <Attribute>, in lieu of Attribute.captionColumn.
<Property> Member property. The definition is against a hierarchy or level, but the property will be available to all members.
<Hierarchies> Collection of <Hierarchy> elements.
<Hierarchy> Collection of <Attributes> organized into <Levels>.
<Levels> Collection of <Level> elements.
<Level/> <Level> of a <Hierarchy>.
<MeasureGroups> Collection of <MeasureGroup> elements.
<MeasureGroup> Collection of <Measure>s that are stored in the same fact table.
<Measures> Collection of <Measure> elements.
<DimensionLinks> Collection of links between a <MeasureGroup> and the <Dimensions>s of the <Cube>.
<FactLink/> Declares that a Dimension is trivially linked to a MeasureGroup because its dimension table is the same as the fact table.
<CopyLink/> Indicates dimension that is represented by key columns in the MeasureGroup's table.
<NoLink/> Documents that a <Dimension> is not linked to the current <MeasureGroup>.
<CalculatedMembers> Collection of <CalculatedMember> elements.
<CalculatedMember> A member whose value is derived using a formula, defined as part of a cube.
<NamedSets> Collection of <NamedSet> elements.
<NamedSet> A set whose value is derived using a formula, defined as part of a cube.
Access control
<Role> An access-control profile.
<SchemaGrant> A set of rights to a schema.
<CubeGrant> A set of rights to a cube.
<MemberGrant/> A set of rights to a <Member> and its children.
<Union> Definition of a set of rights as the union of a set of <Role>s.
<RoleUsage/> A reference to a < Role > .
Extensions
<UserDefinedFunction> Declares a user-defined function.
<Script> Script fragment to implement an SPI such as user-defined function, member formatter, or cell formatter.
<Script/> Script fragment to implement an SPI such as user-defined function, member formatter, or cell formatter.
<MemberFormatter> Member formatter.
<PropertyFormatter> Property formatter.
<CellFormatter> Cell formatter.
Miscellaneous
<Parameter/> Part of the definition of a Hierarchy; passed to a MemberReader, if present.
<CalculatedMemberProperty/> Property of a calculated member.