olap4j Specification

olap4j Specification

Authors: Julian Hyde, Barry Klawans
Version: 0.9.7 (beta)
Revision: $Id: olap4j_fs.html 250 2009-06-25 21:35:50Z jhyde $ (log)
Last modified: June 25th, 2009.


Contents

  1. Introduction
    1. A brief history of OLAP standards
    2. Overview of olap4j
    3. Relationship to other standards
      1. olap4j and XML/A
      2. olap4j is built on other standards
    4. Benefits of a standard Java API for OLAP
    5. Architecture of olap4j
    6. Compatibility
    7. Compliance levels
  2. Components of the API
    1. Driver management
      1. The Driver class
      2. The DriverManager class
      3. The DataSource interface
      4. The OlapDataSource interface
      5. The OlapException class
    2. Connections
      1. Connection pooling
      2. The OlapConnection interface
      3. The OlapWrapper interface
      4. The OlapDatabaseMetaData interface
    3. Statements
      1. The OlapStatement interface
      2. The PreparedOlapStatement interface
      3. The OlapParameterMetaData interface
      4. The CellSet interface
      5. The CellSetAxis interface
      6. The Axis enum
      7. The CellSetAxisMetaData interface
      8. The Position interface
      9. The Cell interface
      10. The CellSetMetaData interface
    4. MDX parse tree model
      1. The ParseTreeWriter class
    5. MDX parser
    6. MDX type model
    7. Metadata
      1. Access control
      2. Metadata objects
        1. The MetadataElement interface
        2. The Catalog interface
        3. The Schema interface
        4. The Cube interface
        5. The Dimension interface
        6. The Hierarchy interface
        7. The Level interface
        8. The Member interface
        9. The Measure interface
        10. The Property interface
        11. The NamedSet interface
        12. The Datatype enum
      3. The OlapDatabaseMetaData interface, and schema result sets
        1. The getDatasources method
        2. The getDatabaseProperties method
        3. The getLiterals method
        4. The getCubes method
        5. The getDimensions method
        6. The getFunctions method
        7. The getHierarchies method
        8. The getLevels method
        9. The getMeasures method
        10. The getMembers method
        11. The getProperties method
        12. The getSets method
      4. Other methods
    8. Transform
      1. Query model details
      2. Navigation actions
        1. Slicing navigations
        2. Restructuring navigations
        3. Drilling navigations
        4. Scoping navigations
      3. Open issues
    9. Layout
  3. Other topics
    1. Internationalization
    2. Concurrency and thread-safety
    3. Canceling statements
  4. Other components
    1. Test suite
    2. XML/A provider
  5. Non-functionality
  6. Related projects
    1. Mondrian provider
    2. XML for Analysis provider
    3. Other data sources
  7. Appendix A. Opportunities for specification
  8. Appendix B. Feedback
  9. Appendix C. Open issues
  10. Appendix D. Miscellaneous
  11. Appendix E. References
  12. Appendix F. Change log

1. Introduction

olap4j is an open Java API for building OLAP applications.

In essence, olap4j is to multidimensional data what JDBC is for relational data. olap4j has a similar programming model to JDBC, shares some of its core classes, and has many of the same advantages. You can write an OLAP application in Java for one server (say Mondrian) and easily switch it to another (say Microsoft Analysis Services, accessed via XML for Analysis).

However, creating a standard OLAP API for Java is a contentious issue. To understand why, it helps to understand the history of OLAP standards.

1.1. A brief history of OLAP standards

History is strewn with attempts to create a standard OLAP API. First, the OLAP council's MDAPI (in two versions), then the JOLAP API emerged from Sun's Java Community Process. These all failed, it seems, because at some point during the committee stages, all of the OLAP server vendors concerned lost interest in releasing an implementation of the standard. The standards were large and complex, and no user-interface provider stepped forward with a UI which worked with multiple back-ends.

Meanwhile, Microsoft introduced OLE DB for OLAP (which works only between Windows clients and servers), and then XML/A (XML for Analysis, a web-services API). These standards were more successful, for a variety of reasons. First, since the standards (OLE DB for OLAP in particular) were mainly driven by one vendor, they were not a compromise attempting to encompass the functionality of several products. Second, there was a ready reference implementation, and Microsoft saw to it that there were sufficient OLAP clients to make these standards viable forums for competition and innovation. Third, there was the MDX query language. A query language is easier to explain than an API. It leaves unsolved the problem of how to construct queries to answer business questions, but application developers could solve that problem by embedding one of the off-the-shelf OLAP clients.

The Open Source community has been developing a taste for OLAP. First there was Mondrian, an open-source OLAP server; then there was JPivot, a client which first spoke to Mondrian, then also to XML/A; then there were more OLAP clients, and applications which wanted to use a particular client, but wanted to talk to a variety of servers; and companies using a particular OLAP server that wanted to get at it from several clients. It became clear the open-source OLAP tools needed a standard, and that standard would probably be suitable for other Java-based OLAP tools.

1.2. Overview of olap4j

An OLAP application interacts with an OLAP server by means of MDX statements belonging to connections. The statements are defined in terms of metadata and validated according to a type system, and some applications are built at a higher level, manipulating MDX parse trees, and defining complex queries in terms that a business user can understand. The olap4j API provides all of these facilities.

At the lowest level, olap4j has a framework for registering drivers, and managing the lifecycle of connections and statements. olap4j provides this support by extending the JDBC framework.

A key decision in the design of an OLAP API is whether to include a query language. Historically, it has been a contentious one. The previous standards fell into two camps: MDAPI and JOLAP had an API for building queries, while OLE DB for OLAP and XML/A had the MDX query language. The SQL query language is an essential component of relational database APIs such as ODBC and JDBC, and it makes similar sense to base an OLAP API on a query language such as MDX. But OLAP applications also need to build and transform queries as the end-user explores the data. So, olap4j embraces both approaches: you can create a query by parsing an MDX statement, you can build a query by manipulating an MDX parse tree, and an MDX parser library allows you to easily convert an MDX string to and from a parse tree.

Metadata is at the heart of olap4j. You can browse the cubes, dimensions, hierarchies, members in an OLAP schema, and an MDX parse tree and query result are tied back to the same metadata objects. There is also a type system for describing expressions.

olap4j makes it possible to write an OLAP client without starting from scratch. In addition to the MDX parser, and operations on the MDX parse tree, there is a higher-level query model, which includes operations to transform queries (also called 'navigations'), and facilities to layout multidimensional results as HTML tables.

1.3. Relationship to other standards

1.3.1. olap4j and XML/A

At this point, you may be saying: what about XML/A? XML/A was here first, is an open standard, and is supported by a number of servers. Is olap4j an attempt to replace XML/A? Isn't XML/A good enough for everyone?

olap4j certainly has some similarities with XML/A. Both APIs allow an application to execute OLAP queries, and to browse the metadata of an OLAP schema. But XML/A is a low-level web-services API which leaves a lot of work to the application writer. (Witness the fact that the majority of successful XML/A applications run only on Windows, where the ADOMD.NET is a high-level interface to XML/A servers.) The APIs are mostly complementary, because olap4j can be easily added to an XML/A back-end, and provides features which would be difficult or impossible to provide via a web-services API. These are functions for parsing MDX, building and transforming MDX query models, and mapping result sets into graphical layouts such as pivot tables.

If a web-services based application needs these functions, it can use the XML/A provider to connect to the underlying data source, execute queries, and browse metadata, but can still use olap4j's features for MDX parsing, query models and layout.

1.3.2. olap4j is built on other standards

Where possible, olap4j leverages existing standards. This has several advantages. First, an end-user familiar with the existing standards can come up to speed with olap4j quickly. For instance, creating a connection and executing a statement should be straightforward to anyone familiar with JDBC connections, statements and result sets work.

If an OLAP server implementor has already implemented a driver for one standard, then it should be less work to implement an olap4j driver. This clearly applies to the MDX language (borrowed from XML/A and OLE DB for OLAP). Implementation schema result sets should be straightforward if the server already supports XML/A schema rowsets.

If olap4j is sufficiently similar to an existing standard, tools designed for use with that standard may be applicable to olap4j also. For instance, one goal of olap4j is that people will be able to use connection-pooling libraries such as Jakarta Commons DBCP, C3P0. (This presents some challenges because olap4j extends some of the JDBC interfaces, but we hope to solve them.)

Lastly, reusing an existing standard is less work for the authors of the new standard!

Sometimes the standards conflict. ADOMD exposes its metadata through an object model, whereas JDBC and XML/A expose metadata relationally, via what XML/A calls rowsets and what we and JDBC call result sets. In this case, we chose to do both, because of the diversity of needs of olap4j clients. Metadata objects allow you to integrate query results with metadata using much fewer code: positions can reference members, and you can navigate from a member to its hierarchy, and so forth. Likewise, metadata objects can be used in building MDX parse trees. But if a client tool wants to maintain its own metadata cache, schema rowsets are more flexible and efficient.

1.4. Benefits of a standard Java API for OLAP

Once the olap4j standard is in place, we can expect that the familiar benefits of an open standard will emerge: a larger variety of tools, better tools, and more price/feature competition between OLAP servers. These benefits follow because if a developer of OLAP tool can reach a larger audience, there is greater incentive to build new tools.

Eventually there will be olap4j providers for most OLAP servers. The server vendors will initially have little incentive to embrace a standard which will introduce competition into their market, but eventually the wealth of tools will compel them to write a provider; or, more likely, will tempt third-party or open-source efforts to build providers for their servers.

1.5. Architecture of olap4j

The following diagram shows how olap4j fits into an enterprise architecture.

olap4j architecture

1.6. Compatibility

olap4j requires JDK 1.5 or higher, in particular because it uses the generics and enum features introduced in JDK 1.5.0.

olap4j works best against JDK 1.6 or higher, because it makes use of the java.sql.Wrapper interface. In earlier Java versions, the same functionality is available by casting objects to the built-in OlapWrapper interface.

JDK 1.4 compatibility will be available on demand, using the Retroweaver utility. This will consist of a retrowoven JAR file, olap4j-jdk1.4.jar and retroweaver's runtime library retroweaver-rt-1.2.4.jar. (See design note.)

olap4j's JDBC support is consistent with JDBC version 3.0 (which was introduced in JDK 1.4 and is also in JDK 1.5) and also with JDBC version 4.0 (introduced in JDK 1.6).

1.7. Compliance levels

There are two compliance levels to which a driver can support olap4j. olap4j is a rich specification, and it takes a considerable effort to implement it fully, but applications can still be built on a driver which only implements the core parts of the specification. The lower level allows a vendor to a subset of the specification without the significant investment of a fully-compliant driver.

