Skip Headers
Oracle® Application Server Personalization Programmer's Guide
10g Release 2 (10.1.2)
B14051-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

3 REAPI Supporting Classes

This chapter describes the supporting classes for the REProxy class. These classes are used to create instances of the objects used by the methods described in Chapter 4. You may be able to create one instance of many of these classes and use that one instance as an argument for several calls.

All methods described in this chapter are public.

The supporting classes are divided into two categories:

This chapter does not contain detailed descriptions of any of the classes. For detailed information, see the Javadoc in the OracleAS Personalization section of the Oracle Application Server 10g Documentation Library.

3.1 Ratings in OracleAS Personalization

Ratings in OracleAS Personalization are in "ascending order of goodness", that is, the higher the rating, the more the user prefers the item. Low rated items are items that the user does not prefer. OracleAS Personalization algorithms use these assumptions, so it is important that ratings are in ascending order of goodness.

3.2 Location of REAPI Classes

The following classes are in the oracle.dmt.op.re.base package:

To use the Enum interfaces, you must include the following statement in your Java program:

   import oracle.dmt.op.re.base.Enum;

3.3 REAPI EnumType Interfaces

Many of the REAPI methods reference attributes that can take on a finite number of values. The interface Enum is used to implement the base class for these enumerated constants.

The Enum interface has a nested EnumType class with the following general methods:

   int getId()

   String toString()

   String getName()

   boolean isEqual(EnumType)

The following interfaces extend EnumType:

3.3.1 REAPI CategoryMembership Interface

CategoryMembershipType is implemented as:

  • CategoryMembershipType (a class that extends EnumType)

  • CategoryMembership (an interface)

The class CategoryMembership has the following methods:

   CategoryMemberShipType getType(String name)

   CategoryMemberShipType getType(int)

CategoryMembership specifies how categories in a list of categories should be applied for filtering. For example, Enum.CategoryMembership.EXCLUDE_ITEMS specifies that items from the categories in the category list should be excluded from the recommendations list. For details, see Section 3.4.3, "FilteringSettings Class" later in this chapter.

CategoryMembership takes on the following values:

  • Enum.CategoryMembership.EXCLUDE_ITEMS

  • Enum.CategoryMembership.INCLUDE_ITEMS

  • Enum.CategoryMembership.EXCLUDE_CATEGORIES

  • Enum.CategoryMembership.INCLUDE_CATEGORIES

  • Enum.CategoryMembership.LEVEL

  • Enum.CategoryMembership.SUBTREE_ITEMS

  • Enum.CategoryMembership.SUBTREE_CATEGORIES

  • Enum.CategoryMembership.ALL_ITEMS

  • Enum.CategoryMembership.ALL_CATEGORIES

The following statement assigns Enum.CategoryMembership.LEVEL to the variable myEnum:

   CategoryMembershipType myEnum = Enum.CategoryMembership.LEVEL 

3.3.2 REAPI DataSource Interface

DataSource is implemented as:

  • DataSourceType (a class that extends EnumType)

  • DataSource (an interface)

The class DataSourceType has the following methods:

   DataSourceType getType(String name)

   DataSourceType getType(int)

DataSource specifies what information is used to influence recommendations. A Web application can choose what data to take into account when making recommendations using this interface. For example, Enum.DataSource.DEMOGRAPHIC specifies that demographic data should be considered in the production of recommendations. The class Section 3.4.2, "DataItem Class", described later in this chapter, uses DataSource. Note that a given method may not support all values of DataSource. For details, see the description of the methods in Chapter 4.

DataSource takes on the following values:

  • Enum.DataSource.DEMOGRAPHIC

  • Enum.DataSource.PURCHASING

  • Enum.DataSource.RATING

  • Enum.DataSource.NAVIGATION

  • Enum.DataSource.ALL

The following statement assigns Enum.DataSource.ALL to the variable myEnum:

   DataSourceType myEnum = Enum.DataSource.ALL;


Note:

