diff --git a/.classpath b/.classpath index e37c0c5..9393271 100644 --- a/.classpath +++ b/.classpath @@ -1,8 +1,29 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.properties b/build.properties index d12a9f9..293e3bc 100644 --- a/build.properties +++ b/build.properties @@ -10,13 +10,20 @@ # See also 'test.properties', which contains settings for the regression # suite. # - -# Location of mondrian source tree. Property is needed only if you wish to run -# the olap4j test suite against the mondrian olap4j driver. -#mondrian.dir=/absolute/path/mondrian - # Uncomment to use yDoc doclet for enhanced javadoc (requires commercial # license). #ydoc.home=/usr/local/ydoc-2.2_03-jdk1.5 +project.revision=0.9.8-SNAPSHOT +ivy.artifact.id=olap4j +ivy.artifact.group=org.olap4j +impl.title=olap4j + +test.path_to_db=D:/MesDocuments/workspaces/OLAP4J-ivyfication/OLAP4J-trunk/foodmart/foodmart +test.db_name=foodmart + +javadoc.packagenames=org.olap4j.* + +build.dir=build + # End build.properties diff --git a/build.xml b/build.xml index d471c08..be5ee11 100644 --- a/build.xml +++ b/build.xml @@ -1,610 +1,333 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ============================================================== - | olap4j configuration info | - ============================================================== - project.location = ${project.location} - jdk.home = ${env.JAVA_HOME} - junit.dir = ${junit.dir} - ============================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/buildJdk16.bat b/buildJdk16.bat index 850ddb1..5ab8df8 100755 --- a/buildJdk16.bat +++ b/buildJdk16.bat @@ -5,11 +5,13 @@ rem built under JDK 1.6. rem Change the following line to point to your JDK 1.6 home. set JAVA_HOME=C:\jdk1.6.0_11 +rem set JAVA_HOME=C:\java\jdk1.6.0_13 rem Change the following line to point to your ant home. set ANT_HOME=C:\open\thirdparty\ant +rem set ANT_HOME=C:\ant\ant-1.7.0 set PATH=%JAVA_HOME%\bin;%PATH% -%ANT_HOME%\bin\ant compile.java +%ANT_HOME%\bin\ant compile.compile # End buildJdk16.bat diff --git a/buildJdk16.sh b/buildJdk16.sh index a3cd350..ce45087 100755 --- a/buildJdk16.sh +++ b/buildJdk16.sh @@ -5,6 +5,6 @@ # Change the following line to point to your JDK 1.6 home. export JAVA_HOME=/usr/local/jdk1.6.0_01 export PATH=$JAVA_HOME/bin:$PATH -ant compile.java +ant compile.compile # End buildJdk16.sh diff --git a/checkFile.sh b/checkFile.sh new file mode 100644 index 0000000..81ba0cf --- /dev/null +++ b/checkFile.sh @@ -0,0 +1,345 @@ +#!/bin/bash +# $Id: //open/util/bin/checkFile#10 $ +# Checks that a file is valid. +# Used by perforce submit trigger, via runTrigger. +# The file is deemed to be valid if this command produces no output. +# +# Usage: +# checkFile [ --depotPath ] +# +# runTrigger uses first form, with a temporary file, e.g. +# checkFile --depotPath /tmp/foo.txt //depot/src/foo/Bar.java +# +# The second form is useful for checking files in the client before you +# try to submit them: +# checkFile src/foo/Bar.java +# + +usage() { + echo "checkFile [ ] --depotPath " + echo " Checks a temporary file. depotPath is the full path of" + echo " the file stored in perforce, for error reporting; file" + echo " holds the actual file contents." + echo "checkFile [ ] ..." + echo " Checks a list of files." + echo "checkFile [ ] --opened" + echo " Checks all files that are opened for edit in the current" + echo " perforce client." + echo "checkFile --help" + echo " Prints this help." + echo + echo "Options:" + echo "--lenient" + echo " Does not apply rules to components which are not known to" + echo " be in compliance. The perforce trigger uses this option." +} + +doCheck() { + filePath="$1" + file="$2" + + # CHECKFILE_IGNORE is an environment variable that contains a callback + # to decide whether to check this file. The command or function should + # succeed (that is, return 0) if checkFile is to ignore the file, fail + # (that is, return 1 or other non-zero value) otherwise. + if [ "$CHECKFILE_IGNORE" ]; then + if eval $CHECKFILE_IGNORE "$filePath"; then + return + fi + fi + + # Exceptions for mondrian + case "$filePath" in + */mondrian/util/Base64.java| \ + */mondrian/olap/MondrianDef.java| \ + */mondrian/gui/MondrianGuiDef.java| \ + */mondrian/xmla/DataSourcesConfig.java| \ + */mondrian/rolap/aggmatcher/DefaultDef.java| \ + */mondrian/resource/MondrianResource.java| \ + */mondrian/olap/Parser.java| \ + */mondrian/olap/ParserSym.java) + # mondrian.util.Base64 is checked in as is, so don't check it + # Other files above are generated. + return + ;; + + # Exceptions for olap4j + */org/olap4j/mdx/parser/impl/*.java| \ + */org/olap4j/mdx/parser/impl/*.cup| \ + */org/olap4j/impl/Base64.java) + return + ;; + + # Only validate .java and .cup files at present. + *.java|*.cup|*.h|*.cpp) + ;; + *) + return + ;; + esac + + # Check whether there are tabs, or lines end with spaces + # todo: check for ' ;' + # todo: check that every file has copyright/license header + # todo: check that every class has javadoc + # todo: check that every top-level class has @author and @version + # todo: check c++ files + cat "$file" | + awk ' +function error(fname, linum, msg) { + printf "%s: %d: %s\n", fname, linum, msg; + if (0) print; # for debug +} +function matchFile(fname) { + return fname ~ "/mondrian/" \ + || fname ~ "/org/olap4j/" \ + || fname ~ "/aspen/" \ + || fname ~ "/com/sqlstream/" \ + || !lenient; +} +function isCpp(fname) { +#print "isCpp(" fname ") = " (fname ~ /\.(cpp|h)$/); + return fname ~ /\.(cpp|h)$/; +} +function push(val) { + switchStack[switchStackLen++] = val; +} +function pop() { + --switchStackLen + val = switchStack[switchStackLen]; + delete switchStack[switchStackLen]; + return val; +} +BEGIN { + # pre-compute regexp for single-quoted strings + apos = sprintf("%c", 39); + pattern = apos "(\\" apos "|[^" apos "])*" apos; +} +{ + if (previousLineEndedInBrace > 0) { + --previousLineEndedInBrace; + } + s = $0; + # replace strings + gsub(/"(\\"|[^"])*"/, "string", s); + # replace single-quoted strings + gsub(pattern, "string", s); + if (inComment && $0 ~ /\*\//) { + # end of multiline comment "*/" + inComment = 0; + gsub(/^.*\*\//, "/* comment */", s); + } else if (inComment) { + s = "/* comment */"; + } else if ($0 ~ /\/\*/ && $0 !~ /\/\*.*\*\//) { + # beginning of multiline comment "/*" + inComment = 1; + gsub(/\/\*.*$/, "/* comment */", s); + } else { + # mask out /* */ comments + gsub(/\/\*.*$/, "/* comment */", s); + } + # mask out // comments + gsub(/\/\/.*$/, "// comment", s); +} +/ $/ { + error(fname, FNR, "Line ends in space"); +} +/[\t]/ { + error(fname, FNR, "Tab character"); +} +s ~ /\.*;$/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else { + error(fname, FNR, "if followed by statement on same line"); + } +} +s ~ /\<(if|while|for|switch|catch|do|synchronized)\(/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else if (s !~ /( )+(if|while|for|switch|synchronized|assert|} catch|do)/) { + error(fname, FNR, "if/while/for/switch/synchronized/catch/do must be correctly indented"); + } else { + error(fname, FNR, "if/while/for/switch/synchronized/catch/do must be followed by space"); + } +} +s ~ /\/ { + push(switchCol); + switchCol = index($0, "switch"); +} +s ~ /{/ { + braceCol = index($0, "{"); + if (braceCol == switchCol) { + push(switchCol); + } +} +s ~ /}/ { + braceCol = index($0, "}"); + if (braceCol == switchCol) { + switchCol = pop(); + } +} +s ~ /\<(case|default)\>/ { + caseDefaultCol = match($0, /case|default/); + if (!matchFile(fname)) {} # todo: enable for farrago + else if (caseDefaultCol != switchCol) { + error(fname, FNR, "case/default must be aligned with switch"); + } +} +s ~ /\/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else if (isCpp(fname) && s ~ /^# *else$/) {} # ignore "#else" + else if (s !~ /( )+} else (if |{$|{ *\/\/|{ *\/\*)/) { + error(fname, FNR, "else must be preceded by } and followed by { or if and correctly indented"); + } +} +s ~ /\/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else if (s !~ /( )+try {/) { + error(fname, FNR, "try must be followed by space {, and correctly indented"); + } +} +s ~ /\/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else if (s !~ /( )+} catch /) { + error(fname, FNR, "catch must be preceded by }, followed by space, and correctly indented"); + } +} +s ~ /\/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else if (s !~ /( )+} finally {/) { + error(fname, FNR, "finally must be preceded by }, followed by space {, and correctly indented"); + } +} +s ~ /[]A-Za-z0-9()](+|-|\*|\/|%|=|==|+=|-=|\*=|\/=|>|<|>=|<=|!=|&|&&|\||\|\||^|\?|:) *[A-Za-z0-9(]/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else if (s ~ /<.*>/) {} # ignore templates + else if (s ~ /\(-/) {} # ignore case "foo(-1)" + else if (s ~ /[eE][+-][0-9]/) {} # ignore e.g. 1e-5 + else if (s ~ /(case.*|default):$/) {} # ignore e.g. "case 5:" + else if (isCpp(fname) && s ~ /[^ ][*&]/) {} # ignore e.g. "Foo* p;" in c++ - debatable + else if (isCpp(fname) && s ~ /\|<|>=|<=|!=|&|&&|\||\|\||^|\?|:)[A-Za-z0-9(]/ { + if (!matchFile(fname)) {} # todo: enable for farrago + else if (s ~ /<.*>/) {} # ignore templates + else if (s ~ /(\(|return |case |= )-/) {} # ignore prefix - + else if (s ~ /(case.*|default):$/) {} # ignore e.g. "case 5:" + else if (s ~ /[eE][+-][0-9]/) {} # ignore e.g. 1e-5 + else if (isCpp(fname) && s ~ /[*&][^ ]/) {} # ignore e.g. "Foo *p;" in c++ + else if (isCpp(fname) && s ~ /\ - - - -olap4j Specification - - - - - -

