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