<!--
     This dtd file was automatically generated from XOM model mondrian.
     Do not edit this file by hand.
  -->

<!--
     This is the XML model for Mondrian schemas.
     Revision is $Id: mondrian.dtd,v 1.1 2005/12/13 12:03:52 avix Exp $
  -->
<!--
     A CubeDimension is either a usage of a Dimension ('shared
     dimension', in MSOLAP parlance), or a 'private dimension'.
  -->
<!ENTITY % CubeDimension "VirtualCubeDimension|DimensionUsage|Dimension">

<!--
     A table or a join
  -->
<!ENTITY % Relation "View|Join|Table">

<!--
     A definition of an aggregate table for a base fact table.
     This aggregate table must be in the same schema as the
     base fact table.
  -->
<!ENTITY % AggTable "AggName|AggPattern">

<!ENTITY % AggColumnName "AggFactCount|AggIgnoreColumn">

<!ENTITY % Expression "Column|KeyExpression|ParentExpression|OrdinalExpression|NameExpression|CaptionExpression">

<!--
     A collection of SQL expressions, one per dialect.
  -->
<!ENTITY % ExpressionView "KeyExpression|ParentExpression|OrdinalExpression|NameExpression|CaptionExpression">

<!ENTITY % Grant "SchemaGrant|CubeGrant|DimensionGrant|HierarchyGrant">

<!--
     A schema is a collection of cubes and virtual cubes.
     It can also contain shared dimensions (for use by those
     cubes), named sets, roles, and declarations of
     user-defined functions.
  -->
<!ELEMENT Schema ((Dimension)*,(Cube)*,(VirtualCube)*,(NamedSet)*,(Role)*,(UserDefinedFunction)*)>
<!ATTLIST Schema
name CDATA #REQUIRED
measuresCaption CDATA #IMPLIED
defaultRole CDATA #IMPLIED
>

<!--
     Definition of a cube.
  -->
<!ELEMENT Cube ((%Relation;),((%CubeDimension;))*,(Measure)*,(CalculatedMember)*,(NamedSet)*)>
<!ATTLIST Cube
name CDATA #REQUIRED
caption CDATA #IMPLIED
cache (true|false) "true"
enabled (true|false) "true"
>

<!--
     A VirtualCube is a set of dimensions and
     measures gleaned from other cubes.
  -->
<!ELEMENT VirtualCube ((VirtualCubeDimension)*,(VirtualCubeMeasure)*,(CalculatedMember)*)>
<!ATTLIST VirtualCube
enabled (true|false) "true"
name CDATA #IMPLIED
caption CDATA #IMPLIED
>

<!--
     A VirtualCubeDimension is a usage of a Dimension in a VirtualCube.
  -->
<!ELEMENT VirtualCubeDimension EMPTY>
<!ATTLIST VirtualCubeDimension
cubeName CDATA #IMPLIED
caption CDATA #IMPLIED
foreignKey CDATA #IMPLIED
name CDATA #IMPLIED
>

<!--
     A VirtualCubeMeasure is a usage of a Measure in a VirtualCube.
  -->
<!ELEMENT VirtualCubeMeasure EMPTY>
<!ATTLIST VirtualCubeMeasure
cubeName CDATA #IMPLIED
name CDATA #IMPLIED
>

<!--
     A DimensionUsage is usage of a shared
     Dimension within the context of a cube.
  -->
<!ELEMENT DimensionUsage EMPTY>
<!ATTLIST DimensionUsage
source CDATA #REQUIRED
level CDATA #IMPLIED
usagePrefix CDATA #IMPLIED
name CDATA #REQUIRED
caption CDATA #IMPLIED
foreignKey CDATA #IMPLIED
>

<!--
     A Dimension is a collection of hierarchies. There are
     two kinds: a public dimension belongs to a
     Schema, and be used by several cubes; a
     private dimension belongs to a
     Cube. The foreignKey field is only
     applicable to private dimensions.
  -->
<!ELEMENT Dimension ((Hierarchy)*)>
<!ATTLIST Dimension
type (StandardDimension|TimeDimension) #IMPLIED
usagePrefix CDATA #IMPLIED
foreignKey CDATA #IMPLIED
name CDATA #REQUIRED
caption CDATA #IMPLIED
>

<!--
     Defines a hierarchy.
     You must specify at most one <Relation>
     or memberReaderClass. If you specify none, the
     hierarchy is assumed to come from the same fact table of the
     current cube.
  -->
<!ELEMENT Hierarchy ((%Relation;)?,(Level)*,(Parameter)*)>
<!ATTLIST Hierarchy
name CDATA #IMPLIED
hasAll (true|false) #REQUIRED
allMemberName CDATA #IMPLIED
allMemberCaption CDATA #IMPLIED
allLevelName CDATA #IMPLIED
primaryKey CDATA #IMPLIED
primaryKeyTable CDATA #IMPLIED
defaultMember CDATA #IMPLIED
memberReaderClass CDATA #IMPLIED
caption CDATA #IMPLIED
>

<!ELEMENT Level (KeyExpression?,NameExpression?,OrdinalExpression?,ParentExpression?,Closure?,(Property)*)>
<!ATTLIST Level
name CDATA #IMPLIED
table CDATA #IMPLIED
column CDATA #IMPLIED
nameColumn CDATA #IMPLIED
ordinalColumn CDATA #IMPLIED
parentColumn CDATA #IMPLIED
nullParentValue CDATA #IMPLIED
type (String|Numeric) "String"
uniqueMembers (true|false) "false"
levelType (Regular|TimeYears|TimeQuarters|TimeMonths|TimeWeeks|TimeDays) "Regular"
hideMemberIf (Never|IfBlankName|IfParentsName) "Never"
formatter CDATA #IMPLIED
caption CDATA #IMPLIED
captionColumn CDATA #IMPLIED
>

<!--
     Specifies the transitive closure of a parent-child hierarchy.
     Optional, but recommended for better performance.
     The closure is provided as a set of (parent/child) pairs:
     since it is the transitive closure these are actually (ancestor/descendant) pairs.
  -->
<!ELEMENT Closure (Table)>
<!ATTLIST Closure
parentColumn CDATA #REQUIRED
childColumn CDATA #REQUIRED
>

<!--
     Member property.
  -->
<!ELEMENT Property EMPTY>
<!ATTLIST Property
name CDATA #IMPLIED
column CDATA #IMPLIED
type (String|Numeric|Boolean) "String"
formatter CDATA #IMPLIED
caption CDATA #IMPLIED
>

<!ELEMENT Measure ((CalculatedMemberProperty)*)>
<!ATTLIST Measure
name CDATA #REQUIRED
column CDATA #REQUIRED
datatype (Numeric|Integer|String) #IMPLIED
formatString CDATA #IMPLIED
aggregator (sum|count|min|max|avg|distinct count) #REQUIRED
formatter CDATA #IMPLIED
caption CDATA #IMPLIED
visible (true|false) #IMPLIED
>

<!ELEMENT CalculatedMember (Formula?,(CalculatedMemberProperty)*)>
<!ATTLIST CalculatedMember
name CDATA #REQUIRED
formatString CDATA #IMPLIED
caption CDATA #IMPLIED
formula CDATA #IMPLIED
dimension CDATA #REQUIRED
visible (true|false) #IMPLIED
>

<!--
     Property of a calculated member defined against a cube.
     It must have either an expression or a value.
  -->
<!ELEMENT CalculatedMemberProperty EMPTY>
<!ATTLIST CalculatedMemberProperty
name CDATA #REQUIRED
caption CDATA #IMPLIED
expression CDATA #IMPLIED
value CDATA #IMPLIED
>

<!--
     <p>Defines a named set which can be used in queries in the
     same way as a set defined using a WITH SET clause.</p>
     <p>A named set can be defined against a particular cube,
     or can be global to a schema. If it is defined against a
     cube, it is only available to queries which use that cube.</p>
     <p>A named set defined against a cube is not inherited by
     a virtual cubes defined against that cube. (But you can
     define a named set against a virtual cube.)</p>
     <p>A named set defined against a schema is available in
     all cubes and virtual cubes in that schema. However, it is
     only valid if the cube contains dimensions with the names
     required to make the formula valid.</p>
  -->
<!ELEMENT NamedSet (Formula?)>
<!ATTLIST NamedSet
name CDATA #REQUIRED
formula CDATA #IMPLIED
>

<!ELEMENT Formula (#PCDATA)>

<!ELEMENT Parameter EMPTY>
<!ATTLIST Parameter
name CDATA #IMPLIED
value CDATA #IMPLIED
>

<!--
     A collection of SQL statements, one per dialect.
  -->
<!ELEMENT View ((SQL)+)>
<!ATTLIST View
alias CDATA #REQUIRED
>

<!ELEMENT SQL (#PCDATA)>
<!ATTLIST SQL
dialect (generic|access|db2|derby|firebird|hsqldb|mssql|mysql|oracle|postgres|sybase) "generic"
>

<!ELEMENT Join ((%Relation;),(%Relation;))>
<!ATTLIST Join
leftAlias CDATA #IMPLIED
leftKey CDATA #REQUIRED
rightAlias CDATA #IMPLIED
rightKey CDATA #REQUIRED
>

<!ELEMENT Table (SQL?,(AggExclude)*,((%AggTable;))*)>
<!ATTLIST Table
name CDATA #REQUIRED
schema CDATA #IMPLIED
alias CDATA #IMPLIED
>

<!ELEMENT AggName (AggFactCount,(AggIgnoreColumn)*,(AggForeignKey)*,(AggMeasure)*,(AggLevel)*)>
<!ATTLIST AggName
name CDATA #REQUIRED
ignorecase (true|false) "true"
>

<!ELEMENT AggPattern (AggFactCount,(AggIgnoreColumn)*,(AggForeignKey)*,(AggMeasure)*,(AggLevel)*,(AggExclude)*)>
<!ATTLIST AggPattern
pattern CDATA #REQUIRED
ignorecase (true|false) "true"
>

<!ELEMENT AggExclude EMPTY>
<!ATTLIST AggExclude
pattern CDATA #IMPLIED
name CDATA #IMPLIED
ignorecase (true|false) "true"
>

<!ELEMENT AggFactCount EMPTY>
<!ATTLIST AggFactCount
column CDATA #REQUIRED
>

<!ELEMENT AggIgnoreColumn EMPTY>
<!ATTLIST AggIgnoreColumn
column CDATA #REQUIRED
>

<!--
     The name of the column mapping from base fact table foreign key
     to aggregate table foreign key.
  -->
<!ELEMENT AggForeignKey EMPTY>
<!ATTLIST AggForeignKey
factColumn CDATA #REQUIRED
aggColumn CDATA #REQUIRED
>

<!ELEMENT AggLevel EMPTY>
<!ATTLIST AggLevel
column CDATA #REQUIRED
name CDATA #REQUIRED
>

<!ELEMENT AggMeasure EMPTY>
<!ATTLIST AggMeasure
column CDATA #REQUIRED
name CDATA #REQUIRED
>

<!ELEMENT Column EMPTY>
<!ATTLIST Column
table CDATA #IMPLIED
name CDATA #REQUIRED
>

<!ELEMENT KeyExpression ((SQL)+)>

<!ELEMENT ParentExpression ((SQL)+)>

<!ELEMENT OrdinalExpression ((SQL)+)>

<!ELEMENT NameExpression ((SQL)+)>

<!ELEMENT CaptionExpression ((SQL)+)>

<!--
     A role defines an access-control profile. It has a series of grants
     (or denials) for schema elements.
  -->
<!ELEMENT Role ((SchemaGrant)*)>
<!ATTLIST Role
name CDATA #REQUIRED
>

<!--
     Grants (or denies) this role access to this schema.
     access may be "all", "all_dimensions", or "none".
     If access is "all_dimensions", the role has access
     to all dimensions but still needs explicit access to cubes.
     See mondrian.olap.Role#grant(mondrian.olap.Schema,int).
  -->
<!ELEMENT SchemaGrant ((CubeGrant)*)>
<!ATTLIST SchemaGrant
access (all|custom|none|all_dimensions) #REQUIRED
>

<!--
     Grants (or denies) this role access to a cube.
     access may be "all" or "none".
     See mondrian.olap.Role#grant(mondrian.olap.Cube,int).
  -->
<!ELEMENT CubeGrant ((DimensionGrant)*,(HierarchyGrant)*)>
<!ATTLIST CubeGrant
cube CDATA #REQUIRED
access (all|custom|none|all_dimensions) #REQUIRED
>

<!--
     Grants (or denies) this role access to a dimension.
     access may be "all" or "none".
     Note that a role is implicitly given access to a dimension when it
     is given acess to a cube.
     See also the "all_dimensions" option of the "SchemaGrant" element.
     See mondrian.olap.Role#grant(mondrian.olap.Dimension,int).
  -->
<!ELEMENT DimensionGrant EMPTY>
<!ATTLIST DimensionGrant
dimension CDATA #REQUIRED
access (all|custom|none|all_dimensions) #REQUIRED
>

<!--
     Grants (or denies) this role access to a hierarchy.
     access may be "all", "custom" or "none".
     If access is "custom", you may also specify the
     attributes topLevel, bottomLevel, and
     the member grants.
     See mondrian.olap.Role#grant(mondrian.olap.Hierarchy, int, mondrian.olap.Level).
  -->
<!ELEMENT HierarchyGrant ((MemberGrant)*)>
<!ATTLIST HierarchyGrant
hierarchy CDATA #REQUIRED
topLevel CDATA #IMPLIED
bottomLevel CDATA #IMPLIED
access (all|custom|none|all_dimensions) #REQUIRED
>

<!--
     Grants (or denies) this role access to a member.
     The children of this member inherit that access.
     You can implicitly see a member if you can see any of its children.
     See mondrian.olap.Role#grant(mondrian.olap.Member,int).
  -->
<!ELEMENT MemberGrant EMPTY>
<!ATTLIST MemberGrant
member CDATA #REQUIRED
access (all|none) #REQUIRED
>

<!--
     A UserDefinedFunction is a function which
     extends the MDX language. It must be implemented by a Java
     class which implements the interface
     mondrian.spi.UserDefinedFunction.
  -->
<!ELEMENT UserDefinedFunction EMPTY>
<!ATTLIST UserDefinedFunction
name CDATA #REQUIRED
className CDATA #REQUIRED
>

