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