Package oracle.olapi.data.source

Examples of oracle.olapi.data.source.Source


    println("Selecting a Range With NumberParameter Objects");

    // Get the MdmMeasure for units sold.
    MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");
    // Get the Source for the measure.
    Source units = mdmUnits.getSource();

    // Get the dimensions of the measure and the default hierarchies of
    // the dimensions.
    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
    MdmLevelHierarchy mdmProdDefLvlHier = (MdmLevelHierarchy)
                                           mdmProdDim.getDefaultHierarchy();

    MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
    MdmLevelHierarchy mdmTimeDefLvlHier = (MdmLevelHierarchy)
                                           mdmTimeDim.getDefaultHierarchy();

    MdmPrimaryDimension mdmChanDim = getMdmPrimaryDimension("CHANNEL_AW");
    MdmLevelHierarchy mdmChanDefLvlHier = (MdmLevelHierarchy)
                                           mdmChanDim.getDefaultHierarchy();

    MdmPrimaryDimension mdmCustDim = getMdmPrimaryDimension("CUSTOMER_AW");
    MdmLevelHierarchy mdmCustDefLvlHier = (MdmLevelHierarchy)
                                           mdmCustDim.getDefaultHierarchy();

    // Get the Source objects for the hierarchies.
    StringSource prodHier = (StringSource) mdmProdDefLvlHier.getSource();
    StringSource timeHier = (StringSource) mdmTimeDefLvlHier.getSource();
    StringSource chanHier = (StringSource) mdmChanDefLvlHier.getSource();
    StringSource shipHier = (StringSource) mdmCustDefLvlHier.getSource();

    // Get the DataProvider.
    ExpressDataProvider dp = getExpressDataProvider();

    // Create NumberParameter objects for the starting and ending values
    // of the range.
    NumberParameter startParam = new NumberParameter(dp, 1);
    NumberParameter endParam = new NumberParameter(dp, 6);

    // Create parameterized Source objects.
    NumberSource startParamSrc = dp.createParameterizedSource(startParam);
    NumberSource endParamSrc = dp.createParameterizedSource(endParam);

    // Specify a set of positions of the products dimension using the
    // parameterized Source objects.
    Source paramProdSelInterval = prodHier.interval(startParamSrc,
                                                    endParamSrc);
    // Get the short description attribute for the Product dimension and
    // get the Source for the attribute.
    MdmAttribute mdmProdShortDescr =
                               mdmProdDim.getShortValueDescriptionAttribute();
    Source prodShortDescr = mdmProdShortDescr.getSource();

    // Join the selected products to the short descriptions.
    Source paramProdSelIntervalShortDescr =
                                    prodShortDescr.join(paramProdSelInterval);

    // Join units to selected values from three of the dimensions.
    // These join shortcuts hide the output.
    // Join the parameterized Source, also.
View Full Code Here


    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
    MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
                                    mdmProdDim.getDefaultHierarchy();
    StringSource prodHier = (StringSource) mdmProdHier.getSource();
    Source prodSel = prodHier.selectValue("PRODUCT_PRIMARY_AW::FAMILY_AW::5");

    MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
    MdmLevelHierarchy mdmTimeHier = (MdmLevelHierarchy)
                                     mdmTimeDim.getDefaultHierarchy();
    StringSource timeHier = (StringSource) mdmTimeHier.getSource();

    MdmLevel mdmQuarterLevel = getContext().getLevelByName(mdmTimeHier,
                                                           "QUARTER_AW");
    Source quarterLevel = mdmQuarterLevel.getSource();

    NumberSource unitPriceMovingTotal =
                                       unitPrice.movingTotal(mdmTimeHier, 0, 3);


    Source measuresDim = getExpressDataProvider().createListSource(new Source[]
                                                        {unitPrice,
                                                         unitPriceMovingTotal});
   
    Source movingTotalResult = measuresDim.extract()
                                          .join(measuresDim)
                                          .join(quarterLevel)
                                          .joinHidden(prodSel);

    prepareAndCommit();
