|
Oracle® OLAP Java API Reference 10g Release 2 (10.2) B14348-01 |
The Oracle OLAP Java API Reference and Oracle OLAP Developer's Guide to the OLAP API contain many examples of the use of OLAP API classes and their methods. Those examples are usually not complete programs.
This document contains links to complete programs that contain the code from the examples in the Oracle OLAP Developer's Guide to the OLAP API and to some of the examples in the Oracle OLAP Java API Reference. The programs use the OLAP Catalog metadata objects for the Global Schema for Documentation. You can add these programs to your Java development environment and run them if the programs can connect to an Oracle Database instance with the OLAP option that has the Global schema and its OLAP Catalog metadata.
Most of the programs use the Context10g
and CursorPrintWriter
classes. Those classes connect to the Oracle database, get metadata objects, and display the results of the queries that the examples create. Copy the Context10g.java
and CursorPrintWriter.java
files and any of the following example programs to your Java development environment.
The SampleMetadataDiscoverer10g.java
program does not use the Context10g
program. Instead, it uses the MyConnection10g.java
class to make a connection to an Oracle Database instance.
The programs that connect to the database use command line arguments that specify the server and the database instance to which you want to connect, and the username and password to use for the connection. See the comments in the Context10g
or the MyConnection10g.java
files for information on the command line arguments required.
The following file has the complete code for the example in the description of the full signature of the Source.recursiveJoin
method, and has examples of other signatures of recursiveJoin
and of some related Source
methods such as selectDescendants
and sortDescendingHierarchically
.
RecursiveJoinAndShortcutsExamples.java
The examples that appear in the Oracle OLAP Developer's Guide to the OLAP API are in the following files, which are listed by chapter.
This chapter does not have any examples.
File Name | Example |
---|---|
ElementsOfMdmAttribute.java |
A program that creates a custom MdmAttribute for product colors and retrieves the data displayed in the table in the "Elements of an MdmAttribute" section. |
CreateCustomDimensionMember.java |
Example 2-1, Creating a Custom Member of a Dimension. |
GettingDataTypeOfMdmSource.java |
Example 2-2, Getting the Data Type of an MdmSource. |
GettingTypeOfMdmSource.java |
Example 2-3, Getting the Type of an MdmSource. |
CreateCustomMeasureDimensionMember.java |
Example 2-4, Creating a Custom Member of the MdmMeasureDimension. |
The code for most of the examples in this chapter is used in the Context10g.java
and the MyConnection10g.java
programs to create a connection to an Oracle Database instance. The complete code for Example 3-5 and Example 3-6 is in the following files.
File Name | Example |
---|---|
GettingExistingConnection.java |
Example 3-5, Getting an Existing Connection. |
ExecutingDMLCommands.java |
Example 3-6, Executing DML Commands. |
The following files are the program which is Example 4-9, Discovering the OLAP Catalog Metadata, and a class it uses to connect to an Oracle Database instance.
File Name | Example |
---|---|
SampleMetadataDiscoverer10g.java |
Example 4-9, Discovering the OLAP Catalog Metadata. |
MyConnection10g.java |
Class used by SampleMetadataDiscoverer10g to make the connection to an Oracle Database instance. |
File Name | Example |
---|---|
GettingColumnsForLevel.java |
Example 5-1, Getting the Columns for an MtmLevelHierarchyMap. |
GettingColumnsForMeasure.java |
Example 5-3, Getting the Columns for an MdmMeasure. |
CreatingCustomMeasure.java |
Example 5-4, Creating A Custom Measure. |
File Name | Example |
---|---|
UnderstandingSourceObjects.java |
The following examples, and two informal examples, are implemented as methods of this class: Example 6-1, Getting the Data Type of a Source. Example 6-2, Using the isSubtypeOf Method. Example 6-3, Using the join Method To Produce a Source Without an Output. Example 6-4, Using the join Method To Produce a Source With an Output. Example 6-5, Using the join Method To Match Source Objects To Inputs. Example 6-6, Using Shortcuts. Example 6-7, Matching the Base Source to an Input of the Joined Source. Example 6-8, Matching an Input of the Base Source to an Output of the Joined Source. Example 6-9, Matching the Inputs of a Measure and Producing Outputs. |
UsingParamSourceWithMeasDim.java |
Example 6-10, Using a Parameterized Source With a Measure Dimension. |
ImplementingExtractAsACustomModel.java |
Example 6-11, Implementing the extract Method as a CustomModel. |
CreateDependentAssignment.java |
Example 6-12, Creating an Assignment That Depends on Another Assignment. |
CreateCustomMemberWithAggVal.java |
Example 6-13, Creating a Custom Member That Assigns an Aggregated Value. |
CreateColorAttribute.java |
A class that creates a custom color MdmAttribute for the Product dimension. This class is used by CreateCustomMemberWithAggVal.java . |
File Name | Example |
---|---|
MakingQueriesExamples.java |
The following examples are implemented as methods of this class: Example 7-1, Controlling Input-to-Source Matching With the alias Method. Example 7-2, Using the distinct Method. Example 7-3, Using COMPARISON_RULE_REMOVE. Example 7-4, Using COMPARISON_RULE_DESCENDING. Example 7-5, Selecting the First and Last Time Elements. Example 7-7, Selecting a Subset of the Elements of a Source. Example 7-8, Using the extract Method. Example 7-11, Hierarchical Sorting by Measure Value. |
SortingHierarchicallyByAttribute.java |
Example 7-6, Sorting Products Hierarchically by Color. |
CreatingCubeAndPivotingEdges.java |
Example 7-9, Creating a Cube and Pivoting Its Edges. |
DrillingInHierarchy.java |
Example 7-10, Drilling in a Hierarchy. |
GettingShareOfUnits.java |
Example 7-12, Getting the Share of Units Sold. |
RankingProductsByUnitsSold.java |
Example 7-13, Ranking Products by Units Sold. |
UsingLagMethod.java |
Example 7-14, Using the Lag Method. |
UsingMovingTotalMethod.java |
Example 7-15, Using the movingTotal Method. |
SelectingRangeWithNumberParam.java |
Example 7-16, Selecting a Range With NumberParameter Objects. |
File Name | Example |
---|---|
TransactionExamples.java |
The following examples are implemented as methods of this class: Example 8-1, Rolling Back a Transaction. Example 8-2, Using Child Transaction Objects. |
File Name | Example |
---|---|
CursorConceptsExamples.java |
The following examples, and an informal example, are implemented as methods of this class: Example 9-1, Creating the querySource Query. Example 9-2, Setting the CompoundCursor Position and Getting the Current Values. Example 9-3, Positions in an Asymmetric Query. |
File Name | Example |
---|---|
RetrievingQueryResults.java |
The following examples are implemented as methods of this class: Example 10-1, Creating a Cursor. Example 10-2, Getting a Single Value from a ValueCursor. Example 10-3, Getting All of the Values from a ValueCursor. Example 10-4, Getting ValueCursor Objects from a CompoundCursor example. Example 10-5, Getting Values from a CompoundCursor with Nested Outputs example. Example 10-6, Navigating For a Table View. Example 10-7, Navigating For a Crosstab View Without Pages. Example 10-8, Navigating For a Crosstab View With Pages. Example 10-9, Getting CursorSpecification Objects from a CursorManagerSpecification. Example 10-10, Specifying the Calculation of the Extent of a Cursor. Example 10-11, Specifying the Calculation of Starting and Ending Positions in a Parent. Example 10-12, Calculating the Span of the Positions in the Parent of a Value. Example 10-13, Specifying a Fetch Size. |
Example 11-1 in this chapter is the TopBottomTemplate
class. Example 11-2 and Example 11-3 are inner classes of TopBottomTemplate
.
File Name | Example |
---|---|
TopBottomTemplate.java |
Example 11-1, Implementing a Template. Example 11-2, Implementing a MetadataState. Example 11-3, Implementing a SourceGenerator. |
TopBottomTest.java |
Example 11-4, Getting the Source Produced by the Template. |
SingleSelectionTemplate.java |
A Template that is used by TopBottomTest.java . |