The compliance levels are as follows:

  • olap4j Core Compliance. To comply with the olap4j core specification, it must implement all classes in the org.olap4j package, with the exception of the getXxxxs() methods in OlapDatabaseMetaData that return result sets, and all classes in the org.olap4j.metadata package. The OLAP server must also implement the fundamental features of the MDX language (see below).
  • olap4j Full Compliance. To fully comply with the olap4j specification, a driver must comply with the core requirements, plus implement the OlapDatabaseMetaData.getXxxxs() methods, plus implements an MDX parser and validator (org.olap4j.mdx.parser package).
MDX language compliance

All olap4j drivers must implement the fundamental features of the MDX language, but olap4j compliance levels do not imply a particular degree of support for the MDX language.

The fundamental features of MDX are:

  • Queries of the form "SELECT ... FROM ... WHERE".
  • The set constructor operator { ... }.
  • Set functions CrossJoin(<Set>, <Set>), Filter(<Set>, <Condition>), Order(<Set>, <Expression>), Hierarchize(<Set>).
  • Navigation operators <Member>.Children, <Level>.Members <Hierarchy>.Members, <Member>.Parent, Level, Hierarchy, Dimension
  • Aggregation functions Aggregate
  • Basic arithmetic and logical operators

Of course, a provider may implement a larger subset of MDX, and most do. A provider can describe its MDX compliance level by describing the additional features it supports (e.g. WITH MEMBER, WITH SET, NON EMPTY, and HAVING clauses in queries; virtual cubes; and calculated members and sets defined against cubes) and additional functions and operators implemented.

2. Components of the API

We now describe the olap4j API in more detail, by breaking it down into a set of functional areas.

olap4j components

2.1. Driver management

olap4j shares JDBC's driver management facilities. This allows olap4j clients to leverage the support for JDBC such as connection pooling, driver registration.

Classes:

2.1.1. The Driver class

Same functionality as JDBC.

Here is an example of registering an olap4j driver:

Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
2.1.2. The DriverManager class

Same functionality as JDBC.

2.1.3. The DataSource interface

Same functionality as JDBC.

2.1.4. The OlapDataSource interface

Extension to DataSource that returns OlapConnection objects rather than mere java.sql.Connection objects.

2.1.5. The OlapException class

OlapException (extends java.sql.SQLException) describes an error which occurred while accessing an OLAP server.

Since olap4j extends JDBC, it is natural that OlapException should extend JDBC's SQLException. The implementation by an olap4j
driver of a JDBC method which is declared to throw a SQLException may, if the driver chooses, throw instead an OlapException.

OlapException provides some additional information to help an OLAP client identify the location of the error. The context is the Cell or Position object where the error occurred. The region is an object representing the textual region in the MDX statement.

Methods:

  • Region getRegion()
  • setRegion(Region region)
  • Object getContext()
  • void setContext(Object context)

2.2. Connections

olap4j's connection management component manages connections to the OLAP server, statements.

Where possible, olap4j uses JDBC's session management facility. olap4j defines extensions to JDBC interfaces Connection and Statement.

For example, the following code registers a driver, connects to Mondrian and executes a statement:

import java.sql.*;
import org.olap4j.*;

Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
Connection connection =
    DriverManager.getConnection(
        "jdbc:mondrian:Jdbc=jdbc:odbc:MondrianFoodMart;"
        + "Catalog=/WEB-INF/queries/FoodMart.xml;"
        + "Role='California manager'");
OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement statement = olapConnection.createStatement();

CellSet cellSet =
    statement.executeOlapQuery(
        "SELECT {[Measures].[Unit Sales]} ON COLUMNS,/n"
        + "  {[Product].Members} ON ROWS/n"
        + "FROM [Sales]");

Here's a piece of code to connect to Microsoft SQL Server Analysis Services™ (MSAS) via XML/A. Note that except for the driver class and connect string, the code is identical.

import java.sql.*;
import org.olap4j.*;

Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
Connection connection =
    DriverManager.getConnection(
        "jdbc:xmla:Server=http://localhost/xmla/msxisapi.dll;"
        + "Catalog=FoodMart");
OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement statement = connection.createStatement();

CellSet cellSet =
    statement.executeOlapQuery(
        "SELECT {[Measures].[Unit Sales]} ON COLUMNS,/n"
        + "  {[Product].Members} ON ROWS/n"
        + "FROM [Sales]");

In the above examples, a statement was created from a string. As we shall see, a statement can also be created from an MDX parse tree.

2.2.1. Connection pooling

Look again at the code samples in the previous section. One would expect that it would be safe to downcast the result of a factory method to the desired result. For example, if you invoke an OlapConnection's createStatement() method, the result should be an OlapStatement.

But if you you are using a connection-pooling library (common examples of which include Jakarta Commons DBCP and C3P0), this is not so. Every connection-pooling library tracks connections by wrapping them in another class, and this class will implement java.sql.Connection but not OlapConnection. To access methods of the OlapConnection, the client application must first strip away the wrapper object.

If you are using a connection-pooling library, olap4j provides the OlapWrapper interface with the method method unwrap(Class) to access the object underneath the wrapped connection. For instance, if you were using DBCP, you could define and use a pooling olap4j data source as follows:

import java.sql.*;
import org.olap4j.*;
import org.apache.commons.dbcp.*;

GenericObjectPool connectionPool =
    new GenericObjectPool(null);
ConnectionFactory connectionFactory =
    new DriverManagerConnectionFactory(
        "jdbc:mondrian:Jdbc=jdbc:odbc:MondrianFoodMart;"
        + "Catalog=/WEB-INF/queries/FoodMart.xml;"
        + "Role='California manager'",
        new Properties());
PoolableConnectionFactory poolableConnectionFactory =
    new PoolableConnectionFactory(
        connectionFactory, connectionPool, null, null, false, true);
DataSource dataSource =
    new PoolingDataSource(connectionPool);

// and some time later...

Connection connection = dataSource.getConnection();
OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement statement = olapConnection.createStatement();

The OlapStatement, PreparedOlapStatement, and CellSet interfaces also extend OlapWrapper, and can be accessed similarly.

If connection pooling is not being used, then the object returned by the driver will be an OlapConnection and will therefore trivially implement OlapWrapper (because the OlapConnection interface extends OlapWrapper). If connection pooling is being used, the code will work provided that the implementer of the connection pool has ensured that the pooled connection object implements the OlapWrapper interface. This is a minor change to the connection pool, and we hope that popular connection pools will utilize this method in the near future.

If you are using JDBC 4.0 (which is part of JDK 1.6 and later), the java.sql.Connection class implements the java.sql.Wrapper interface introduced in JDBC 4.0, so the code can be simplified:

Connection connection = DriverManager.getConnection();
OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
OlapStatement statement = olapConnection.createStatement();

Note that the OlapWrapper interface is not needed. This code will work with any JDBC 4.0-compliant connection pool.

Package name: org.olap4j

2.2.2. The OlapConnection interface

OlapConnection (extends java.sql.Connection) is a connection to an OLAP data source.

Methods:

  • NamedList<Catalog> getCatalogs()
  • Schema getSchema()
  • void setLocale(Locale locale)
  • Locale getLocale()
  • void setRoleName(String roleName)
  • String getRoleName()
  • PreparedOlapStatement prepareOlapStatement(String mdx)
  • MdxParserFactory getParserFactory()
2.2.3. The OlapWrapper interface

OlapWrapper provides the ability to retrieve a delegate instance when the instance in question is in fact a proxy class.

OlapWrapper duplicates the functionality of the java.sql.Wrapper interface (introduced in JDBC 4.0), making this functionality available to olap4j clients running in a JDBC 3.0 environment. For code which will run only on JDBC 4.0 and later, Wrapper can be used, and OlapWrapper can be ignored.

Methods:

  • boolean isWrapper()
  • T unwrap(Class<T>)
2.2.4. The OlapDatabaseMetaData interface

OlapDatabaseMetaData (extends java.sql.DatabaseMetaData) provides information about an OLAP database.

Just as DatabaseMetaData provides a method to query the each kind of metadata element in a relational database (tables, columns, and so forth), returning the rows as a ResultSet, OlapDatabaseMetaData provides methods for OLAP metadata elements (cubes, dimensions, hierarchies, levels, members, measures).

These methods are described in the section "The OlapDatabaseMetaData interface and methods which return schema rowsets".

2.3. Statements

2.3.1. The OlapStatement interface

OlapStatement  (extends java.sql.Statement) is an object used to execute a static MDX statement and return the result it produces.

It has methods to execute an MDX query represented both as a string and as a parse tree.

Methods:

  • CellSet executeOlapQuery(String mdx)
  • CellSet executeOlapQuery(SelectNode selectNode)
2.3.2. The PreparedOlapStatement interface

PreparedOlapStatement (extends java.sql.PreparedStatement) represents a precompiled MDX statement.

An MDX statement is precompiled and stored in a PreparedOlapStatement object. This object can then be used to efficiently execute this statement multiple times.

The method PreparedStatement.getParameterMetaData() returns a description of the parameters, as in JDBC. The result is an OlapParameterMetaData.

To set values of parameters, use the setType(int, type) methods. If a parameter is a member, use the setObject(int, Object) method; throws an exception if the object is not a member, or is a member of the wrong hierarchy.

Unlike JDBC, it is not necessary to assign a value to every parameter. This is because OLAP parameters have a default value. Parameters have their default value until they are set, and then retain their new values for each subsequent execution of this PreparedOlapStatement.

The getCube() method returns the cube (or virtual cube) the prepared statement relates to.

Methods:

  • CellSet executeQuery()
  • Cube getCube()
  • CellSetMetaData getMetaData()
  • OlapParameterMetaData getParameterMetaData()
2.3.3. The OlapParameterMetaData interface

OlapParameterMetaData (extends java.sql.ParameterMetaData) describes parameters of a PreparedOlapStatement.

Additional methods:

  • getName()
  • getOlapType(int param)
2.3.4. The CellSet interface

CellSet (extends java.sql.ResultSet) is the result of executing an OlapStatement or PreparedOlapStatement.

It extends ResultSet, but since most of these methods are concerned with rows and columns, only a few of the base class's methods are applicable. The following methods are applicable:

Additional methods to retrieve the axes of the multidimensional result:

  • List<CellSetAxis> getAxes()
  • CellSetAxis getFilterAxis()
  • Cell getCell(List<Integer> coordinates)

An OlapStatement can have no more than one CellSet open. Closing an OlapStatement, or preparing or executing a new query, implicitly closes any previous CellSet.

2.3.5. The CellSetAxis interface

A CellSetAxis is an axis belonging to a CellSet.