For cross-sell recommendations, navigation data can only predict navigation behavior and purchasing data can only predict purchasing behaviour. Only navigation and purchasing data source types are supported for cross-sell recommendations.

3.3.3 REAPI Filtering Interface

Filtering is implemented as:

  • FilteringType (a class that extends EnumType)

  • Filtering (an interface)

The class FilteringType has the following methods:

   FilteringType getType(String name)

   FilteringType getType(int)

Filtering is used to turn filtering on or off. See the description of the Section 3.4.3, "FilteringSettings Class" later in this chapter for more information.

Filtering takes on the following values:

  • Enum.Filtering.ON

  • Enum.Filtering.OFF

The following statement assigns Enum.Filtering.OFF to the variable myEnum:

   FilteringType myEnum = Enum.Filtering.OFF;

3.3.4 REAPI InterestDimension Interface

InterestDimension is implemented as:

  • InterestDimensionType (a class that extends EnumType)

  • InterestDimension (an interface)

The class InterestDimensionType has the following methods:

   InterestDimensionType getType(String name)

   InterestDimensionType getType(int)

InterestDimension specifies the meaning of the recommendation values, or, in other words, what you are interested in predicting. See more details at Section 4.2.6.2, "Meaning of Returned Value for Recommendations". Compare this to DataSource, which specifies the type of data used to influence recommendations.

InterestDimension takes on the following values:

  • Enum.InterestDimension.NAVIGATION

    Predict how likely a visitor or customer is likely to click on items.

  • Enum.InterestDimension.PURCHASING

    Predict how likely a visitor or customer will purchase items.

  • Enum.InterestDimension.RATING

    Predict how a visitor or customer will rate an item.

The following statement assigns Enum.InterestDimension.PURCHASING to the variable myEnum:

   InterestDimension myEnum = Enum.InterestDimension.PURCHASING; 

3.3.5 REAPI PersonalizationIndex Interface

PersonalizationIndex is implemented as:

  • PersonalizationIndexType (a class that extends EnumType)

  • PersonalizationIndex (an interface)

The class PersonalizationIndexType has the following methods:

   PersonalizationIndexType getType(String name)

   PersonalizationIndexType getType(int)

PersonalizationIndex specifies how "unusual" the recommendations returned will be. For example, LOW specifies not unusual. For more information, see the description of the Section 3.4.10, "TuningSettings Class" later in this chapter.

PersonalizationIndex takes on the following values:

  • Enum.PersonalizationIndex.LOW

  • Enum.PersonalizationIndex.MEDIUM

  • Enum.PersonalizationIndex.HIGH

The following statement assigns Enum.PersonalizationIndex.LOW to the variable myEnum:

   PersonalizationIndexType myEnum = Enum.PersonalizationIndex.LOW; 

3.3.6 REAPI ProfileDataBalance Interface

ProfileDataBalance is implemented as:

  • ProfileDataBalanceType (a class that extends EnumType)

  • ProfileDataBalance (an interface)

The class ProfileDataBalanceType has the following methods:

   ProfileDataBalanceType getType(String name)

   ProfileDataBalanceType getType(int)

ProfileDataBalance specifies whether to take data from the current session or from history or to balance data between data from the current session and history when making recommendations. For more information, see the description of the Section 3.4.10, "TuningSettings Class" later in this chapter.

ProfileDataBalance takes on the following values:

  • Enum.ProfileDataBalance.HISTORY

  • Enum.ProfileDataBalance.BALANCED

  • Enum.ProfileDataBalance.CURRENT

The following statement assigns Enum.ProfileDataBalance.BALANCED to the variable myEnum:

   ProfileDataBalanceType myEnum = Enum.ProfileDataBalance.BALANCED;

3.3.7 REAPI ProfileUsage Interface

ProfileUsage is implemented as:

  • ProfileUsageType (a class that extends EnumType)

  • ProfileUsage (an interface)

The class ProfileUsageType has the following methods:

   ProfileUsageType getType(String name)

   ProfileUsageType getType(int)