olap4j Specification

- -

Authors: Julian Hyde, Barry Klawans
-Version: 0.9.5 (beta)
-Revision: $Id$ -(log)
-Last modified: March 25th, 2008.

-
- -

Contents

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

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 org.olap4j.*;
-
- Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
- OlapConnection connection =
-    DriverManager.getConnection(
-        "jdbc:mondrian:local: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();
-
- OlapResult result =
-    statement.execute(
-        "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 besides the driver class and connect -string, the code is identical.

- -
- import org.olap4j.*;
-
- Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
- OlapConnection 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 result =
-     statement.execute(
-         "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 org.apache.commons.dbcp.*;
- import org.olap4j.*;
-
- GenericObjectPool connectionPool =
-    new GenericObjectPool(null);
- ConnectionFactory connectionFactory =
-    new DriverManagerConnectionFactory(
-        - "jdbc:mondrian:local:Jdbc=jdbc:odbc:MondrianFoodMart;" +
-        - "Catalog=/WEB-INF/queries/FoodMart.xml;" +
-        "Role='California manager'")
- 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,

- -
- // Create a query model.
- SelectNode query = new SelectNode();
- query.setFrom(
-    new IdentifierNode(
-        new - IdentifierNode.Segment("Sales")));
- query.getAxisList().add(
-    new AxisNode(
-        false,
-        new CallNode(
-            "{}",
-            - Syntax.Braces,
-            new - IdentifierNode(
-                - new IdentifierNode.Segment("Measures"),
-                - new IdentifierNode.Segment("Unit Sales"))),
-        Axis.ROWS,
-        new ArrayList<IdentifierNode>()));
-
- // 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_CATALOGS - DatabaseMetaData.getCatalogs - Catalog
not supported - - DatabaseMetaData.getSchemas - Schema
DBSCHEMA_COLUMNSnot supportednot supported
DBSCHEMA_PROVIDER_TYPESnot supportednot supported
DBSCHEMA_TABLESnot supportednot supported
DBSCHEMA_TABLES_INFOnot supportednot supported
DISCOVER_DATASOURCES - - OlapDatabaseMetaData.getDatasources - not supported
DISCOVER_ENUMERATORSnot supportednot supported
DISCOVER_KEYWORDS - - OlapDatabaseMetaData.getMdxKeywords - not supported
DISCOVER_LITERALS - - OlapDatabaseMetaData.getLiterals - not supported
DISCOVER_PROPERTIES - - OlapDatabaseMetaData.getDatabaseProperties - not supported
DISCOVER_SCHEMA_ROWSETSnot supportednot supported
MDSCHEMA_ACTIONS - - OlapDatabaseMetaData.getActions - not supported
MDSCHEMA_CUBES - - OlapDatabaseMetaData.getCubes - Cube
MDSCHEMA_DIMENSIONS - - OlapDatabaseMetaData.getDimensions - Dimension
MDSCHEMA_FUNCTIONS - - OlapDatabaseMetaData.getFunctions - not supported
MDSCHEMA_HIERARCHIES - - OlapDatabaseMetaData.getHierarchies - Hierarchy
MDSCHEMA_INPUT_DATASOURCESnot supportednot supported
MDSCHEMA_KPISnot supportednot supported
MDSCHEMA_LEVELS - - OlapDatabaseMetaData.getLevels - Level
MDSCHEMA_MEASURES - - OlapDatabaseMetaData.getMeasures - Measure
MDSCHEMA_MEMBERS - - OlapDatabaseMetaData.getMembers - Member
MDSCHEMA_PROPERTIES - - OlapDatabaseMetaData.getProperties - Property
MDSCHEMA_SETS - - OlapDatabaseMetaData.getSets - NamedSet
- -

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_MODEString - Specification 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.
  • -
- -
- - + + + + +olap4j Specification + + + + + +

olap4j Specification

+ +

Authors: Julian Hyde, Barry Klawans
+Version: 0.9.5 (beta)
+Revision: $Id: olap4j_fs.html 97 2008-06-09 11:33:50Z jhyde $ +(log)
+Last modified: March 25th, 2008.

+
+ +

Contents

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

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 org.olap4j.*;
+
+ Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
+ OlapConnection connection =
+    DriverManager.getConnection(
+        "jdbc:mondrian:local: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();
+
+ OlapResult result =
+    statement.execute(
+        "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 besides the driver class and connect +string, the code is identical.

+ +
+ import org.olap4j.*;
+
+ Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
+ OlapConnection 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 result =
+     statement.execute(
+         "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 org.apache.commons.dbcp.*;
+ import org.olap4j.*;
+
+ GenericObjectPool connectionPool =
+    new GenericObjectPool(null);
+ ConnectionFactory connectionFactory =
+    new DriverManagerConnectionFactory(
+        + "jdbc:mondrian:local:Jdbc=jdbc:odbc:MondrianFoodMart;" +
+        + "Catalog=/WEB-INF/queries/FoodMart.xml;" +
+        "Role='California manager'")
+ 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,

+ +
+ // Create a query model.
+ SelectNode query = new SelectNode();
+ query.setFrom(
+    new IdentifierNode(
+        new + IdentifierNode.Segment("Sales")));
+ query.getAxisList().add(
+    new AxisNode(
+        false,
+        new CallNode(
+            "{}",
+            + Syntax.Braces,
+            new + IdentifierNode(
+                + new IdentifierNode.Segment("Measures"),
+                + new IdentifierNode.Segment("Unit Sales"))),
+        Axis.ROWS,
+        new ArrayList<IdentifierNode>()));
+
+ // 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_CATALOGS + DatabaseMetaData.getCatalogs + Catalog
not supported + + DatabaseMetaData.getSchemas + Schema
DBSCHEMA_COLUMNSnot supportednot supported
DBSCHEMA_PROVIDER_TYPESnot supportednot supported
DBSCHEMA_TABLESnot supportednot supported
DBSCHEMA_TABLES_INFOnot supportednot supported
DISCOVER_DATASOURCES + + OlapDatabaseMetaData.getDatasources + not supported
DISCOVER_ENUMERATORSnot supportednot supported
DISCOVER_KEYWORDS + + OlapDatabaseMetaData.getMdxKeywords + not supported
DISCOVER_LITERALS + + OlapDatabaseMetaData.getLiterals + not supported
DISCOVER_PROPERTIES + + OlapDatabaseMetaData.getDatabaseProperties + not supported
DISCOVER_SCHEMA_ROWSETSnot supportednot supported
MDSCHEMA_ACTIONS + + OlapDatabaseMetaData.getActions + not supported
MDSCHEMA_CUBES + + OlapDatabaseMetaData.getCubes + Cube
MDSCHEMA_DIMENSIONS + + OlapDatabaseMetaData.getDimensions + Dimension
MDSCHEMA_FUNCTIONS + + OlapDatabaseMetaData.getFunctions + not supported
MDSCHEMA_HIERARCHIES + + OlapDatabaseMetaData.getHierarchies + Hierarchy
MDSCHEMA_INPUT_DATASOURCESnot supportednot supported
MDSCHEMA_KPISnot supportednot supported
MDSCHEMA_LEVELS + + OlapDatabaseMetaData.getLevels + Level
MDSCHEMA_MEASURES + + OlapDatabaseMetaData.getMeasures + Measure
MDSCHEMA_MEMBERS + + OlapDatabaseMetaData.getMembers + Member
MDSCHEMA_PROPERTIES + + OlapDatabaseMetaData.getProperties + Property
MDSCHEMA_SETS + + OlapDatabaseMetaData.getSets + NamedSet
+ +

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_MODEString + Specification 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.
  • +
+ +
+ + diff --git a/doc/olap4j_fs.pdf b/doc/olap4j_fs.pdf old mode 100755 new mode 100644 diff --git a/foodmart/FoodMart.xml b/foodmart/FoodMart.xml new file mode 100644 index 0000000..9449b44 --- /dev/null +++ b/foodmart/FoodMart.xml @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+ + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + +"fname" || ' ' || "lname" + + +fname + ' ' + lname + + +"fname" || ' ' || "lname" + + +CONCAT(`customer`.`fname`, ' ', `customer`.`lname`) + + +fname + ' ' + lname + + +"customer"."fullname" + + +CONCAT(CONCAT("customer"."fname", ' '), "customer"."lname") + + +"fname" || ' ' || "lname" + + +"fname" || ' ' || "lname" + + +"fname" + + + + +"fname" || ' ' || "lname" + + +fname + ' ' + lname + + +"fname" || ' ' || "lname" + + +CONCAT(`customer`.`fname`, ' ', `customer`.`lname`) + + +fname + ' ' + lname + + +"customer"."fullname" + + +CONCAT(CONCAT("customer"."fname", ' '), "customer"."lname") + + +"fname" || ' ' || "lname" + + +"fname" + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + + + + + + + +Iif("sales_fact_1997"."promotion_id" = 0, 0, "sales_fact_1997"."store_sales") + + +(case when "sales_fact_1997"."promotion_id" = 0 then 0 else "sales_fact_1997"."store_sales" end) + + +(case when "sales_fact_1997"."promotion_id" = 0 then 0 else "sales_fact_1997"."store_sales" end) + + +(case when `sales_fact_1997`.`promotion_id` = 0 then 0 else `sales_fact_1997`.`store_sales` end) + + + +`sales_fact_1997`.`store_sales` + + +(case when "sales_fact_1997"."promotion_id" = 0 then 0 else "sales_fact_1997"."store_sales" end) + + +(case when "sales_fact_1997"."promotion_id" = 0 then 0 else "sales_fact_1997"."store_sales" end) + + +(case when "sales_fact_1997"."promotion_id" = 0 then 0 else "sales_fact_1997"."store_sales" end) + + +(case when "sales_fact_1997"."promotion_id" = 0 then 0 else "sales_fact_1997"."store_sales" end) + + + + + [Measures].[Store Sales] - [Measures].[Store Cost] + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +`warehouse_sales` - `inventory_fact_1997`.`warehouse_cost` + + +`warehouse_sales` - `inventory_fact_1997`.`warehouse_cost` + + +"warehouse_sales" - "inventory_fact_1997"."warehouse_cost" + + + + + [Measures].[Warehouse Sales] / [Measures].[Warehouse Cost] + + + + TopCount([Warehouse].[Warehouse Name].MEMBERS, 5, [Measures].[Warehouse Sales]) + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+
+ + + + + + + +
+ + + + + + + +
+ + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +"fname" || ' ' || "lname" + + +fname + ' ' + lname + + +"fname" || ' ' || "lname" + + +CONCAT(`customer`.`fname`, ' ', `customer`.`lname`) + + +fname + ' ' + lname + + +"customer"."fullname" + + +CONCAT(CONCAT("customer"."fname", ' '), "customer"."lname") + + +"fname" || ' ' || "lname" + + +"fname" + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + [Measures].[Store Sales] - [Measures].[Store Cost] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Measures].[Profit] / [Measures].[Units Shipped] + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/foodmart/foodmart.zip b/foodmart/foodmart.zip new file mode 100644 index 0000000..7e69f2e Binary files /dev/null and b/foodmart/foodmart.zip differ diff --git a/ivy.xml b/ivy.xml new file mode 100644 index 0000000..55ec7b5 --- /dev/null +++ b/ivy.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ivysettings.xml b/ivysettings.xml new file mode 100644 index 0000000..7395ee6 --- /dev/null +++ b/ivysettings.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/asm-2.2.3.jar b/lib/asm-2.2.3.jar deleted file mode 100755 index 2c47471..0000000 Binary files a/lib/asm-2.2.3.jar and /dev/null differ diff --git a/lib/asm-commons-2.2.3.jar b/lib/asm-commons-2.2.3.jar deleted file mode 100755 index fac3140..0000000 Binary files a/lib/asm-commons-2.2.3.jar and /dev/null differ diff --git a/lib/javacup.jar b/lib/javacup.jar deleted file mode 100755 index ea472da..0000000 Binary files a/lib/javacup.jar and /dev/null differ diff --git a/lib/log4j-1.2.9.jar b/lib/log4j-1.2.9.jar deleted file mode 100755 index a6568b0..0000000 Binary files a/lib/log4j-1.2.9.jar and /dev/null differ diff --git a/lib/pdfdoclet-1.0.2-all.jar b/lib/pdfdoclet-1.0.2-all.jar deleted file mode 100755 index 2a20915..0000000 Binary files a/lib/pdfdoclet-1.0.2-all.jar and /dev/null differ diff --git a/lib/retroweaver-1.2.4.jar b/lib/retroweaver-1.2.4.jar deleted file mode 100755 index 7673209..0000000 Binary files a/lib/retroweaver-1.2.4.jar and /dev/null differ diff --git a/lib/retroweaver-rt-1.2.4.jar b/lib/retroweaver-rt-1.2.4.jar deleted file mode 100755 index 1b90533..0000000 Binary files a/lib/retroweaver-rt-1.2.4.jar and /dev/null differ diff --git a/lib/xercesImpl.jar b/lib/xercesImpl.jar deleted file mode 100755 index a35953b..0000000 Binary files a/lib/xercesImpl.jar and /dev/null differ diff --git a/simple-jndi/jdbc.properties b/simple-jndi/jdbc.properties new file mode 100644 index 0000000..8f78f19 --- /dev/null +++ b/simple-jndi/jdbc.properties @@ -0,0 +1,5 @@ +SampleData/type=javax.sql.DataSource +SampleData/driver=org.hsqldb.jdbcDriver +SampleData/url=jdbc:hsqldb:file:foodmart/foodmart +SampleData/user=sa +SampleData/password= \ No newline at end of file diff --git a/src/org/olap4j/Axis.java b/src/org/olap4j/Axis.java index c7561ef..558f569 100644 --- a/src/org/olap4j/Axis.java +++ b/src/org/olap4j/Axis.java @@ -9,7 +9,6 @@ */ package org.olap4j; -import java.io.Serializable; import java.util.Locale; /** @@ -25,7 +24,7 @@ * @version $Id$ * @since Oct 23, 2006 */ -public interface Axis extends Serializable { +public interface Axis { /** * @deprecated Will be removed before olap4j 1.0. diff --git a/src/org/olap4j/mdx/IdentifierNode.java b/src/org/olap4j/mdx/IdentifierNode.java index 26ec3bd..123edd8 100644 --- a/src/org/olap4j/mdx/IdentifierNode.java +++ b/src/org/olap4j/mdx/IdentifierNode.java @@ -12,7 +12,6 @@ import org.olap4j.impl.Olap4jUtil; import org.olap4j.type.Type; -import java.io.Serializable; import java.util.*; /** @@ -313,7 +312,7 @@ static void quoteMdxIdentifier( * To parse an identifier into a list of segments, use the method * {@link IdentifierNode#parseIdentifier(String)}.

*/ - public static class Segment implements Serializable { + public static class Segment { final String name; final IdentifierNode.Quoting quoting; private final ParseRegion region; diff --git a/src/org/olap4j/mdx/ParseRegion.java b/src/org/olap4j/mdx/ParseRegion.java index a61a661..cf0b116 100644 --- a/src/org/olap4j/mdx/ParseRegion.java +++ b/src/org/olap4j/mdx/ParseRegion.java @@ -9,8 +9,6 @@ */ package org.olap4j.mdx; -import java.io.Serializable; - /** * Region of parser source code. * @@ -34,7 +32,7 @@ * @version $Id$ * @author jhyde */ -public class ParseRegion implements Serializable { +public class ParseRegion { private final int startLine; private final int startColumn; private final int endLine; diff --git a/src/org/olap4j/mdx/ParseTreeNode.java b/src/org/olap4j/mdx/ParseTreeNode.java index a0e92e7..2c5851e 100644 --- a/src/org/olap4j/mdx/ParseTreeNode.java +++ b/src/org/olap4j/mdx/ParseTreeNode.java @@ -9,7 +9,6 @@ */ package org.olap4j.mdx; -import java.io.Serializable; import org.olap4j.type.Type; /** @@ -22,7 +21,7 @@ * @version $Id$ * @since Jun 4, 2007 */ -public interface ParseTreeNode extends Serializable { +public interface ParseTreeNode { /** * Accepts a visitor to this MDX parse tree node. * diff --git a/subfloor.xml b/subfloor.xml new file mode 100644 index 0000000..548a155 --- /dev/null +++ b/subfloor.xml @@ -0,0 +1,1695 @@ + + + + + +------------------------------------------------------------------------------- + subfloor.xml provides tasks needed to perform a project build. + It is typically not used directly but imported by each project's build.xml + file. The build.xml file can override tasks when customization is required. + +MAIN TARGETS +============ + * clean / clean-all : + remove all artifacts of the build, clean-all adds the removal + of any library or jar dependencies downloaded as part of the build + + * resolve : + download/refresh library or jar dependencies needed for the build (uses Apache IVY) + + * compile : + run javac on the project's source + + * jar : + creates a jar file + + * dist : + creates all project distributables + + * test : + runs JUnit tests from your project's test source + +SPECIAL TARGETS +============ + * publish-local : + builds a jar for your project and registers it with the local artifact repository isolated + to your machine at $HOME/.ivy2/local. Further executions of the the resolve target by this + or other projects will find your published jar. + + * ivy-clean* : + this family of targets helps reset your IVY environment in the event that you are having + difficulty resolving dependencies + +TYPICAL TARGET SEQUENCE +============ + * clean-all resolve dist : + a good start to build all project distributables from scratch. Note that jar dependencies + will not be downloaded unless you explicitly run the resolve target. We made the resolution + and retrieval completely discretionary since there are many situations in which + you will not want to get or refresh dependencies, e.g. if you are offline with no Internet + access. In such case, you could just run "dist" if the set of jars you already have are + sufficient. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test.properties.example b/test.properties.example index 38d9e7f..11b4bb4 100644 --- a/test.properties.example +++ b/test.properties.example @@ -6,30 +6,46 @@ # All Rights Reserved. # You must accept the terms of that agreement to use this software. # +########################################################################################## # Sample "test.properties" file. Rename to "test.properties" and modify # for your environment. +# +# SPECIAL NOTE. +# If the TCK is launched within Ant, the default amount of memory that +# is allowed for Ant won't do the job. There are lots of OLAP operations +# to perform and it is strongly suggested to give at lease 1 gig of ram +# to Ant in order to run properly. You can easily achieve this by setting +# ANT_OPTS environment variable to "-Xmx1024m". +########################################################################################## + -# Connect string olap4j test suite should use to connect to the foodmart -# database. Examples are shown for mondrian connecting to Apache Derby on -# Linux, Oracle on Linux, and Microsoft Access on Windows. Must be specified; -# there is no default. -#org.olap4j.test.connectUrl=jdbc:mondrian:Jdbc='jdbc:derby:/home/jvs/open/mondrian/demo/derby/foodmart';JdbcUser=sa;JdbcPassword=sa;Catalog='file:///home/jvs/open/mondrian/demo/FoodMart.xml';JdbcDrivers=org.apache.derby.jdbc.EmbeddedDriver; -#org.olap4j.test.connectUrl=jdbc:mondrian:Jdbc=jdbc:oracle:thin:foodmart/foodmart@//marmalade.hydromatic.net:1521/XE;JdbcUser=foodmart;JdbcPassword=foodmart;Catalog=../mondrian/demo/FoodMart.xml;JdbcDrivers=oracle.jdbc.OracleDriver; -#org.olap4j.test.connectUrl=jdbc:mondrian:Jdbc='jdbc:odbc:MondrianFoodMart';Catalog='file://c:/open/mondrian/demo/FoodMart.xml';JdbcDrivers=sun.jdbc.odbc.JdbcOdbcDriver; +########################################################################################## +# Olap4j comes with a hsqldb ready testing database. +# The current value doesn't need any adjustments and should work +# ok in most environments. Note that this connection +# requires ANT to run with more memory. You can +# do that by setting the ANT_OPTS environment variable to "-Xmx1024m" +########################################################################################## +org.olap4j.test.connectUrl=jdbc:mondrian:Datasource=jdbc/SampleData;Catalog=./foodmart/FoodMart.xml; + +########################################################################################## +# Path to the FoodMart.xml catalog file. The Xmla tester needs this. +# Must be specified if you are using XmlaTester; there is no default. +# Olap4j comes with a schema file located under the "foodmart directory, +# so the current value doesn't need to be updated nd should be ok with most +# environments. +########################################################################################## +org.olap4j.XmlaTester.CatalogUrl=file:foodmart/FoodMart.xml +########################################################################################## # Name of class which targets the olap4j test suite to a particular driver # implementation. Must implement org.olap4j.test.TestContext.Tester interface. # Default is "org.olap4j.MondrianTester"; # to test the XMLA driver, use "org.olap4j.XmlaTester". -#org.olap4j.test.helperClassName=org.olap4j.XmlaTester +# This is the only property you might need to adjust depending on what +# component you want to test. +########################################################################################## #org.olap4j.test.helperClassName=org.olap4j.MondrianTester - -# Path to the FoodMart.xml catalog file. -# Must be specified if you are using XmlaTester; there is no default. -#org.olap4j.XmlaTester.CatalogUrl=file:/a/path/mondrian/demo/FoodMart.xml - -# Classpath for your JDBC driver. Only required if the driver isn't already on -# the classpath. -#org.olap4j.test.driverClasspath=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/jdbc/lib/ojdbc14.jar +org.olap4j.test.helperClassName=org.olap4j.XmlaTester # End test.properties.example diff --git a/testlib/commons-dbcp.jar b/testlib/commons-dbcp.jar deleted file mode 100644 index c3c4d1f..0000000 Binary files a/testlib/commons-dbcp.jar and /dev/null differ diff --git a/testlib/commons-pool.jar b/testlib/commons-pool.jar deleted file mode 100644 index c61bde6..0000000 Binary files a/testlib/commons-pool.jar and /dev/null differ diff --git a/testlib/junit.jar b/testlib/junit.jar deleted file mode 100755 index 674d71e..0000000 Binary files a/testlib/junit.jar and /dev/null differ diff --git a/testlib/servlet.jar b/testlib/servlet.jar deleted file mode 100755 index bc0dea0..0000000 Binary files a/testlib/servlet.jar and /dev/null differ diff --git a/testsrc/jndi.properties b/testsrc/jndi.properties new file mode 100644 index 0000000..352f861 --- /dev/null +++ b/testsrc/jndi.properties @@ -0,0 +1,4 @@ +java.naming.factory.initial=org.osjava.sj.SimpleContextFactory +org.osjava.sj.root=simple-jndi/ +org.osjava.sj.jndi.shared=true +org.osjava.sj.delimiter=/ \ No newline at end of file