|
Oracle® OLAP Java API Reference 11g Release 1 (11.1) B28128-01 |
Some aspects of the Oracle OLAP Java API are much the same as in previous releases, such as the ability to create queries with classes in the oracle.olapi.data.source
package and to retrieve the data with classes in the oracle.olapi.data.cursor
package. However, in Oracle OLAP 11g Release 1 (11.1) the API has many new features. The major new features include the abilities to do the following:
Persistant Metadata Objects
The Oracle OLAP Java API now has the ability to create and maintain persistent metadata objects. The Oracle Database stores the metadata objects in the Oracle data dictionary.
An application maps the metadata objects to relational structures in an Oracle Database instance or to expressions that provide a data source. The application can deploy the metadata as relational OLAP (ROLAP) objects or it can deploy the metadata in an analytic workspace. For information on the advantages of the deployment types, see Oracle OLAP User's Guide.
To provide this new functionality, the Oracle OLAP Java API substantially revises the metadata model. The new model includes several new packages and has significant changes to some existing packages. For example, the oracle.olapi.metadata.mdm
package has many new classes. It also has many new methods added to existing classes.
An application creates most metadata objects with findOrCreate methods of the owning object. For example, the following code finds the MdmStandardDimension
named PRODUCTS_AWJ
or creates a standard dimension with that name if it does not already exist. The mdmDBSchema
object is the MdmDatabaseSchema
that owns the dimension.
MdmStandardDimension prodDim = mdmDBSchema.findOrCreateStandardDimension("PRODUCTS_AWJ");
Some classes and methods are deprecated in the new model. For example, all of the classes in the oracle.olapi.metadata.mtm
package are deprecated, and methods of other classes that use the mtm
classes are also deprecated. Some mtm
classes mapped transient mdm
objects to relational database structures, such as columns in tables and views. Other mtm
specified how Oracle OLAP performed operations such as aggregation or allocation of the values of custom measures. That functionality is replaced by classes in the oracle.olapi.metadata
subpackages deployment
, mapping
, and mdm
, and the oracle.olapi.syntax
package. With the new classes, an application can create permanent metadata objects, map them to data sources, and specify the operations that provide values for measures.
Restrict Access To Metatdata Objects
Because the metadata objects exist in the Oracle data dictionary, an Oracle Database DBA can restrict access to certain types of the metadata objects. A client application can set such restrictions by sending SQL commands, using the JDBC API, through the JDBC connection for the user session.
Define and Build Analytic Workspaces
An application can now define, build, and maintain analytic workspaces. This new functionality is provided by classes in the oracle.olapi.metadata
subpackages deployment
, mapping
, and mdm
, and the oracle.olapi.syntax
package. This functionality replaces the Oracle OLAP Analytic Workspace Java API, which is entirely deprecated in this release.
SQL Expression Syntax
With the classes in the oracle.olap.syntax
package, an application can create Java objects that are based on SQL expresssions, functions, operators, and conditions. The SyntaxObject
class has static methods that an application can use to convert SQL expressions into Java objects or to get the SQL syntax from a Java object.
An application can create the Java objects by using the SyntaxObject.fromSyntax
method or by using a constructor. For example, the following example creates a StringExpression
using a fromSyntax
method and another StringExpression
using a constructor method. The mp
object is the MdmMetadataProvider
for the session.
Note that the string in the fromSyntax
method is enclosed in single quotation marks inside the double quotation marks because the string is a SQL string literal. The single quotation marks are not required when using the constructor for a StringExpression
.
The example then calls the getValue
method on both StringExpression
objects and displays the values returned. It also calls the toSyntax
method on one StringExpression
and displays the result.
StringExpression exp = (StringExpression) SyntaxObject.fromSyntax("'Hello world from syntax.'", mp); StringExpression strExp = new StringExpression("Hello world using constructor."); println(exp.getValue() + " Ouput of exp.getValue()."); println(strExp.getValue() + " Ouput of strExp.getValue()."); println(strExp.toSyntax()+ " Ouput of strExp.toSyntax().");
The output of the code is the following:
Hello world from syntax. Ouput of exp.getValue(). Hello world using constructor. Ouput of strExp.getValue(). 'Hello world using constructor.' Ouput of strExp.toSyntax().
Multiple Sessions Sharing a Connection
Another new feature is the ability to have multiple user sessions that share the same JDBC connection to the Oracle Database instance and that share the same cache of metadata objects. This ability is provided by the UserSession
class in the oracle.olapi.session
package.
Cost-Based Aggregation
Cost-based aggregation optimizes the aggregation and storage of summary data for a cube. The optimization can produce faster refresh and query operation performance.
Cost-based aggregation automatically determines the aggregate data within a cube to precompute and to store. It calculates the cost of computing the aggregate data in the cube and determines if it is better to precalculate the data and store it or to allow Oracle OLAP to calculate the data dynamically (on the fly).
An application can specify a percentage of the measure values that Oracle OLAP precomputes for a compressed cube. For a compressed and partitioned cube, an application can also specify the percentage of values to precompute for the top level of the partitioned dimension. When Oracle OLAP aggregates the measure values for the cube, it optimizes the aggregation based on the percentages specified. See the methods of the AWCubeOrganization
class that get and set the percentage for precomputing.
For descriptions of features that were new in previous releases, see New Features in Previous Releases.