001    /*
002    // $Id: //open/mondrian-release/3.1/src/main/mondrian/olap/Cube.java#3 $
003    // This software is subject to the terms of the Eclipse Public License v1.0
004    // Agreement, available at the following URL:
005    // http://www.eclipse.org/legal/epl-v10.html.
006    // Copyright (C) 1999-2002 Kana Software, Inc.
007    // Copyright (C) 2001-2009 Julian Hyde and others
008    // All Rights Reserved.
009    // You must accept the terms of that agreement to use this software.
010    //
011    // jhyde, 2 March, 1999
012    */
013    
014    package mondrian.olap;
015    
016    import java.util.*;
017    
018    /**
019     * Cube.
020     *
021     * @version $Id: //open/mondrian-release/3.1/src/main/mondrian/olap/Cube.java#3 $
022     * @author jhyde
023     */
024    public interface Cube extends OlapElement, Annotated {
025    
026        String getName();
027    
028        Schema getSchema();
029    
030        /**
031         * Returns the dimensions of this cube.
032         */
033        Dimension[] getDimensions();
034    
035        /**
036         * Returns the named sets of this cube.
037         */
038        NamedSet[] getNamedSets();
039    
040        /**
041         * Finds a hierarchy whose name (or unique name, if <code>unique</code> is
042         * true) equals <code>s</code>.
043         */
044        Hierarchy lookupHierarchy(Id.Segment s, boolean unique);
045    
046        /**
047         * Returns Member[]. It builds Member[] by analyzing cellset, which
048         * gets created by running mdx sQuery.  <code>query</code> has to be in the
049         * format of something like "[with calculated members] select *members* on
050         * columns from <code>this</code>".
051         */
052        Member[] getMembersForQuery(String query, List<Member> calcMembers);
053    
054        /**
055         * Returns the time dimension for this cube, or <code>null</code>
056         * if there is no time dimension.
057         */
058        Dimension getTimeDimension();
059    
060        /**
061         * Helper method that returns the Year Level or returns null if the Time
062         * Dimension does not exist or if Year is not defined in the Time Dimension.
063         *
064         * @return Level or null.
065         */
066        Level getYearLevel();
067    
068        /**
069         * Return Quarter Level or null.
070         *
071         * @return Quarter Level or null.
072         */
073        Level getQuarterLevel();
074    
075        /**
076         * Return Month Level or null.
077         *
078         * @return Month Level or null.
079         */
080        Level getMonthLevel();
081    
082        /**
083         * Return Week Level or null.
084         *
085         * @return Week Level or null.
086         */
087        Level getWeekLevel();
088    
089        /**
090         * Returns a {@link SchemaReader} for which this cube is the context for
091         * lookup up members.
092         * If <code>role</code> is null, the returned schema reader also obeys the
093         * access-control profile of role.
094         */
095        SchemaReader getSchemaReader(Role role);
096    
097        /**
098         * Creates a calculated member in this cube.
099         *
100         * <p>The XML string must be a <code>&lt;CalculatedMember/&gt;</code>
101         * element, as defined in <code>Mondrian.xml</code>.
102         *
103         * @param xml XML string
104         */
105        Member createCalculatedMember(String xml);
106    
107        /**
108         * Finds out non joining dimensions for this cube.
109         *
110         * @param tuple array of members
111         * @return Set of dimensions that do not exist (non joining) in this cube
112         */
113        Set<Dimension> nonJoiningDimensions(Member[] tuple);
114    
115        /**
116         * Finds out non joining dimensions for this cube.
117         *
118         * @param otherDims Set of dimensions to be tested for existence
119         *     in this cube
120         * @return Set of dimensions that do not exist (non joining) in this cube
121         */
122        Set<Dimension> nonJoiningDimensions(Set<Dimension> otherDims);
123    }
124    
125    // End Cube.java