| Oracle® OLAP Java API Reference 11g Release 1 (11.1) |
This documentation and Oracle OLAP Java API Developer's Guide contain examples that demonstrate the use of OLAP Java API classes.
The complete code for many of the examples is available in the examples.zip
file, which
you can get from the Oracle Technology Network (OTN) Web site at
http://www.oracle.com/technology/products/bi/olap/olap.html.
The example programs use metadata objects that are based on tables of a schema in the relational database. The schema is owned by the GLOBAL user. From the OTN Web site, you can also download the SQL scripts that create the GLOBAL user and install the Global schema.
You can add the example program classes to your Java development environment and compile and run them if the programs can connect to an Oracle Database instance with the OLAP option that has the Global schema installed.
The example programs are in a package organization that you can import into an integrated developement environment such as Oracle JDeveloper.
Most of the programs are the complete code for the examples in Oracle OLAP Java API Developer's Guide.
The example program classes are in a structure that indicates the package of API classes that they exemplify.
Extracting the contents of the examples.zip
file creates the following directory structure.
examples src oracle olapi examples cursor metadata source template transaction
In the remainder of this document, the references to the directory structure begin with the examples.src.oracle.olapi.examples
directory.
The following table lists the classes that are in the examples
directory.
These classes are used by all of the example programs.
Class | Description |
---|---|
BaseExample11g
|
The base class for all of the example programs. Some of the methods of this class do the following:
|
Context11g
|
An instance of this class is created by a BaseExample11g .
This class has methods that do the following:
This class also has convenience methods for getting metadata objects from the |
CursorPrintWriter
|
A PrintWriter that has methods for displaying the values of a Cursor in various formats.
|
Logger
|
This class encapsulates the logging of output generated by an example program. |
BuildAW11g
program.
It creates metadata objects and builds an analytic workspace.
Most of the other example programs use the objects created by this program.
Package | Class | Description |
---|---|---|
metadata
|
BuildAW11g
|
A program that defines metadata objects, maps them to the Global schema, deploys them to an analytic workspace, writes the metadata object definitions to an XML file, and builds the analytic workspace. Most of the other OLAP Java API example programs query that analytic workspace. |
Package | Class | Description |
---|---|---|
source
|
RecursiveJoinAndShortcutsExamples
|
This class has the complete code for the examples in the descriptions of the full signature of the Source.recursiveJoin method, of other signatures of recursiveJoin , and of some related Source methods such as selectDescendants and sortDescendingHierarchically .
|
source
|
SourceExamplesInRef
|
This class has the complete code for examples in some of the classes in the oracle.olapi.data.source package.
|
Package | Class | Description |
---|---|---|
metadata
|
ElementsOfMdmAttribute
|
Creates a query that produces the results that appear in the table in the "MdmAttribute Class" section. |
metadata
|
GettingDataTypeOfMdmSource
|
Example 2-1, Getting the Data Type of an MdmSource. |
metadata
|
GettingTypeOfMdmSource
| Example 2-2, Getting the Type of an MdmSource. |
Package | Class | Description |
---|---|---|
metadata |
ConnectAndDiscover |
Example 3-1, Getting a JDBC OracleConnection. Example 3-2, Creating a DataProvider. Example 3-3, Closing the Connection. Example 3-4, Creating an MdmMetadataProvider. Example 3-5, Getting the MdmSchema Objects Example 3-6, Getting a Single MdmDatabaseSchema. Example 3-7, Getting the Dimensions and Measures of an MdmDatabaseSchema. Example 3-8, Getting the Dimensions and Measures of an MdmCube. Example 3-9, Getting the Hierarchies and Levels of a Dimension. Example 3-10, Getting the MdmAttribute Objects of an MdmPrimaryDimension. Example 3-11, Getting a Primary Source for a Metadata Object. |
CreateMetadataAndAW
program, which contains the code for the examples, is a subset of the BuildAW11g
program, simplified for use as examples in the documentation. Both programs first delete the GLOBALAW analytic workspace if it exists and then define and build the analytic workspace.
Note: All of the examples from the other chapters use the analytic workspace created by the BuildAW11g
program. If you run the CreateMetadataAndAW
program, be sure to run the BuildAW11g
program before running any of the other example programs.
Package | Class | Description |
---|---|---|
metadata |
CreateMetadataAndAW |
Example 4-1, Creating an AW. Example 4-2, Creating and Deploying an MdmStandardDimension. Example 4-3, Creating and Mapping an MdmDimensionLevel. Example 4-4, Creating and Mapping MdmLevelHierarchy and MdmHierarchyLevel Objects. Example 4-5, Creating an MdmBaseAttribute. Example 4-6, Creating and Mapping an MdmCube. Example 4-7, Creating and Mapping Measures. Example 4-8, Committing Transactions. Example 4-9, Exporting to an XML Template. Example 4-10, Building an Analytic Workspace. |
Package | Class | Description |
---|---|---|
source |
UnderstandingSourceObjects |
The following examples, and two informal untitled examples, are implemented as methods of this class.
Example 5-1, Getting the Data Type of a Source. |
source |
UsingParamSourceWithMeasDim |
Example 5-10, Using a Parameterized Source With a Measure Dimension. |
source |
ImplementingExtractAsACustomModel |
Example 5-11, Implementing the extract Method as a CustomModel. |
Package | Class | Description |
---|---|---|
source |
MakingQueriesExamples |
The following examples are implemented as methods of this class.
Example 6-1, Controlling Input-to-Source Matching With the alias Method. |
source |
SortingHierarchicallyByAttribute |
Example 6-6, Sorting Products Hierarchically By Attribute. |
source |
CreatingCubeAndPivotingEdges |
Example 6-9, Creating a Cube and Pivoting Its Edges. |
source |
DrillingInHierarchy |
Example 6-10, Drilling in a Hierarchy. |
source |
GettingShareOfUnits |
Example 6-12, Getting the Share of Units Sold. |
source |
UsingLagMethod |
Example 6-13, Using the Lag Method. |
source |
UsingMovingTotalMethod |
Example 6-14, Using the movingTotal Method. |
source |
SelectingRangeWithNumberParam |
Example 6-15, Selecting a Range With NumberParameter Objects. |
Package | Class | Description |
---|---|---|
transaction |
TransactionExamples |
The following examples are implemented as methods of this class.
Example 7-1, Rolling Back a Transaction. |
Package | Class | Description |
---|---|---|
cursor |
CursorConceptsExamples |
The following examples, and an informal example, are implemented as methods of this class.
Example 8-1, Creating the querySource Query. |
Package | Class | Description |
---|---|---|
cursor |
RetrievingQueryResults |
The following examples are implemented as methods of this class.
Example 9-1, Creating a Cursor. |
Package | Class | Description |
---|---|---|
template |
TopBottomTemplate |
Example 10-1, Implementing a Template.
The following examples are implemented as inner classes of
Example 10-2, Implementing a MetadataState. |
template |
TopBottomTest |
Example 10-4, Getting the Source Produced by the Template. |
template |
SingleSelectionTemplate |
A Template that is used by TopBottomTest . |