View Full Code Here

        getMdmPrimaryDimension("CHANNEL_AW").getDefaultHierarchy().getSource();
    StringSource timeHier = (StringSource)
        getMdmPrimaryDimension("TIME_AW").getDefaultHierarchy().getSource();

    // Select single values for the hierarchies.
    Source prodSel = prodHier.selectValue("PRODUCT_PRIMARY_AW::ITEM_AW::15");
    Source custSel = custHier.selectValue("SHIPMENTS_AW::SHIP_TO_AW::52");
    Source timeSel = timeHier.selectValue("CALENDAR_YEAR_AW::MONTH_AW::55");

    // Produce a Source that specifies the units values for the selected
    // dimension values.
    Source unitsSel = units.join(timeSel).join(custSel).join(prodSel);

    // Create aliases for the Channel dimension hierarchy.
    Source chanAlias1 = chanHier.alias();
    Source chanAlias2 = chanHier.alias();

    // Join the aliases to the Source representing the units values specified
    // by the selected dimension elements, using the value method to make the
    // alias an input.
    NumberSource unitsSel1 = (NumberSource) unitsSel.join(chanAlias1.value());
    NumberSource unitsSel2 = (NumberSource) unitsSel.join(chanAlias2.value());

    // chanAlias2 is the first output of result, so its values are the row
    // (slower varying) values; chanAlias1 is the second output of result
    // so its values are the column (faster varying) values.
    Source result = unitsSel1.gt(unitsSel2)
                             .join(chanAlias1)    // Output 2, column
                             .join(chanAlias2);   // Output 1, row

    prepareAndCommit();
    getContext().displayResult(result);
View Full Code Here

    StringSource mktSegment = (StringSource)mdmMarketSegment.getSource();

    // Get the ancestors attribute of the hierarchy and the Source for it.
    MdmAttribute mdmMarketSegmentAncestorsAttr =
                                    mdmMarketSegment.getAncestorsAttribute();
    Source mktSegmentAncestors = mdmMarketSegmentAncestorsAttr.getSource();

    // Reverse the ancestors relation to get the descendants relation.
    Source mktSegmentDescendants =
              mktSegment.join(mktSegmentAncestors, mktSegment.value());

    // Select an element of the hierarchy.
    Source selVal = mktSegment.selectValue("MARKET_SEGMENT_AW::ACCOUNT_AW::23");

    // Select the descendants of the specified element.
    Source selValDescendants = mktSegmentDescendants.join(mktSegment,
                                                          selVal,
                                                          false);
    // Append the descedants to the selected element, using distinct
    // to remove any duplicate elements.
    Source selValPlusDescendants = selVal.appendValues(selValDescendants)
                                         .distinct();

    // Do the same append operation without using distinct.
    Source selValPlusDescendantsWithoutDistinct =
                                      selVal.appendValues(selValDescendants);
    prepareAndCommit();
    getContext().displayResult(selValPlusDescendants);
    println();
    getContext().displayResult(selValPlusDescendantsWithoutDistinct);
View Full Code Here

    StringSource mktSegment = (StringSource)mdmMarketSegment.getSource();

    // Get the ancestors attribute of the hierarchy and the Source for it.
    MdmAttribute mdmMarketSegmentAncestorsAttr =
                                     mdmMarketSegment.getAncestorsAttribute();
    Source mktSegmentAncestors = mdmMarketSegmentAncestorsAttr.getSource();

    // Reverse the ancestors relation to get the descendants relation.
    Source mktSegmentDescendants =
              mktSegment.join(mktSegmentAncestors, mktSegment.value());

    // Select an element of the hierarchy.
    Source selVal = mktSegment.selectValue("MARKET_SEGMENT_AW::ACCOUNT_AW::23");

    // Create a descendants relation that removes the input value.
    Source mktSegmentDescendantsOnly =
        mktSegmentDescendants.join(mktSegmentDescendants.getDataType().value(),
                                   mktSegment.value(),
                                   Source.COMPARISON_RULE_REMOVE);

    // Select the descendants of the specified element.
    Source selValDescendants = mktSegmentDescendants.join(mktSegment, selVal);

    // Select only the descendants of the specified element.
    Source selValDescendantsOnly = mktSegmentDescendantsOnly.join(mktSegment,
                                                                  selVal);

    prepareAndCommit();
    getContext().displayResult(selValDescendants);
    println();
