001 /*
002 // $Id: Selection.java 277 2009-08-18 18:50:30Z lucboudreau $
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) 2007-2008 Julian Hyde
007 // All Rights Reserved.
008 // You must accept the terms of that agreement to use this software.
009 */
010 package org.olap4j.query;
011
012 import org.olap4j.metadata.Dimension;
013 import org.olap4j.metadata.Member;
014
015 /**
016 * A selection of members from an OLAP dimension hierarchy. The selection
017 * is a conceptual list of members from a given hierarchy. Once a selection
018 * object is created, one can decide to include or exclude this selection
019 * of members from the resulting query.
020 *
021 * <p>Concrete subclasses of this represent a real selection.
022 * Selections include things such as 'children of', 'siblings of',
023 * 'descendents of' etc.
024 *
025 * <p>This class is different from a {@link org.olap4j.metadata.Member} because it represents an
026 * abstract member selection (e.g. children of widget' that may not represent
027 * any members whereas a Member represents a single member that is known to
028 * exist.
029 *
030 * @author jdixon, jhyde, Luc Boudreau
031 * @version $Id: Selection.java 277 2009-08-18 18:50:30Z lucboudreau $
032 * @since May 30, 2007
033 */
034 public interface Selection extends QueryNode {
035
036 String getName();
037
038 void setName(String name);
039
040 Member getMember();
041
042 Dimension getDimension();
043
044 String getHierarchyName();
045
046 String getLevelName();
047
048 Operator getOperator();
049
050 // @pre operator != null
051 void setOperator(Operator operator);
052
053 /**
054 * Defines which selection operators are allowed, relative to
055 * a root member.
056 */
057 public enum Operator {
058 /**
059 * Only the root member will be selected.
060 */
061 MEMBER,
062 /**
063 * Only the children of the root member will be selected.
064 * This excludes the root member itself.
065 * <p>Implemented via the MDX .Children member property.
066 */
067 CHILDREN,
068 /**
069 * The root member will be selected along with all it's
070 * children.
071 */
072 INCLUDE_CHILDREN,
073 /**
074 * Will select the root member along with all it's siblings.
075 * <p>Implemented via the MDX .Siblings member property.
076 */
077 SIBLINGS,
078 /**
079 * Selects the set of the ascendants of a specified member,
080 * including the member itself.
081 * <p>Implemented via the MDX Ascendants() function.
082 */
083 ANCESTORS,
084 /**
085 * Selects the set of the descendants of a specified member,
086 * including the member itself.
087 * <p>Implemented via the MDX Descendants() function.
088 */
089 DESCENDANTS;
090 }
091 }
092
093 // End Selection.java