A cell set has the same number of axes as the MDX statement which was executed to produce it. For example, a typical cell set, resulting from an MDX query with COLUMNS and ROWS expressions is two-dimensional, and therefore has two axes.

Each axis is an ordered collection of members or tuples. Each member or tuple on an axis is called a Position.

The positions on the cell set axis can be accessed sequentially or random-access. Use the List<Position> getPositions() method to return a list for random access, or the Iterator<Position> iterate() method to obtain an iterator for sequential access.

Methods:

  • Axis getOrdinal()
  • CellSet getCellSet()
  • CellSetAxisMetaData getAxisMetaData()
  • List<Position> getPositions()
  • int getPositionCount()
  • ListIterator<Position> iterate()
2.3.6. The Axis enum

Axis is an enumeration of axis types.

2.3.7. The CellSetAxisMetaData interface

A CellSetAxisMetaData is describes a CellSetAxis.

Methods:

  • Axis getAxis()
  • List<Hierarchy> getHierarchies()
  • List<Property> getProperties()
2.3.8. The Position interface

Position is a position on a CellSetAxis.

An axis has a particular dimensionality, that is, a set of one or more dimensions which will appear on that axis, and every position on that axis will have a member of each of those dimensions. For example, in the MDX query

SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON COLUMNS,
    CrossJoin(
        {[Gender].Members},
        {[Product].[Food], [Product].[Drink]}) ON ROWS
FROM [Sales]

the COLUMNS axis has dimensionality {[Measures]} and the ROWS axis has dimensionality {[Gender], [Product]}. In the result of this query,

GenderProductUnit SalesStore Sales
All GenderFood191,940409,035.59
All GenderDrink24,59748,836.21
FFood94,814203,094.17
FDrink12,20224,457.37
MFood97,126205,941.42
MDrink12,39524,378.84

each of the 5 positions on the ROWS axis has two members, consistent with its dimensionality of 2. The COLUMNS axis has two positions, each with one member.

Methods:

  • List<Member> getMembers()
  • int getOrdinal()
2.3.9. The Cell interface

A Cell is a cell returned from an CellSet.

Methods:

  • CellSet getCellSet()
  • int getOrdinal()
  • List<Integer> getCoordinateList()
  • Object getPropertyValue(Property)
  • boolean isError()
  • boolean isNull()
  • boolean isEmpty()
  • double getDoubleValue()
  • String getErrorText()
  • Object getValue()
  • String getFormattedValue()
2.3.10. The CellSetMetaData interface

CellSetMetaData (extends java.sql.ResultSetMetaData) describes a CellSet.

Methods:

  • NamedList<Property> getCellProperties()
  • Cube getCube()
  • NamedList<CellSetAxisMetaData> getAxesMetaData()
  • CellSetAxisMetaData getSlicerAxisMetaData()

2.4. MDX query model

The MDX query model represents a parsed MDX statement.

An MDX query model can be created in three ways:

  • The MDX parser parses an MDX string to create an MDX query model;
  • Client code programmatically builds a query model by calling API methods;
  • Code in the transform package manipulates query model in response to graphical operations.

An MDX query model can exist in an un-validated and validated state. In the un-validated state, identifiers and function calls exist as raw strings, and no type information has been assigned. During validation, identifiers are resolved to specific MDX objects (members, etc.), type information is assigned, and if a function exists in several overloaded forms, a specific instance is chosen based upon the types of its arguments.

Any MDX query model can be serialized to a string containing MDX text.

An MDX query model can be converted into a statement. For example,

import org.olap.*;
import org.olap4j.mdx.*;

// Create a query model.
OlapConnection connection;
SelectNode query = new SelectNode();
query.setFrom(
    new IdentifierNode(
        new IdentifierNode.NameSegment("Sales")));
query.getAxisList().add(
    new AxisNode(
        null,
        false,
        Axis.ROWS,
        new ArrayList<IdentifierNode>(),
        new CallNode(
            null,
            "{}",
            Syntax.Braces,
            new IdentifierNode(
                new IdentifierNode.NameSegment("Measures"),
                new IdentifierNode.NameSegment("Unit Sales")))));

// Create a statement based upon the query model.
OlapStatement stmt;
try {
    stmt = connection.createStatement();
} catch (OlapException e) {
    System.out.println("Validation failed: " + e);
    return;
}

// Execute the statement.
CellSet cset;
try {
    cset = stmt.executeOlapQuery(query);
} catch (OlapException e) {
    System.out.println("Execution failed: " + e);
}

Package name: org.olap4j.mdx

Parse tree classes:

  • ParseTreeNode is a node in a parse tree representing a parsed MDX statement.
  • SelectNode represents a SELECT statement, including FROM and WHERE clauses if present.
  • AxisNode represents an axis expression.
  • CallNode represents a call to a function or operator.
  • IdentifierNode represents an identifier, such as Sales or [Measures].[Unit Sales].
  • LiteralNode represents a literal, such as 123 or "Hello, world!".
  • MemberNode represents a use of a member name in an expression.
  • LevelNode represents a use of a level name in an expression.
  • HierarchyNode represents a use of a hierarchy name in an expression.
  • DimensionNode represents a use of a dimension name in an expression.
  • WithMemberNode represents a WITH MEMBER clause defining a calculated member.
  • WithSetNode represents a WITH SET clause defining a calculated set.
  • PropertyValueNode represents property = value pair as part of a the declaration of a calculated member or set.

Other classes:

  • enum Syntax describes the possible syntaxes for functions and operators (infix, prefix, function call, and so forth)
2.4.1 The ParseTreeWriter class

ParseTreeWriter is used in conjunction with the ParseTreeNode.unparse(ParseTreeWriter) method to convert a parse tree into MDX code.

2.5. MDX parser

Package name: org.olap4j.mdx.parser

Provides an MDX parser and validator.

Parser and validator are both allocated via a parser factory, which is obtained from a connection:

OlapConnection connection;
MdxParserFactory parserFactory =
    connection.getParserFactory();
MdxParser parser =
    parserFactory.createMdxParser(connection);
SelectNode select =
    parser.parseSelect("SELECT FROM [Sales]");
MdxValidator validator =
    parserFactory.createMdxValidator(connection);
select = validator.validate(select);

Parser and validator are not thread-safe (they cannot be used by more than one thread simultaneously) but they can be re-used for multiple statements.

One of the chief purposes of validation is to assign a type to every expression within the parse tree. Before validation, any node's ParseTreeNode.getType() method may throw an exception, but after validation the getType() method will return a type. Nodes which are not expressions do not have types, and will always return null.

Classes:

2.6. MDX type model

Package name: org.olap4j.type

Represents the MDX type system.

Here are some examples:

ExpressionType
1 + 2Integer
[Store]Dimension
[Store].[State]Level<dimension=[Store], hierarchy=[Store]>
[Store].[USA].[CA]Member<dimension=[Store], hierarchy=[Store], level=[Store].[State], member=[Store].[USA].[CA]>
[Store].[USA].Children(2)Member<dimension=[Store], hierarchy=[Store], level=[Store].[State]>

Since MDX is a late-binding language, some expressions will have unknown types, or only partial type information. For example, the expression

[Store].Levels("Sta" + "te")

will have type Level<dimension=[Store], level=unknown>. The validator knows that the <hierarchy>.Levels(<string expr>) function returns a level, but exactly which level is not known until the expression is evaluated at runtime.

Type is the base class for all types.

Scalar types:

  • ScalarType represents the type of an expression which has a simple value such as a number or a string.
  • BooleanType (extends ScalarType) represents an expression which can have values TRUE and FALSE.
  • NumericType represents the type of a numeric expression.
  • DecimalType (extends NumericType) represents a fixed-point numeric expression. It is a subclass of NumericType, and has precision and scale. An integer expression would have scale 0.
  • StringType (extends ScalarType) represents the type of an expression which has a string value.
  • SymbolType (extends ScalarType) represents the type of a symbol, or flag, argument to a built-in function. For example, the ASC keyword in the expression Order(Gender.MEMBERS, Measures.[Unit Sales], ASC) is a symbol. Symbol types are rarely used except if you are manipulating a parse tree.

Metadata types:

  • CubeType represents the type of an expression whose value is a cube.
  • DimensionType represents the type of an expression whose value is a dimension.
  • HierarchyType represents the type of an expression whose value is a hierarchy.
  • LevelType represents the type of an expression whose value is a level.
  • MemberType represents the type of an expression whose value is a member.

A metadata type may be constrained to a particular part of the schema. For example, LevelType(hierarchy=[Time]) indicates that the expression must evaluate to one of the levels of the [Time] hierarchy, that is, one of the values [Time].[Year], [Time].[Quarter], or [Time].[Month].