View Full Code Here

                mdmProdDim.getShortValueDescriptionAttribute();
    MdmAttribute mdmTimeShortDescrAttr =
                mdmTimeDim.getShortValueDescriptionAttribute();

    // Get the Source objects for the attributes.
    Source prodShortDescr = mdmProdShortDescrAttr.getSource();
    Source timeShortDescr = mdmTimeShortDescrAttr.getSource();

    // Get the default hierarchies of the dimensions and their Source objects.
    MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
                                     mdmProdDim.getDefaultHierarchy();
    MdmLevelHierarchy mdmTimeHIer = (MdmLevelHierarchy)
                                     mdmTimeDim.getDefaultHierarchy();
    Source prodHier = mdmProdHier.getSource();
    StringSource timeHier = (StringSource) mdmTimeHIer.getSource();

    // Get the FAMILY level of the hierarchy and the Source for it.
      MdmLevel mdmFamilyLevel =
                     getContext().getLevelByName(mdmProdHier, "FAMILY_AW");
      Source prodSel = mdmFamilyLevel.getSource();

    // Join the family elements to the product short description attribute.
    Source prodSelWithShortDescr = prodShortDescr.join(prodSel);

    // Select the May, 2001.
    Source timeSel = timeHier.selectValue("CALENDAR_YEAR_AW::MONTH_AW::59");

    // Join the time selection to the time short description attribute.
    Source timeSelWithShortDescr = timeShortDescr.join(timeSel);


    Source result =
                 prodSelWithShortDescr.join(unitPrice,
                                            unitPrice.getDataType(),
                                            Source.COMPARISON_RULE_DESCENDING,
                                            true)
                                      .join(timeSelWithShortDescr);
View Full Code Here

    // Get the default hierarchy of the dimension.
    MdmLevelHierarchy mdmTimeHier = (MdmLevelHierarchy)
                                     mdmTimeDim.getDefaultHierarchy();

    // Get the Source objects for the level attribute and the hierarchy.
      Source levelRel = mdmTimeLevelAttr.getSource();
      StringSource timeHier = (StringSource) mdmTimeHier.getSource();

    // Create a Source array containing the TIME levels.
    Source[] levelSources = new Source[3];
    List levels = mdmTimeHier.getLevels();
    for (int i = 0; i < levelSources.length; i++)
    {
      levelSources[i] = ((MdmLevel) levels.get(i)).getSource();
    }
    // Create a list Source that has the levels as element values.
    Source levelList = dp.createListSource(levelSources);

    // Create a Source that selects the elements of a level and has
    // levelList as an input.
    Source levelMembers = timeHier.join(levelRel, levelList.value());

    // Create a range Source that specifies all elements after the first and
    // before the last.
    Source range = dp.createRangeSource(2, levelMembers.count().minus(1));

    // Remove all level elements except the first and the last.
    Source firstAndLast = levelMembers.join(levelMembers.position(),
                                            range,
                                            Source.COMPARISON_RULE_REMOVE,
                                            true);
   
    // Match the levels to the input of firstAndLast.
    Source result = firstAndLast.join(levelList);

    prepareAndCommit();
    getContext().displayResult(result);

  }