ProfileUsage specifies whether the recommendation list can include or exclude items in a customer's profile. For more information, see the description of Section 3.4.10, "TuningSettings Class" later in this chapter.

ProfileUsage takes on the following values:

  • Enum.ProfileUsage.INCLUDE

  • Enum.ProfileUsage.EXCLUDE

The following statement assigns Enum.ProfileUsage.INCLUDE to the variable myEnum:

   ProfileUsageType myEnum = Enum.ProfileUsage.INCLUDE;

3.3.8 REAPI RecommendationAttribute Interface

RecommendationAttribute is implemented as:

  • RecommendationAttributeType (a class that extends EnumType)

  • RecommendationAttribute (an interface)

The class RecommendationAttributeType has the following methods:

   RecommendationAttributeType getType(String name)

   RecommendationAttributeType getType(int)

RecommendationAttribute indicates the attribute to be included in the returned content; possible choices are type, ID, and prediction. For more information, see the descriptions of the Section 3.4.1, "ContentItem Class" and Section 3.4.8, "RecommendationContent Class" later in this chapter.

RecommendationAttribute takes on the following values:

  • Enum.RecommendationAttribute.TYPE

  • Enum.RecommendationAttribute.ID

  • Enum.RecommendationAttribute.PREDICTION

The following statement assigns Enum.RecommendationAttribute.URL to the variable myEnum:

RecommendationAttributeType myEnum = Enum.RecommendationAttribute.TYPE;

3.3.9 REAPI Sorting Interface

Sorting is implemented as:

  • SortingType (a class that extends EnumType)

  • Sorting (an interface)

The class SortingType has the following methods:

   SortingType getType(String name)

   SortingType getType(int)

Sorting indicates whether sorting is done (none implies no sorting), and, if sorting is done, how it is done (ascending or descending). For more information, see the discussions of the Section 3.4.1, "ContentItem Class" and Section 3.4.8, "RecommendationContent Class" later in this chapter.

Sorting takes on the following values:

  • Enum.Sorting.NONE

  • Enum.Sorting.DESCENDING

  • Enum.Sorting.ASCENDING

The following statement assigns Enum.Sorting.NONE to the variable myEnum:

   SortingType myEnum = Enum.Sorting.NONE;

3.3.10 REAPI User Interface

User is implemented as:

  • UserType (a class that extends EnumType)

  • User (an interface)

The class UserType has the following methods:

   UserType getType(String name)

   UserType getType(int)

UserType is either customer, a registered user of the calling Web site, or visitor, an unregistered user. For more information see the description of the Section 3.4.4, "IdentificationData Class" later in this chapter.

UserType takes on the following values:

  • Enum.User.CUSTOMER

  • Enum.User.VISITOR

The following statement assigns Enum.User.CUSTOMER to the variable myEnum:

   UserTypeType myEnum = Enum.User.CUSTOMER;

3.4 Other Supporting REAPI Classes

The other supporting classes are

These classes are described briefly in this document. For detailed descriptions, see the Javadoc for OracleAS Personalization.

3.4.1 ContentItem Class

This class encapsulates the information that should be included in the object returned by a recommendation request. It describes the attributes to be included in the recommendation list returned by a call as well as specifying whether the list should be sorted according to one of the attributes. Section 3.4.8, "RecommendationContent Class", described later in this chapter, is any array of items of type ContentItem; the description of Section 3.4.8, "RecommendationContent Class" explains how sorting order works when multiple orders are specified.

This class contains the following methods:

  • getContentAttribute()

  • getSorting()

3.4.2 DataItem Class

This class is a subclass of class Item. It encapsulates data about an item. This object is used as an argument in the data collection methods addItem() and addItems().

There are two kinds of methods provided with this class:

  • A constructor for DataItem

  • Methods that return attribute values:

    • getDataSource()

    • getValue()

3.4.3 FilteringSettings Class

This class is used to specify the items to include or exclude when generating recommendations.

OracleAS Personalization supports category filtering only.