Composite types:

  • SetType represents the type of an expression which is a set. It has a component type, for example, the type of the expression {[Store].[USA].Children} is Set(Member(level=[Store].[Store State]).
  • TupleType represents the type of an expression which consists of an n-tuple of members. It has a set of component types, each of which is a member type. For example, the type of the expression CrossJoin({[Gender].[F], [Gender].[M]}, [Store].Members) is Set(Tuple(Member(level=[Gender].[Gender]), Member(hierarchy=[Store])).

2.7. Metadata

Package name: org.olap4j.metadata

Metadata are the objects which describe the structure of an OLAP schema: cubes, dimensions, members, properties and so forth.

olap4j exposes metadata in two very different ways:

2.7.1. Access control

A user's view of metadata may be subject to access control. The precise rules for access control depend on the provider, and this specification does not say what those rules should be. But this specification requires that the API methods must behave consistently with the server's access control policy.

For example, in mondrian, users belong to roles, and roles may be granted or denied access to cubes, hierarchies, or members within hierarchies. Suppose that user Fred belongs to the "Sales Manager" role, which does not have access to the [Nation] level of the [Store] hierarchy, and the current connection has been opened in the "Sales Manager" role. Then the Member.getParentMember() method will return null if applied to [Store].[USA].[CA], because the 'real' parent member [Store].[USA] is invisible to him; also, the Hierarchy.getLevels() and OlapDatabaseMetaData.getLevels() methods will omit the Nation level from the list of levels they return.

In olap4j, you can set a connection's role at connect time using the Role connect string property, or you can call the OlapConnection.setRole(String roleName) method at any point during the lifecycle of the connection. Setting the role name to null reverts to the default access-control context.

2.7.2. Metadata objects

The following diagram shows the metadata objects in an olap4j schema.

olap4j metdata objects

In the diagram, each arrow represents a collection of objects in a parent object; for example, a database is a collection of catalogs, each catalog is a collection of schemas, each schema is a collection of cubes, and so forth. With the exception of Database, each object has a corresponding class in the org.olap4j.metadata package; Database is represented by a combination of the OlapConnection class (specifically the getCatalogs() method) and by OlapDatabaseMetaData (which describes the general capabilities of an OLAP server).

Most metadata objects extend the MetadataElement interface, which gives them name and uniqueName attributes, and localized caption and description.

When the API returns a list of metadata elements whose names must be unique (for example, the list of dimensions in a cube), the return type is the NamedList extension to java.util.List.

Providers are at liberty to implement metadata objects using a cache, and therefore over the course of time, different java objects may represent the same underlying metadata object. Always use equals(), not the == operator, when comparing metadata objects, and do not use IdentityHashMap.

2.7.2.1. The MetadataElement interface

A MetadataElement is an element which describes the structure of an OLAP schema.

Subtypes are Cube, Dimension, Hierarchy, Level, Member, Property. MetadataElement provides name and unique-name properties (not localized), and localized caption and description (see Internationalization).

  • String getName()
  • String getUniqueName()
  • String getCaption(Locale locale)
  • String getDescription(Locale locale)
2.7.2.2. The Catalog interface

A Catalog is the highest level element in the hierarchy of metadata objects. A catalog contains one or more schemas.

Some OLAP servers may only have one catalog. Mondrian is one such OLAP server; its sole catalog is always called "LOCALDB".

To obtain the collection of catalogs in the current server, call the OlapConnection.getCatalogs() method.

Methods:

  • String getName()
  • NamedList<Schema> getSchemas()
  • OlapDatabaseMetaData getMetaData()
2.7.2.3. The Schema interface

A Schema is a collection of database objects that contain structural information, or metadata, about a database.

It belongs to a catalog and contains a number of cubes and shared dimensions.

  • String getName()
  • List<Dimension> getSharedDimensions()
  • List<Cube> getCubes()
  • List<Locale> getSupportedLocales() (see Internationalization)
2.7.2.4. The Cube interface

A Cube is the central metadata object for representing multidimensional data.

It belongs to a schema, and is described by a list of dimensions and a list of measures. It may also have a collection of named sets, each defined by a formula.

  • NamedList<Dimension> getDimensions()
  • NamedList<Hierarchy> getHierarchies()
  • List<Measure> getMeasures()
  • NamedList<NamedSet> getSets()
  • Schema getSchema()
  • String getName()
  • List<Locale> getSupportedLocales() (see Internationalization)
  • Member lookupMember(String... nameParts)
  • List<Member> lookupMembers(Set<TreeOp> treeOps, String... nameParts)
2.7.2.5. The Dimension interface

A Dimension (extends MetadataElement) is an organized hierarchy of categories, known as levels, that describes data in a cube.

Dimensions typically describe a similar set of members upon which the user wants to base an analysis.

A dimension must have at least one hierarchy, and may have more than once, but most have exactly one hierarchy.

  • String getName()
  • NamedList<Hierarchy> getHierarchies()
  • Dimension.Type getDimensionType()
2.7.2.6. The Hierarchy interface

A Hierarchy  (extends MetadataElement) is an organization of the set of members in a dimension and their positions relative to one another.

A hierarchy is a collection of levels, each of which is a category of similar members.

  • Dimension getDimension()
  • String getName()
  • NamedList<Level> getLevels()
  • boolean hasAll()
  • Member getDefaultMember()
  • NamedList<Member> getRootMembers()
2.7.2.7. The Level interface

A Level  (extends MetadataElement) is a group of members in a hierarchy, all with the same attributes and at the same depth in the hierarchy.

  • int getDepth()
  • Hierarchy getHierarchy()
  • Level.Type getLevelType()
  • NamedList<Property> getProperties()
  • List<Member> getMembers()
  • int getCardinality()
2.7.2.8. The Member interface

A Member  (extends MetadataElement) is a data value in an OLAP dimension.

  • String getName()
  • NamedList<Member> getChildMembers()
  • Member getParentMember()
  • Level getLevel()
  • Hierarchy getHierarchy()
  • boolean isAll()
  • boolean isChildOrEqualTo(Member member)
  • boolean isCalculated()
  • boolean isCalculatedInQuery()
  • int solveOrder()
  • List<Member> getAncestorMembers()
  • Object getPropertyValue(Property property)
  • String getPropertyFormattedValue(Property property)
  • void setProperty(Property property, Object value)
  • NamedList<Property> getProperties()
  • int getOrdinal()
  • boolean isHidden()
  • Member getDataMember()
  • int getChildMemberCount()
2.7.2.9. The Measure interface

A Measure (extends Member) is a data value of primary interest to the user browsing the cube. It provides the value of each cell, and is usually numeric.

Every measure is a member of a special dimension called "Measures".

  • boolean isVisible()
  • Aggregator getAggregator()
  • Datatype getDataType()
2.7.2.10. The Property interface

Property  (extends MetadataElement) is the definition of a property of a member or a cell.

Property contains two enumerated types StandardMemberProperty and StandardCellProperty whose values are the built-in properties of members and cells. Because these types implement the Property interface, you can use them as properties; for example:

Member member;
Object o = member.getPropertyValue(
    Property.StandardMemberProperty.CATALOG_NAME);

Members:

  • Datatype getDatatype()
  • Set<TypeFlag> getType()
  • ContentType getContentType()
  • enum TypeFlag { MEMBER, CELL, SYSTEM, BLOB }
  • enum StandardMemberProperty implements Property { CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, ... }
  • enum StandardCellProperty implements Property { BACK_COLOR, CELL_EVALUATION_LIST, ... }
  • enum ContentType { REGULAR, ID, RELATION_TO_PARENT, ... }
2.7.2.11. The NamedSet interface

A NamedSet (extends MetadataElement) describes a set whose value is determined by an MDX expression. It belongs to a cube.

  • Cube getCube()
  • Expression getExpression()
2.7.2.12. The Datatype enum

The Datatype enum describes the type of property and measure values. Because olap4j drivers need to interoperate with OLE DB for OLAP and XMLA systems, Datatype values have the same ordinals as in the OLE DB specification, and we show here the name and description of the corresponding type in the OLE DB specification. The table shows the analogous Java type, if there is one.

DatatypeJava typeOLE DB typeDescription
INTEGERintDBTYPE_I4A four-byte, signed integer: INTEGER
DOUBLEdoubleDBTYPE_R8A double-precision floating-point value: Double
CURRENCY DBTYPE_CYA currency value: LARGE_INTEGER, Currency is a fixed-point number with four digits to the right of the decimal point. It is stored in an eight-byte signed integer, scaled by 10,000.
BOOLEANbooleanDBTYPE_BOOLA Boolean value stored in the same way as in Automation: VARIANT_BOOL; 0 means false and ~0 (bitwise, the value is not 0; that is, all bits are set to 1) means true.
VARIANTObjectDBTYPE_VARIANTAn Automation VARIANT
UNSIGNED_SHORT-DBTYPE_UI2A two-byte, unsigned integer
UNSIGNED_INTEGER-DBTYPE_UI4A four-byte, unsigned integer
LARGE_INTEGERlongDBTYPE_I8An eight-byte, signed integer: LARGE_INTEGER
STRINGStringDBTYPE_WSTRA null-terminated Unicode character string: wchar_t[length]; If DBTYPE_WSTR is used by itself, the number of bytes allocated for the string, including the null-termination character, is specified by cbMaxLen in the DBBINDING structure. If DBTYPE_WSTR is combined with DBTYPE_BYREF, the number of bytes allocated for the string, including the null-termination character, is at least the length of the string plus two. In either case, the actual length of the string is determined from the bound length value. The maximum length of the string is the number of allocated bytes divided by sizeof(wchar_t) and truncated to the nearest integer.
2.7.3. The OlapDatabaseMetaData interface, and methods which return schema rowsets

OlapDatabaseMetaData (extends java.sql.DatabaseMetaData) contains methods which return schema result sets.

Schema result sets are specified as in [XML for Analysis specification]. Here is a table of the XML/A methods and the corresponding olap4j method and element type.

XML for Analysis schema rowsetSchema result set methodMetadata element
DBSCHEMA_CATALOGSDatabaseMetaData.getCatalogsCatalog
not supportedDatabaseMetaData.getSchemasSchema
DBSCHEMA_COLUMNSnot supportednot supported
DBSCHEMA_PROVIDER_TYPESnot supportednot supported
DBSCHEMA_TABLESnot supportednot supported
DBSCHEMA_TABLES_INFOnot supportednot supported
DISCOVER_DATASOURCESOlapDatabaseMetaData.getDatasourcesnot supported
DISCOVER_ENUMERATORSnot supportednot supported
DISCOVER_KEYWORDSOlapDatabaseMetaData.getMdxKeywordsnot supported
DISCOVER_LITERALSOlapDatabaseMetaData.getLiteralsnot supported
DISCOVER_PROPERTIESOlapDatabaseMetaData.getDatabasePropertiesnot supported
DISCOVER_SCHEMA_ROWSETSnot supportednot supported
MDSCHEMA_ACTIONSOlapDatabaseMetaData.getActionsnot supported
MDSCHEMA_CUBESOlapDatabaseMetaData.getCubesCube
MDSCHEMA_DIMENSIONSOlapDatabaseMetaData.getDimensionsDimension
MDSCHEMA_FUNCTIONSOlapDatabaseMetaData.getFunctionsnot supported
MDSCHEMA_HIERARCHIESOlapDatabaseMetaData.getHierarchiesHierarchy
MDSCHEMA_INPUT_DATASOURCESnot supportednot supported
MDSCHEMA_KPISnot supportednot supported
MDSCHEMA_LEVELSOlapDatabaseMetaData.getLevelsLevel
MDSCHEMA_MEASURESOlapDatabaseMetaData.getMeasuresMeasure
MDSCHEMA_MEMBERSOlapDatabaseMetaData.getMembersMember
MDSCHEMA_PROPERTIESOlapDatabaseMetaData.getPropertiesProperty
MDSCHEMA_SETSOlapDatabaseMetaData.getSetsNamedSet

The rows returned in the result set returned from the metadata methods are structured according to the result set column layouts detailed in this section.

All columns noted in the following result sets are required, and they must be returned in the order shown. However, additional columns (which should be ignored by clients not expecting them) can be added at the end, and some columns can contain null data for info that does not apply.

The following sections describe the columns in each rowset. Each section includes a table that provides the following information for each column.

Column headingContents
Column nameThe name of the column in the output rowset.
TypeA description of the data type for the column, and whether the column may be NULL.
DescriptionA brief description of the purpose of the column.
2.7.3.1. getDatasources

Specified by the DISCOVER_DATASOURCES XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
DATA_SOURCE_NAMEStringThe name of the data source, such as FoodMart 2000. Never null.
DATA_SOURCE_DESCRIPTIONStringA description of the data source, as entered by the publisher.
URLStringThe unique path that shows where to invoke the XML for Analysis methods for that data source.
DATA_SOURCE_INFOString

A string containing any additional information required to connect to the data source. This can include the Initial Catalog property or other information for the provider.

Example: "Provider=MSOLAP;Data Source=Local;"

PROVIDER_NAMEString

The name of the provider behind the data source.

Example: "MSDASQL"

PROVIDER_TYPEString

Comma-separated list of the types of data supported by the provider. May include one or more of the following types. Example follows this table.

  • TDP: tabular data provider.
  • MDP: multidimensional data provider.
  • DMP: data mining provider. A DMP provider implements the OLE DB for Data Mining specification.
AUTHENTICATION_MODEStringSpecification of what type of security mode the data source uses. Values can be one of the following, never null:
  • Unauthenticated: no user ID or password needs to be sent.
  • Authenticated: User ID and Password must be included in the information required for the connection.
  • Integrated: the data source uses the underlying security to determine authorization, such as Integrated Security provided by Microsoft Internet Information Services (IIS).
2.7.3.2. getDatabaseProperties

Returns information about the standard and provider-specific properties supported by an olap4j provider. Properties that are not supported by a provider are not listed in the return result set.

Specified by the DISCOVER_PROPERTIES XML for Analysis method, except that we rename the VALUE property to PROPERTY_VALUE because "VALUE" is a SQL:2003 reserved word.

The returned result set contains the following columns.

Column nameTypeDescription
PROPERTY_NAMEStringThe name of the property. Never null.
PROPERTY_DESCRIPTIONStringA localizable text description of the property.
PROPERTY_TYPEStringThe XML data type of the property.
PROPERTY_ACCESS_TYPEStringAccess for the property. The value can be Read, Write, or ReadWrite. Never null.
IS_REQUIREDbooleanTrue if a property is required, false if it is not required.
PROPERTY_VALUEStringThe current value of the property.

This property is named VALUE in XMLA.

2.7.3.3 getLiterals

Retrieves a list of information on supported literals, including data types and values.

Specified by the DISCOVER_LITERALS XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
LITERAL_NAMEString

The name of the literal described in the row. Never null.

Example: DBLITERAL_LIKE_PERCENT.

LITERAL_VALUEString

Contains the actual literal value.

Example, if LITERAL_NAME is DBLITERAL_LIKE_PERCENT and the percent character (%) is used to match zero or more characters in a LIKE clause, this column’s value would be "%".

LITERAL_INVALID_CHARSString

The characters, in the literal, that are not valid.

For example, if table names can contain anything other than a numeric character, this string would be "0123456789".

LITERAL_INVALID_
STARTING_CHARS
StringThe characters that are not valid as the first character of the literal. If the literal can start with any valid character, this is null.
LITERAL_MAX_LENGTHintThe maximum number of characters in the literal. If there is no maximum or the maximum is unknown, the value is –1.
2.7.3.4. getCubes

Describes the structure of cubes within a database.

Specified by the MDSCHEMA_CUBES XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the database.
SCHEMA_NAMEStringNot supported.
CUBE_NAMEStringThe name of the cube or dimension. Dimension names are prefaced by a dollar sign ($) symbol.
CUBE_TYPEStringThe type of the cube. Valid values are:
  • CUBE
  • DIMENSION
CUBE_GUIDStringNot supported.
CREATED_ONTimestampNot supported.
LAST_SCHEMA_UPDATETimestampThe time that the cube was last processed.
SCHEMA_UPDATED_BYStringNot supported.
LAST_DATA_UPDATETimestampThe time that the cube was last processed.
DATA_UPDATED_BYStringNot supported.
DESCRIPTIONStringA user-friendly description of the cube.
IS_DRILLTHROUGH_ENABLEDbooleanA Boolean that always returns true.
IS_LINKABLEbooleanA Boolean that indicates whether a cube can be used in a linked cube.
IS_WRITE_ENABLEDbooleanA Boolean that indicates whether a cube is write-enabled.
IS_SQL_ENABLEDbooleanA Boolean that indicates whether SQL can be used on the cube.
CUBE_CAPTIONStringThe caption of the cube.
BASE_CUBE_NAMEStringThe name of the source cube if this cube is a perspective cube.
ANNOTATIONSString(Optional) A set of notes, in XML format.

The rowset is sorted on CATALOG_NAME, SCHEMA_NAME, CUBE_NAME.

2.7.3.5. getDimensions

Retrieves a result set describing the shared and private dimensions within a database.

Specified by the MDSCHEMA_DIMENSIONS XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the database.
SCHEMA_NAMEStringNot supported.
CUBE_NAMEStringThe name of the cube.
DIMENSION_NAMEStringThe name of the dimension. If a dimension is part of more than one cube or measure group, then there is one row for each unique combination of dimension, measure group, and cube.
DIMENSION_UNIQUE_NAMEStringThe unique name of the dimension.
DIMENSION_GUIDStringNot supported.
DIMENSION_CAPTIONStringThe caption of the dimension. This should be used when displaying the name of the dimension to the user, such as in the user interface or reports.
DIMENSION_ORDINALintThe position of the dimension within the cube.
DIMENSION_TYPEintThe type of the dimension. Valid values include the values of the xmlaOrdinal attribute of the org.olap4j.Dimension.Type enum.
DIMENSION_CARDINALITYintThe number of members in the key attribute.
DEFAULT_HIERARCHYStringA hierarchy from the dimension. Preserved for backwards compatibility.
DESCRIPTIONStringA user-friendly description of the dimension.
IS_VIRTUALbooleanAlways false.
IS_READWRITEbooleanA Boolean that indicates whether the dimension is write-enabled.

true if the dimension is write-enabled.

DIMENSION_UNIQUE_SETTINGSintA bitmap that specifies which columns contain unique values if the dimension contains only members with unique names. The following bit value constants are defined for this bitmap:
  • MDDIMENSIONS_MEMBER_KEY_UNIQUE (1)
DIMENSION_MASTER_
UNIQUE_NAME
StringAlways null.
DIMENSION_IS_VISIBLEbooleanAlways true.

The result set is sorted on CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, DIMENSION_NAME.

2.7.3.6. getFunctions

Retrieves a result set describing the functions available to client applications connected to the database.

Specified by the MDSCHEMA_FUNCTIONS XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
FUNCTION_NAMEStringThe name of the function.
DESCRIPTIONStringA description of the function.
PARAMETER_LISTStringA comma delimited list of parameters formatted as in Microsoft Visual Basic. For example, a parameter might be Name as String.
RETURN_TYPEintThe VARTYPE of the return data type of the function.
ORIGINintThe origin of the function:
  • 1 for MDX functions.
  • 2 for user-defined functions.
INTERFACE_NAMEStringThe name of the interface for user-defined functions

The group name for Multidimensional Expressions (MDX) functions.

LIBRARY_NAMEStringThe name of the type library for user-defined functions. null for MDX functions.
DLL_NAMEString(Optional) The name of the assembly that implements the user-defined function.

Returns null for MDX functions.

HELP_FILEString(Optional) The name of the file that contains the help documentation for the user-defined function.

Returns null for MDX functions.

HELP_CONTEXTint(Optional) Returns the Help context ID for this function.
OBJECTString(Optional) The generic name of the object class to which a property applies. For example, the rowset corresponding to the <level_name>.Members function returns "Level".

Returns null for user-defined functions, or non-property MDX functions.

CAPTIONStringThe display caption for the function.

The rowset is sorted on ORIGIN, INTERFACE_NAME, FUNCTION_NAME.

2.7.3.7. getHierarchies

Retrieves a result set describing each hierarchy within a particular dimension.

Specified by the MDSCHEMA_HIERARCHIES XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the catalog to which this hierarchy belongs. null if the provider does not support catalogs.
SCHEMA_NAMEStringNot supported
CUBE_NAMEString(Required) The name of the cube to which this hierarchy belongs.
DIMENSION_UNIQUE_NAMEStringThe unique name of the dimension to which this hierarchy belongs. For providers that generate unique names by qualification, each component of this name is delimited.
HIERARCHY_NAMEStringThe name of the hierarchy. Blank if there is only a single hierarchy in the dimension. This will always have a value in Microsoft SQL Server 2005 Analysis Services (SSAS).
HIERARCHY_UNIQUE_NAMEStringThe unique name of the hierarchy.
HIERARCHY_GUIDStringNot supported
HIERARCHY_CAPTIONStringA label or a caption associated with the hierarchy. Used primarily for display purposes. If a caption does not exist, HIERARCHY_NAME is returned. If the dimension either does not contain a hierarchy or has just one hierarchy, this column will contain the name of the dimension.
DIMENSION_TYPEintThe type of the dimension. Valid values include the values of the xmlaOrdinal attribute of .
HIERARCHY_CARDINALITYintThe number of members in the hierarchy.
DEFAULT_MEMBERStringThe default member for this hierarchy. This is a unique name. Every hierarchy must have a default member.
ALL_MEMBERStringThe member at the highest level of the rollup.
DESCRIPTIONStringA human-readable description of the hierarchy. null if no description exists.
STRUCTUREintThe structure of the hierarchy. Valid values include the following values:
  • MD_STRUCTURE_FULLYBALANCED (0)
  • MD_STRUCTURE_RAGGEDBALANCED (1)
  • MD_STRUCTURE_UNBALANCED (2)
  • MD_STRUCTURE_NETWORK (3)
IS_VIRTUALbooleanAlways returns false.
IS_READWRITEbooleanA Boolean that indicates whether the Write Back to dimension column is enabled.

Returns true if the Write Back to dimension column that represents this hierarchy is enabled.

DIMENSION_UNIQUE_SETTINGSintAlways returns MDDIMENSIONS_MEMBER_KEY_UNIQUE (1).
DIMENSION_MASTER_
UNIQUE_NAME
StringAlways returns null.
DIMENSION_IS_VISIBLEbooleanAlways returns true. If the dimension is not visible, it will not appear in the schema rowset.
HIERARCHY_ORDINALintThe ordinal number of the hierarchy across all hierarchies of the cube.
DIMENSION_IS_SHAREDbooleanAlways returns true.
HIERARCHY_IS_VISIBLEbooleanA Boolean that indicates whether the hieararchy is visible.

Returns true if the hierarchy is visible; otherwise, false.

HIERARCHY_ORIGINintA bit mask that determines the source of the hierarchy:
  • MD_USER_DEFINED identifies user defined hierarchies, and has a value of 0x0000001.
  • MD_SYSTEM_ENABLED identifies attribute hierarchies, and has a value of 0x0000002.
  • MD_SYSTEM_INTERNAL identifies attributes with no attribute hierarchies, and has a value of 0x0000004.

A parent/child attribute hierarchy is both MD_USER_DEFINED and MD_SYSTEM_ENABLED.

HIERARCHY_DISPLAY_FOLDERStringThe path to be used when displaying the hierarchy in the user interface. Folder names will be separated by a semicolon (;). Nested folders are indicated by a backslash (/).
INSTANCE_SELECTIONintA hint to the client application on how to show the hierarchy. Valid values include the following values:
  • MD_INSTANCE_SELECTION_NONE
  • MD_INSTANCE_SELECTION_DROPDOWN
  • MD_INSTANCE_SELECTION_LIST
  • MD_INSTANCE_SELECTION_FILTEREDLIST
  • MD_INSTANCE_SELECTION_MANDATORYFILTER

The rowset is sorted on CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, DIMENSION_UNIQUE_NAME, HIERARCHY_NAME.

2.7.3.8. getLevels

Retrieves a result set describing each level within a particular hierarchy.

Specified by the MDSCHEMA_LEVELS XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the catalog to which this level belongs. null if the provider does not support catalogs.
SCHEMA_NAMEStringThe name of the schema to which this level belongs. null if the provider does not support schemas.
CUBE_NAMEStringThe name of the cube to which this level belongs.
DIMENSION_UNIQUE_NAMEStringThe unique name of the dimension to which this level belongs. For providers that generate unique names by qualification, each component of this name is delimited.
HIERARCHY_UNIQUE_NAMEStringThe unique name of the hierarchy. If the level belongs to more than one hierarchy, there is one row for each hierarchy to which it belongs. For providers that generate unique names by qualification, each component of this name is delimited.
LEVEL_NAMEStringThe name of the level.
LEVEL_UNIQUE_NAMEStringThe properly escaped unique name of the level.
LEVEL_GUIDStringNot supported.
LEVEL_CAPTIONStringA label or caption associated with the hierarchy. Used primarily for display purposes. If a caption does not exist, LEVEL_NAME is returned.
LEVEL_NUMBERintThe distance of the level from the root of the hierarchy. Root level is zero (0).
LEVEL_CARDINALITYintThe number of members in the level.
LEVEL_TYPEintType of the level. Values are as allowed by the xmlaOrdinal field of the org.olap4j.Level.Type enum.
DESCRIPTIONStringA human-readable description of the level. null if no description exists.
CUSTOM_ROLLUP_SETTINGSintA bitmap that specifies the custom rollup options:
  • MDLEVELS_CUSTOM_ROLLUP_EXPRESSION (0x01) indicates an expression exists for this level. (Deprecated)
  • MDLEVELS_CUSTOM_ROLLUP_COLUMN (0x02) indicates that there is a custom rollup column for this level.
  • MDLEVELS_SKIPPED_LEVELS (0x04) indicates that there is a skipped level associated with members of this level.
  • MDLEVELS_CUSTOM_MEMBER_PROPERTIES (0x08) indicates that members of the level have custom member properties.
  • MDLEVELS_UNARY_OPERATOR (0x10) indicates that members on the level have unary operators.
LEVEL_UNIQUE_SETTINGSintA bitmap that specifies which columns contain unique values, if the level only has members with unique names or keys. The Msmd.h file defines the following bit value constants for this bitmap:
  • MDDIMENSIONS_MEMBER_KEY_UNIQUE (1)
  • MDDIMENSIONS_MEMBER_NAME_UNIQUE (2)

The key is always unique in Microsoft SQL Server 2005 Analysis Services (SSAS). The name will be unique if the setting on the attribute is UniqueInDimension or UniqueInAttribute

LEVEL_IS_VISIBLEbooleanA Boolean that indicates whether the level is visible.

Always returns True. If the level is not visible, it will not be included in the schema rowset.

LEVEL_ORDERING_PROPERTYStringThe ID of the attribute that the level is sorted on.
LEVEL_DBTYPEintThe DBTYPE enumeration of the member key column that is used for the level attribute.

Null if concatenated keys are used as the member key column.

LEVEL_MASTER_
UNIQUE_NAME
StringAlways returns null.
LEVEL_NAME_
SQL_COLUMN_NAME
StringThe SQL representation of the level member names.
LEVEL_KEY_
SQL_COLUMN_NAME
StringThe SQL representation of the level member key values.
LEVEL_UNIQUE_NAME_
SQL_COLUMN_NAME
StringThe SQL representation of the member unique names.
LEVEL_ATTRIBUTE_
HIERARCHY_NAME
StringThe name of the attribute hierarchy providing the source of the level.
LEVEL_KEY_CARDINALITYintThe number of columns in the level key.
LEVEL_ORIGINintA bit map that defines how the level was sourced:
  • MD_ORIGIN_USER_DEFINED identifies levels in a user defined hierarchy.
  • MD_ORIGIN_ATTRIBUTE identifies levels in an attribute hierarchy.
  • MD_ORIGIN_KEY_ATTRIBUTE identifies levels in a key attribute hierarchy.
  • MD_ORIGIN_INTERNAL identifies levels in attribute hierarchies that are not enabled.

The rowset is sorted on CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, DIMENSION_UNIQUE_NAME, HIERARCHY_UNIQUE_NAME, LEVEL_NUMBER.

2.7.3.9. getMeasures

Retrieves a result set describing each measure within a cube.

Specified by the MDSCHEMA_MEASURES XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the catalog to which this measure belongs. null if the provider does not support catalogs.
SCHEMA_NAMEStringThe name of the schema to which this measure belongs. null if the provider does not support schemas.
CUBE_NAMEStringThe name of the cube to which this measure belongs.
MEASURE_NAMEStringThe name of the measure.
MEASURE_UNIQUE_NAMEStringThe Unique name of the measure. For providers that generate unique names by qualification, each component of this name is delimited.
MEASURE_CAPTIONStringA label or caption associated with the measure. Used primarily for display purposes. If a caption does not exist, MEASURE_NAME is returned.
MEASURE_GUIDStringNot supported.
MEASURE_AGGREGATORintAn enumeration that identifies how a measure was derived. Can be one of the values allowed by the xmlaOrdinal field of the org.olap4j.Measure.Aggregator enum.
DATA_TYPEintThe data type of the measure.
NUMERIC_PRECISIONintThe maximum precision of the property if the measure object's data type is exact numeric. null for all other property types.
NUMERIC_SCALEintThe number of digits to the right of the decimal point if the measure object's type indicator is DBTYPE_NUMERIC or DBTYPE_DECIMAL. Otherwise, this value is null.
MEASURE_UNITSStringNot supported
DESCRIPTIONStringA human-readable description of the measure. null if no description exists.
EXPRESSIONStringAn expression for the member.
MEASURE_IS_VISIBLEbooleanA Boolean that always returns True. If the measure is not visible, it will not be included in the schema rowset.
LEVELS_LISTStringA string that always returns null.
MEASURE_NAME_
SQL_COLUMN_NAME
StringThe name of the column in the SQL query that corresponds to the measure's name.
MEASURE_UNQUALIFIED_
CAPTION
StringThe name of the measure, not qualified with the measure group name.
MEASUREGROUP_NAMEStringThe name of the measure group to which the measure belongs.
MEASURE_DISPLAY_FOLDERStringThe path to be used when displaying the measure in the user interface. Folder names will be separated by a semicolon. Nested folders are indicated by a backslash (/).
DEFAULT_FORMAT_STRINGStringThe default format string for the measure.

The rowset is sorted on CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, MEASURE_NAME.

2.7.3.10. getMembers

Retrieves a result set describing the members within a database.

Specified by the MDSCHEMA_MEMBERS XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the database to which this member belongs.
SCHEMA_NAMEStringThe name of the schema to which this member belongs.
CUBE_NAMEStringThe name of the cube to which this member belongs.
DIMENSION_UNIQUE_NAMEStringThe unique name of the dimension to which this member belongs.
HIERARCHY_UNIQUE_NAMEStringThe unique name of the hierarchy to which this member belongs.
LEVEL_UNIQUE_NAMEStringThe unique name of the level to which this member belongs.
LEVEL_NUMBERintThe distance of the member from the root of the hierarchy. The root level is zero (0).
MEMBER_ORDINALint(Deprecated) Always returns 0.
MEMBER_NAMEStringThe name of the member.
MEMBER_UNIQUE_NAMEStringThe unique name of the member.
MEMBER_TYPEintThe type of the member, one of the values of the ordinal field of the org.olap4j.Member.Type enum.

FORMULA takes precedence over MEASURE. For example, if there is a formula (calculated) member on the Measures dimension, it is listed as FORMULA.

MEMBER_GUIDStringThe GUID of the member. null if no GUID exists.
MEMBER_CAPTIONStringA label or caption associated with the member. Used primarily for display purposes. If a caption does not exist, MEMBER_NAME is returned.
CHILDREN_CARDINALITYintThe number of children that the member has. This can be an estimate, so consumers should not rely on this to be the exact count. Providers should return the best estimate possible.
PARENT_LEVELintThe distance of the member's parent from the root level of the hierarchy. The root level is zero (0).
PARENT_UNIQUE_NAMEStringThe unique name of the member's parent. null is returned for any members at the root level.
PARENT_COUNTintThe number of parents that this member has.
DESCRIPTIONStringAlways returns null.
EXPRESSIONStringThe expression for calculations, if the member is of type MDMEMBER_TYPE_FORMULA.
MEMBER_KEYStringThe value of the member's key column. Returns null if the member has a composite key.
IS_PLACEHOLDERMEMBERbooleanA Boolean that indicates whether a member is a placeholder member for an empty position in a dimension hierarchy.

It is valid only if the MDX Compatibility property has been set to 1.

IS_DATAMEMBERbooleanA Boolean that indicates whether the member is a data member.

Returns True if the member is a data member.

Zero or more additional columnsintNo properties are returned if the members could be returned from multiple levels. For example, if the Tree operator is PARENT and SELF for a non-parent child hierarchy, no member properties are returned.

This applies to ragged hierarchies where tree operators could return members from different levels (for example, if the prior level contains holes and parent on members is requested).

The rowset is sorted on CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, DIMENSION_UNIQUE_NAME, HIERARCHY_UNIQUE_NAME, LEVEL_UNIQUE_NAME, LEVEL_NUMBER, MEMBER_ORDINAL.

2.7.3.11. getProperties

Retrieves a list of descriptions of member and cell Properties.

Specified by the MDSCHEMA_PROPERTIES XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the database.
SCHEMA_NAMEStringThe name of the schema to which this property belongs. null if the provider does not support schemas.
CUBE_NAMEStringThe name of the cube.
DIMENSION_UNIQUE_NAMEStringThe unique name of the dimension. For providers that generate unique names by qualification, each component of this name is delimited.
HIERARCHY_UNIQUE_NAMEStringThe unique name of the hierarchy. For providers that generate unique names by qualification, each component of this name is delimited.
LEVEL_UNIQUE_NAMEStringThe unique name of the level to which this property belongs. If the provider does not support named levels, it should return the DIMENSION_UNIQUE_NAME value for this field. For providers that generate unique names by qualification, each component of this name is delimited.
MEMBER_UNIQUE_NAMEStringThe unique name of the member to which the property belongs. Used for data stores that do not support named levels or have properties on a member-by-member basis. If the property applies to all members in a level, this column is null. For providers that generate unique names by qualification, each component of this name is delimited.
PROPERTY_TYPEintA bitmap that specifies the type of the property:
  • MDPROP_MEMBER (1) identifies a property of a member. This property can be used in the DIMENSION PROPERTIES clause of the SELECT statement.
  • MDPROP_CELL (2) identifies a property of a cell. This property can be used in the CELL PROPERTIES clause that occurs at the end of the SELECT statement.
  • MDPROP_SYSTEM (4) identifies an internal property.
  • MDPROP_BLOB (8) identifies a property which contains a binary large object (blob).
PROPERTY_NAMEStringThe name of the property. If the key for the property is the same as the name for the property, PROPERTY_NAME will be blank.
PROPERTY_CAPTIONStringA label or caption associated with the property, used primarily for display purposes. Returns PROPERTY_NAME if a caption does not exist.
DATA_TYPEintThe data type of the property.
CHARACTER_
MAXIMUM_LENGTH
intThe maximum possible length of the property, if it is a character, binary, or bit type.

Zero indicates there is no defined maximum length.

Returns null for all other data types.

CHARACTER_OCTET_LENGTHintThe maximum possible length (in bytes) of the property, if it is a character or binary type.

Zero indicates there is no defined maximum length.

Returns null for all other data types.

NUMERIC_PRECISIONintThe maximum precision of the property, if it is a numeric data type.

Returns null for all other data types.

NUMERIC_SCALEintThe number of digits to the right of the decimal point, if it is a DBTYPE_NUMERIC or DBTYPE_DECIMAL type.

Returns null for all other data types.

DESCRIPTIONStringA human readable description of the property. null if no description exists.
PROPERTY_CONTENT_TYPEintThe type of the property. Can be one of the values of the xmlaOrdinal field of the org.olap4j.Property.ContentType enum.
SQL_COLUMN_NAMEStringThe name of the property used in SQL queries from the cube dimension or database dimension.
LANGUAGEintThe translation expressed as an LCID. Only valid for property translations.
PROPERTY_ORIGINintIdentifies the type of hierarchy that the property applies to:
  • MD_USER_DEFINED (1) indicates the property is on a user defined hierarchy
  • MD_SYSTEM_ENABLED (2) indicates the property is on an attribute hierarchy
  • MD_SYSTEM_DISABLED (4) indicates the property is on an attribute hierarchy that is not enabled.
PROPERTY_ATTRIBUTE_
HIERARCHY_NAME
StringThe name of the attribute hierarchy sourcing this property.
PROPERTY_CARDINALITYStringThe cardinality of the property. Possible values include the following strings:
  • ONE
  • MANY
MIME_TYPEStringThe mime type for binary large objects (BLOBs).
PROPERTY_IS_VISIBLEbooleanA Boolean that indicates whether the property is visible.

true if the property is visible; otherwise, false.

This schema rowset is not sorted.

2.7.3.12. getSets

Retrieves a result set describing any sets that are currently defined in a database, including session-scoped sets.

Specified by the MDSCHEMA_SETS XML for Analysis method.

The returned result set contains the following columns.

Column nameTypeDescription
CATALOG_NAMEStringThe name of the database.
SCHEMA_NAMEStringNot supported.
CUBE_NAMEStringThe name of the cube.
SET_NAMEStringThe name of the set, as specified in the CREATE SET statement.
SCOPEintThe scope of the set:
  • MDSET_SCOPE_GLOBAL (1)
  • MDSET_SCOPE_SESSION (2)
DESCRIPTIONStringNot supported.
EXPRESSIONStringThe expression for the set.
DIMENSIONSStringA comma delimited list of hierarchies included in the set.
SET_CAPTIONStringA label or caption associated with the set. The label or caption is used primarily for display purposes.
SET_DISPLAY_FOLDERStringThe path to be used by the user interface when displaying the set. Folder names are separated by a backslash (/), folders are separated by a semicolon (;).

The rowset is sorted on CATALOG_NAME, SCHEMA_NAME, CUBE_NAME.

2.7.4. Other methods
MethodDescription
getDatabase()Returns the one and only Database.
getMdxKeywords()Returns the keywords of this dialect of MDX, as a comma-separated string.

2.8. Transform

A transform is an operation which maps a query model to a new query model. It is usually triggered by a gesture within the user-interface. For example, clicking on the Unit Sales column transforms the query

SELECT {[Measures].[Store Sales], [Measures].[Unit Sales]} ON COLUMNS,
  {[Product].Members} ON ROWS
FROM [Sales]

into one with sorting:

SELECT {[Measures].[Store Sales], [Measures].[Unit Sales]} ON COLUMNS,
  Order({[Product].Members}, [Measures].[Unit Sales], ASC) ON ROWS
FROM [Sales]

Transformations can only modify a query within a cube - it cannot be used to change the cube that the query is against or to join two cubes. Similarly, the transform package only supports modifying a MDX query model. For example, a "drill" transform can not be used to produce a SQL query that returns data outside of the cube.

Package name: org.olap4j.transform

Classes: (incomplete)

  • Tuple
  • Set
  • CalculatedMember
  • NamedSet
  • Axis
  • Slicer
2.8.1. Query Model Details

This section should probably be moved into Section 2.4.

The MDX query language uses a data model based on cubes, dimensions, tuples and sets. The transformation package allows direct manipulation of a query exploring a cube.

A tuple is a multidimensional member. It is a combination of members from one or more dimensions, with the limitation that only one member can be used from each dimension. A set is an ordered collection of tuples. An MDX query selects zero or more axes using a data slicer. (The axes loosely correspond to the "SELECT" clause in a SQL query, and the slicer to the "WHERE".)

2.8.2. Navigation Actions

The defined set of navigations can be divided into four categories: Slicing, Restructuring, Drilling, Scoping.

2.8.2.1. Slicing Navigations
setSlicer
Secifies the slicer to use, replacing any current one.
getSlicer
Retrieve the current slicer.
excludeEmpty
Removes empty slices from the results.
setLimit
Limits the results to the top/bottom n results for a specified measure.
2.8.2.2. Restructuring Navigations

Restructuring navigations change the axes of the returned cube.

getAxis setAxis
Specifies the Set to use for an Axis. Can be used to add or replace a axis.
deleteAxis
Removes the specified Axis from the results.
addToAxis
Appends a new Tuple or Set to an Axis.
moveTuple
Moves a tuple from one Axis to another. If the tuple is not contained in the first axis this method behaves like addToAxis on the second axis.
reorderAxis
Reorders the tuples in the axis.
addTotal
Adds an aggregation (total, min, max, count, distinct) to the specified member. More than one aggregation can be added to a single member.
deleteTotal
Deletes an aggregation from the specified member.
2.8.2.3. Drilling Navigations

Navigations that allow a user to move through the levels in a hierarchy. All drill navigations operate on a single Axis.

  • drill
    Moves the specified member up/down one level in the hierarchy. All members of the hierarchy are replaced by this action.
2.8.2.4. Scoping Navigations

Navigations that allow a user to expand/collapse sections of a result set. All scoping navigations operate on single Axis.

  • expand
    Expand the given measure to include both the current level and all the members one level down the hierarchy. Optionally expands a single measure or all measures at the level.
    collapse
    Removes members at a given level of a hierarchy. Optionally collapses a single measure or all measures at the level.
2.8.2.5. Supporting Actions

Axis Operations

  • getSet
  • setSet
  • addToAxis
  • removeFromAxis

Set Operations

  • getTuple
  • setTuple
  • addToSet - includes Tuples, ranges of Tuples, functions, properties
  • removeFromSet

Tuple Operations

  • addMember
  • deleteMember
  • getMembers
Open Issues
  • Is this API at the right level, or is it too close to MDX?
  • Do we want to include support for adding highlighting conditions?
  • What about result formatting as part of the query?
  • Should common operators such as CrossJoin(), Order() and Filter() be baked into the API as methods, or just treated as functions?
  • How should we handle functions that return or modify Sets? We want to make it easy to wrap an entire axis in a function.
  • Should we limit the Slicer to a Tuple or allow a Set? I believe the MDX spec allows a Set, but I don't know if anybody supports it.
  • I think we should add some explicit time based functions, since time based analysis is so common, and so frequently done wrong. ie if the Axis is using a time based dimension you can use "setCompareToPreviousTimePeriod()" instead of having to add the previous time period as a member and calculate the change.

2.9. Layout

The layout package provides data models for graphical OLAP applications. In particular, the GridModel class provides, for OLAP data, what Swing's TableModel provides for SQL data.

Package name: org.olap4j.layout

Classes: TBD

3. Other topics

In this section we discuss aspects of the design and usage of olap4j which pervade all of the components.

3.1. Internationalization

Metadata elements in olap4j can be localized. Unlike the tables and columns model of relational databases and JDBC, elements of an OLAP data model appear on the screen of the end-user, and the user expects these elements to appear in his or her own language.

A connection has a locale. For most drivers, this can be initialized using a connection parameter called Locale. The locale can be overridden by calling OlapConnection.setLocale(Locale).

Metadata elements Cube, Dimension, Hierarchy, Level, Member and so forth have methods getCaption and getDescription (inherited from MetadataElement) which take a locale as a parameter. If the parameter locale is null, the connection's locale is used.

Suppose one cube is available in English and French, and in French and Spanish, and both are shown in same portal. Clients typically say that seeing reports in a mixture of languages is confusing; the portal would figure out the best common language, in this case French. The Cube and Schema objects have getSupportedLocales() methods for this purpose.

3.2. Concurrency and thread-safety

The JDBC 4.0 specification describes the thread-safety requirements for drivers, and what modes of concurrency JDBC applications can assume that their drivers will support. Since the olap4j specification is an extension to the JDBC specification, an olap4j driver must comply with the JDBC specification in this regard.

3.3. Canceling statements

The JDBC specification provides the Statement.cancel() method, so that a statement which is executing in one thread may be safely terminated by another thread; and Statement.setQueryTimeout(int seconds), to request that a statement aborts itself after executing for a certain period of time.

4. Other components

The API described above is a set of interfaces which must be implemented by any compliant provider. The olap4j project also contains some components which are not part of the API.

4.1. Test suite

The olap4j project contains a TCK (Test Compatibility Kit). The TCK is a suite of tests which can be used to verify the compliance of an implementation of the API.

4.2. XML/A provider

The XML/A provider is an implementation of the olap4j API which talks to a generic XML/A provider.

Since there are many XML/A providers, and some of them require requests in a particular format and/or produce idiosyncratic responses, the XML/A provider will come in several flavors.

The XML/A provider is being developed in the same source-code repository as olap4j, in a Java package org.olap4j.driver.xmla, but is not part of the olap4j specification or release.

5. Non-functionality

Here are some of the areas of functionality which will not be part of olap4j:

  • Schema reader parses an XML file to create a schema
  • Cache management functions
  • Ability to create/modify schema dynamically
  • Definitions of MDX functions (such as the number and types of parameters)
  • SPI to extend the system by creating user-defined functions and so forth
  • XML/A bridge (to make an olap4j data source appear as an XML/A server)
  • SchemaReader

6. Related projects

6.1. Mondrian provider

The Mondrian project will contain an implementation of the olap4j API based on the Mondrian OLAP engine.

This code is currently being developed the same source-code repository as olap4j, and is the reference implementation of olap4j. The code will be contributed to the mondrian project in the mondrian-3.0 release, when olap4j will become mondrian's primary API, and the mondrian team will take over the development of the mondrian provider.

6.2. XML for Analysis provider

We intend to create an a driver which implements the olap4j API on top of any XML/A data source.

This code is currently being developed in the same source-code repository as olap4j, but will never be part of any olap4j release, and will be spun off as a separate project before olap4j 1.0.

6.3. Other data sources

In principle, providers could be created to other OLAP data sources. This would be particularly straightforward for servers which already have a native Java API.

Appendix A. Opportunities for specification

The following are features which have been suggested for inclusion in the olap4j specification, but which are not part of the current version. They may be included in future revisions of the specification.

A.1. Date and Time types

Include support for Date and Time values. The package org.olap4j.type could have additional classes DateType and TimeType.

(Richard Emberson, 2006/8/14)

A.2. Schema notification

Add a mechanism for the client to detect that the schema has been modified (for instance, that a cube has been added). Not necessarily to find out what those changes are.

(Richard Emberson, 2006/8/15)

A.3. Writethrough/Writeback

Specify how clients can write cell values back to the database. Useful for budgeting applications and 'what if?' analysis.

(PALO, 2006/10/14)

A.4. Drillthrough

Mondrian exposes the SQL statement used to form the result set, and exposes the mapping from columns to members/levels, whereas olap4j currently only returns a result set.

Appendix B. Feedback

Richard Emberson, email, 2006/8/15

"One thing we found about XMLA was that our users wanted all roles to be defined, stored, modified, and accessed though the same mechanism. With a large application with many areas that can be permissioned, it is important that olap4j let an application builder manage roles externally and apply them as part of an individual's execution context."

Appendix C. Open issues

These issues will be voted upon at the next meeting. If they are accepted, they will generally be put into the spec.

(No issues are currently open.)

Appendix D. Miscellaneous

D.1. To be specified

[Method for richer query of members, analogous to OlapDatabaseMetaData.getMembers(). Maybe extend Cube.lookupMember. Something with a treeop.]

[Discuss thread safety of connections, statements, result sets.]

[API for canceling statements.]

[2006/10/20#1. Specification should include compliance levels, like the SQL specification does. In particular, we will allow providers to comply with a limited subset of MDX.]

[2006/10/20#3. Need to allow clients to access the members on a ResultAxis via a list (for convenience) and via an iterator. Iterators need to be restartable, but not bidirectional. Need to know the size of the axes, even if using the iterator interface.]

[2006/10/20#6. We discussed session support. It is necessary for write-back. JDBC's 'stateful session' is difficult to implement over a stateless protocol like HTTP. Michael suggested adding 'session name' as a parameter to 'execute' methods. Julian disagreed. No conclusion reached.]

[2006/10/20#7. We discussed the goals and intended audience of olap4j. The audience spans from a beginner's audience (only 2 hours experience with the API) who don't want to write a lot of code, to writers of clients (2 yrs experience with the API) who want performance and don't care how much code they need to write. Distributed clients (e.g. olap4j provider for XMLA) have bandwidth constraints. Mobile clients also have memory constraints.

ADOMD addressed beginners audience well, but used a lot of memory. Challenge is to support an object model (hence easy programming model) without increasing memory. No specific change to the specification, but decided to add memory efficiency as a design goal.]

D.2. Design notes

JDK.

We are targeting JDK 1.5, and running retroweaver for backward compatibility for JDK 1.4. See forum thread: olap4j, JDK 1.5 and generics.

We also support JDK 1.6, and with it JDBC 4.0.

Result sets, random access, and memory usage

Should result sets return their axes as cursors or collections? Cursors require less memory, but collections provide an easier programming model.

Also on the subject of memory, how to represent the metadata? Schema result sets require less memory, are more flexible, and have better defined semantics in the presence of transactions and offline working; but an object model (Cube, Dimension, Level) provides an easier programming model.

Accessing cells

It would be possible to access cells in a result set (a) by ordinal; (b) by coordinates; (c) by the 'etchasketch' model determined by the position of the iterator along each axis, as used by JOLAP. We decided to support (a) and (b) but not (c). There are methods on CellSet to convert from ordinal to coordinates and vice versa.

If there is a huge number of cells, the client has limited memory, and bandwidth to the server is limited, random access to cells is costly. Michael suggested that we add a method List<Cell> getCells(int startOrdinal, int endOrdinal), which matches XML/A behavior, but we declined to add it to the spec for now. John drew the analogy of a modern file system, implementing a serial access interface (streams) on top of random-access primitives. For now, we support only random access, but suggest that the provider looks for patterns of access.

Appendix E. References

1. XMLA: XML for Analysis Specification, version 1.1.

Appendix F. Change log

  • Rename OlapResultSet to CellSet, OlapResultSetMetaData to CellSetMetaData, OlapResultAxis to CellSetAxis, ResultCell to Cell, ResultSetPosition to Position.
  • Removed class org.olap4j.metadata.Database; it was not adding much value over OlapDatabaseMetaData, and was confusing because Database is a synonym for Catalog in some servers.
  • Removed class Olap4j; unwrapping of Connections etc. is now provided using java.sql.Wrapper.unwrap.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 无法解析 org.olap4j:olap4j:0.9.7.309-js-3 的原因可能有几种。 首先,这个依赖项可能没有在你的工程的构建配置文件中正确地添加或声明。请确保在你的构建文件(例如Maven的pom.xml或Gradle的build.gradle)中添加了正确的依赖项。你可以检查一下依赖项的版本和组件ID是否正确,并且重建你的项目以确保依赖项被正确地解析和下载。 其次,这个依赖项可能位于一个不可访问的存储库中。有时候,由于网络问题或存储库配置错误,你可能无法访问到所需的依赖项。你可以检查一下你的构建配置文件中的存储库地址是否正确,并尝试手动访问该地址以确认是否可以下载依赖项。 最后,这个依赖项可能已被删除或不存在于所选的存储库中。有时,开发者可能会删除或重组他们的库,导致你无法再访问到特定版本的依赖项。在这种情况下,你可以尝试通过升级依赖项的版本或者在其他可靠的存储库中搜索相应的依赖项。 无论上述原因是什么,解决办法一般是检查依赖项的配置(版本、组件ID),确保正确添加依赖项,并确认存储库的可访问性。如果问题仍然存在,你可以搜索其他可用的替代依赖项或寻求其他开发者的帮助。 ### 回答2: 要解决"org.olap4j:olap4j:0.9.7.309-js-3"的问题,我们可以采取以下步骤: 1. 确认依赖项是否正确:请确保在项目的构建文件(例如pom.xml)中正确地添加了对"org.olap4j:olap4j:0.9.7.309-js-3"的依赖项。可以尝试手动添加该依赖项并保存文件。 2. 检查仓库配置:检查项目的仓库配置,确保可以访问到包含"org.olap4j:olap4j:0.9.7.309-js-3"的仓库。可能需要添加或更新仓库的URL或凭据。 3. 清理和重新构建项目:执行清理和重新构建项目的操作,以确保所有依赖项都能正确解析和下载。可以使用项目构建工具(如Maven或Gradle)的相关命令进行此操作。 4. 检查网络连接:确保计算机的网络连接正常。如果网络连接不稳定或受限制,则可能无法正确下载依赖项。可以尝试连接其他网络或重启网络设备。 5. 检查版本冲突:如果项目中存在其他依赖项与"org.olap4j:olap4j:0.9.7.309-js-3"存在版本冲突,可能会导致无法解析依赖项。可以尝试调整依赖项的版本或排除冲突的依赖项。 如果以上步骤仍然无法解决问题,请进一步检查可能的错误信息或日志,以获取更多详细信息,并尝试在相关的开发者社区或论坛上寻求帮助。 ### 回答3: 无法解析 org.olap4j:olap4j:0.9.7.309-js-3 是指在构建项目时出现了无法解析的错误,该错误通常是由于项目的依赖关系配置不正确或无法找到所需的库文件所引起的。 首先,需要检查项目的pom.xml文件,确保以下内容正确配置: 1. 确保在<dependencies>标签内有正确的依赖关系声明,例如: ```xml <dependency> <groupId>org.olap4j</groupId> <artifactId>olap4j</artifactId> <version>0.9.7.309-js-3</version> </dependency> ``` 2. 确保在<repositories>标签内配置了正确的镜像仓库或远程仓库地址,例如: ```xml <repositories> <repository> <id>central</id> <url>http://repo.maven.apache.org/maven2</url> </repository> </repositories> ``` 3. 如果项目中有使用到特殊的仓库或代理,需要确保代理配置正确,并且能够访问到所需的库文件。 如果以上配置都正确无误,但仍然无法解析该库文件,可能是由于该库文件在所配置的仓库中不存在或已被删除。此时,可以尝试更新库文件的版本号,或在其他可用的仓库中搜索该库文件的最新版本。 如果以上方法都无法解决问题,建议尝试从其他渠道获取该库文件,并手动将其添加到项目的类路径中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值