View Full Code Here

        getMdmPrimaryDimension("CHANNEL_AW").getDefaultHierarchy().getSource();
    StringSource timeHier = (StringSource)
        getMdmPrimaryDimension("TIME_AW").getDefaultHierarchy().getSource();

    // Select values for the hierarchies.
    Source prodSel = prodHier.selectValues(new String[]
                                           {"PRODUCT_PRIMARY_AW::ITEM_AW::13",
                                            "PRODUCT_PRIMARY_AW::ITEM_AW::14",
                                            "PRODUCT_PRIMARY_AW::ITEM_AW::15"});
   Source chanSel = chanHier.selectValue("CHANNEL_PRIMARY_AW::CHANNEL_AW::2");
   //Source timeSel = timeHier.selectValue("CALENDAR_YEAR_AW::YEAR_AW::3");
   Source timeSel = timeHier.selectValue("CALENDAR_YEAR_AW::MONTH_AW::59");
   Source custSel = custHier.selectValue("SHIPMENTS_AW::TOTAL_CUSTOMER_AW::1");

   Source measDim = dp.createListSource(new Source[] {unitPrice, units, sales});

   Source result = measDim.extract().join(measDim)
                                    .join(prodSel)
                                    .join(timeSel)
                                    .join(chanSel)
                                    .join(custSel);
View Full Code Here

                                             {"SHIPMENTS_AW::SHIP_TO_AW::60",
                                              "SHIPMENTS_AW::SHIP_TO_AW::61",
                                              "SHIPMENTS_AW::SHIP_TO_AW::62",
                                              "SHIPMENTS_AW::SHIP_TO_AW::63"});
    // Select a subset of the selection.
    Source custSel2 = custSel.selectValues(new String[]
                                             {"SHIPMENTS_AW::SHIP_TO_AW::60",
                                              "SHIPMENTS_AW::SHIP_TO_AW::62"});

    // Join the selection to itself, using the subset as the comparison.
    Source result1 = custSel.join(custSel, custSel2, true);

    // Join the selection to the result of the value method, using the subset
    // as the comparison.
    Source  result2 = custSel.join(custSel.value(), custSel2, true);

    // Prepare and commit the Transaction.
    prepareAndCommit();

    // Display the results.
View Full Code Here

    NumberSource units = (NumberSource) mdmUnits.getSource();

    // Get the parent attribute of the PRODUCT dimension and the Source for it
    // to use in the recursiveJoin method.
    MdmAttribute mdmProdParentAttr = mdmProdHier.getParentAttribute();
    Source prodParent = mdmProdParentAttr.getSource();

    // Get the short value description attribute and its Source.
    MdmAttribute mdmProdShortDescrAttr =
                                mdmProdDim.getShortValueDescriptionAttribute();
    Source prodShortDescr = mdmProdShortDescrAttr.getSource();

    // Select the Direct Sales channel, the year 2001, and all customers.
    Source chanSel = chanHier.selectValue("CHANNEL_PRIMARY_AW::CHANNEL_AW::2");
    Source timeSel = timeHier.selectValue("CALENDAR_YEAR_AW::YEAR_AW::4");
    Source custSel = custHier.selectValue("SHIPMENTS_AW::TOTAL_CUSTOMER_AW::1");

    // Sort all products hierarchically in ascending order of units sold,
    // with parents first.
    Source sortedProduct =
                      prodHier.recursiveJoin(units,
                                             units.getDataType(),
                                             prodParent,
                                             Source.COMPARISON_RULE_ASCENDING,
                                             true,  // Parents first
                                             true); // Restrict parents to base

    // Get the short value description of the products.
    Source sortedProductShortDescr = prodShortDescr.join(sortedProduct);

    // Produce a Source that has the units sold measure data as its element
    // values and sortedProductShortDescr as its output.
    // Since the other dimensions are all single values, use joinHidden so
    // the are not outputs of the result.

    Source result = units.join(sortedProductShortDescr)
                         .joinHidden(custSel)
                         .joinHidden(chanSel)
                         .joinHidden(timeSel);

    // Prepare and commit the current Transaction.
View Full Code Here

TOP

Related Classes of oracle.olapi.data.source.Source

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.