There are three kinds of methods provided with this class:

  • A constructor for FilteringSettings

  • Methods that set the attribute values:

    • setItemFiltering(int taxonomyID)

    • setItemFiltering(int taxonomyID, long[] categoryList)

    • setItemExclusion(int taxonomyID, long[] categoryList])

    • setItemSubTreeFiltering(int taxonomyID, long[] categoryList])

    • setCategoryExclusion(int taxonomyID, long[] categoryList])

    • setCategorySubTreeFiltering(int taxonomyID, long[] categoryList])

    • setCategoryLevelFiltering(int taxonomyID, long[] categoryList])

    • setCategoryFiltering(int taxonomyID)

    • setCategoryFiltering(int taxonomyID, long[] categoryList)

  • Methods that return attribute values:

    • getTaxonomyID()

    • getCategoryFiltering ()

    • getCategoryList()

    • getCategoryMembership()

Not all filtering settings can be used with all methods. In particular, the following filtering settings cannot be used with cross-sell methods:

  • setCategoryLevelFiltering

  • setCategorySubtreeFiltering

  • setCategoryExclusion

  • setCategoryFiltering(int)

  • setCategoryFiltering(int, long[])

3.4.4 IdentificationData Class

Identifies the user, the session, or both.

There are two kinds of methods provided with this class:

  • Methods that create IdentificationData instances

    • createSessionful(String appSessionID, UserType userType)

    • createSessionless(String appSessionID, UserType userType)

  • Methods that return attribute values:

    • getUserID()

    • getAppSessionID()

    • getUserType()

The calling Web application should assign a userID to all users, both customers (registered users) and visitors. IDs for customers must be unique. If IDs for visitors are not unique, OracleAS Personalization will not be able to make recommendations that are specific to a given visitor; instead the same recommendations would be made for all visitors who have the given ID.

3.4.5 Item Class

This class is used to represent items that can be recommended and for which data can be collected. An item is uniquely represented by the combination of type and ID. Item IDs must be unique within a given type, but different types can have the same IDs.

There are three kinds of methods provided with this class:

  • A constructor that creates an Item instance

  • Methods that return attribute values

    • getType()

    • getID()

  • A method that is a debugging aid

3.4.6 ItemDetailData Class

This class is created internally by OracleAS Personalization as part of the result of recommendation request. The calling Web application will have to examine the attributes to determine what attributes and values they contain. See the description of Section 3.4.7, "Recommendation Class" later in this chapter for more details.

There are three methods:

  • getAttribute()

  • getValue()

  • toString()

3.4.7 Recommendation Class

This class encapsulates information about a single recommended item. The information about the item is stored in the attributes array.

There are two methods:

  • getAttributes()

  • toString()

3.4.8 RecommendationContent Class

This class specifies the type of information that a recommendation request should return.

There are two kinds of methods provided with this class:

  • Two constructors that create RecommendationContent instances depending on how sorting is to be done

  • A method that returns the content items

If multiple instances of the array are to be sorted, the sorting order follows the array index order. That is, the result is sorted according to the attribute in the first array entry marked to be sorted, followed by the attribute in the second entry marked to be sorted, and so forth.

3.4.9 RecommendationList Class

A recommendation list is the collection of recommendations for a specific InterestDimension. RecommendationList is the class returned by all REAPI methods that return recommendations.

The methods in this class permit the calling Web application to determine the interest dimension type, to determine the actual number of recommendations returned, and to get the individual recommendations.

3.4.10 TuningSettings Class

This class specifies settings to be applied when computing a recommendation. An instance of this class is passed to all recommendation requests.

There are three kinds of methods provided with this class:

  • A constructor that creates a TuningSettings instance

  • Methods that set attribute values

  • Methods that return attribute values

The following methods set attribute values:

  • setDataSourceType()

  • setInterestDimension()

  • setPersonalizationIndex()

  • setProfileDataBalance()

  • setProfileUsage()

The following methods return attribute values:

  • getDataSourceType()

  • getInterestDimension()

  • getPersonalizationIndex()

  • getProfileDataBalance()

  • getProfileUsage()