In this query, the rECOMMEnd and to clauses specify that movies will be recommended to users The USING clause specifies the name of the multidimensional rating cube. The BASED ON clause specifies that personal ratings are used for recommendation purposes. The movies in this query are ordered separately for each user based on the Personal Rating measure that is either provided by the user or estimated from the set of known ratings as mentioned in Section 2. The query returns the highest-rated movie for each user. Query 1 actually uses some defaults, and the equivalent query with the explicitly specified parameters RECOMMEND Movie(MovielD)TO User(UserID) USING MOVIe Recommender ASEd ON Personal Rating(AVG) SHOW TOP 1 BY PersonalRating Qualifier AVG specifies that, when the MovieRecommender cube is reduced to two dimensions Movie and User, all the ratings of a movie seen by a user on different occasions are aggregated by averaging their values(note that the user could see or rate the same movie more than once, i.e., in different contexts). Each measure can have its own default aggregation function(e.g, AVG in this case The SHoW TOP k clause returns k best movies for the user ordered by aggregated PersonalRating measure(by default, k=1). MovielD and UserID represent the dimensional attributes that will be used when displaying the results Next we introduce the restrictions on the recommendation criteria Query 2: Recommend, using personal ratings, top 5 action movies to users older than 18 RECOMMEND Movie TO User USING MoVIe Recommender RESTRICT MoVIe Genre ="Action AND User. Age >=18 BASEd ON Personal Rating(AVG) SHOW TOP 5 BY PersonalRating The reStriCt clause is used to select the movies and the users satisfying the selection criteria Then only the selected movies are ordered for each selected user based on the instructions specified in the BASED ON and the SHoW clauses, as discussed above. As this and other examples show, the syntax of REQUEST differs from that of SQL. This is done on purpose to reflect significant differences between
10 In this query, the RECOMMEND and TO clauses specify that movies will be recommended to users. The USING clause specifies the name of the multidimensional rating cube. The BASED ON clause specifies that personal ratings are used for recommendation purposes. The movies in this query are ordered separately for each user based on the PersonalRating measure that is either provided by the user or estimated from the set of known ratings as mentioned in Section 2. The query returns the highest-rated movie for each user. Query 1 actually uses some defaults, and the equivalent query with the explicitly specified parameters is: RECOMMEND Movie (MovieID) TO User (UserID) USING MovieRecommender BASED ON PersonalRating(AVG) SHOW TOP 1 BY PersonalRating Qualifier AVG specifies that, when the MovieRecommender cube is reduced to two dimensions Movie and User, all the ratings of a movie seen by a user on different occasions are aggregated by averaging their values (note that the user could see or rate the same movie more than once, i.e., in different contexts). Each measure can have its own default aggregation function (e.g., AVG in this case). The SHOW TOP k clause returns k best movies for the user ordered by aggregated PersonalRating measure (by default, k = 1). MovieID and UserID represent the dimensional attributes that will be used when displaying the results. Next we introduce the restrictions on the recommendation criteria. Query 2: Recommend, using personal ratings, top 5 action movies to users older than 18. RECOMMEND Movie TO User USING MovieRecommender RESTRICT Movie.Genre = “Action” AND User.Age >= 18 BASED ON PersonalRating(AVG) SHOW TOP 5 BY PersonalRating The RESTRICT clause is used to select the movies and the users satisfying the selection criteria. Then only the selected movies are ordered for each selected user based on the instructions specified in the BASED ON and the SHOW clauses, as discussed above. As this and other examples show, the syntax of REQUEST differs from that of SQL. This is done on purpose to reflect significant differences between
the application domains these languages are meant for. We discuss this further in Section 3. 2 We next show how ratings are filtered using the postfilter clause Query 3: Recommend top 5 movies to the user for the weekend but only when personal ratings of the movies are higher than 7(if fewer than 5 movies satisfy these criteria, then show only those satisfying them) RECOMMEND Movie TO User USING MOVIe Recommender RESTRICT TIme. TimeofWeek = weekend BASEd ON Personal Rating(AVG) POSTFILTER PersonalRating>7 SHOW TOP 5 Query 3 demonstrates that different clauses(RESTRICT and POSTFILTER)are used for the selections of attributes and ratings. First, only the weekend ratings are selected with the Restrict clause. Then they are aggregated using the"BASED ON PersonalRating(AvG) clause. Only then the POSTFILTER clause is applied to these aggregated Personal Ratings and only those greater than 7 are selected. If we want to restrict non-aggregated ratings, we should use the prefilter clause, as will be shown in Query 5. The reasons for using separate RESTRICt and POStFiLter clauses when restricting attributes and ratings are discussed in Section 3.2 The next example shows that more than one dimension can be used in recommendations, i.e., Movie and Time are recommended to User and Companion Query 4: Recommend to Tom and his girlfriend top 3 movies and the best times to see them over the RECOMMEND Movie, Time TO User, Companion USING MOVie Recommender RESTRICT USer Name=Tom"AND Time. TimeofWeek="weekend"AND Companion. Type ="Girlfriend BASEd ON Personal Rating SHOW TOP 3 Sometimes, a certain group of people may be interested in a certain type of movies. For example, there has been work done on the topic of recommending to groups of users [13] as well as using aggregate ratings in the recommendation process [25]. The next example shows how this type of aggregation can be done in REQUeSt I1
11 the application domains these languages are meant for. We discuss this further in Section 3.2. We next show how ratings are filtered using the POSTFILTER clause. Query 3: Recommend top 5 movies to the user for the weekend but only when personal ratings of the movies are higher than 7 (if fewer than 5 movies satisfy these criteria, then show only those satisfying them). RECOMMEND Movie TO User USING MovieRecommender RESTRICT Time. TimeOfWeek =”weekend” BASED ON PersonalRating(AVG) POSTFILTER PersonalRating > 7 SHOW TOP 5 Query 3 demonstrates that different clauses (RESTRICT and POSTFILTER) are used for the selections of attributes and ratings. First, only the weekend ratings are selected with the RESTRICT clause. Then they are aggregated using the “BASED ON PersonalRating (AVG)” clause. Only then the POSTFILTER clause is applied to these aggregated PersonalRatings and only those greater than 7 are selected. If we want to restrict non-aggregated ratings, we should use the PREFILTER clause, as will be shown in Query 5. The reasons for using separate RESTRICT and POSTFILTER clauses when restricting attributes and ratings are discussed in Section 3.2. The next example shows that more than one dimension can be used in recommendations, i.e., Movie and Time are recommended to User and Companion. Query 4: Recommend to Tom and his girlfriend top 3 movies and the best times to see them over the weekend. RECOMMEND Movie, Time TO User, Companion USING MovieRecommender RESTRICT User.Name = “Tom” AND Time.TimeOfWeek =”weekend” AND Companion.Type = “Girlfriend” BASED ON PersonalRating SHOW TOP 3 Sometimes, a certain group of people may be interested in a certain type of movies. For example, there has been work done on the topic of recommending to groups of users [13] as well as using aggregate ratings in the recommendation process [25]. The next example shows how this type of aggregation can be done in REQUEST
Query 5: Recommend movie genre to various professions using only the movies with personal ratings bigger than 6 RECOMMEND Movie Genre To User. Profession USING MOVIe Recommender PREFILTER PersonalRating >6 BASEd ON Personal Rating(AVG) This query aggregates rating scores for individual movies into averaged rating scores for different genres of movies. Also, individual users are aggregated by profession, and each profession becomes a new target for a recommendation. Before the ratings are aggregated, the PreFilter operator selects the ratings bigger than 6, and only these ratings are aggregated. It differs from the POstfilter operator in Query 3 since it deals with non-aggregated ratings, whereas POSTFILTER is applied to the aggregate ratings. This distinction is crucial in some recommendation settings The next example demonstrates that recommendations are not restricted to the User dimension; in al, different things can be recommended to various objects Query 6: Identify the top two professions that appreciate the movie Beautiful Mind" the most RECOMMEND USer Profession to movie USING MoVIe Recommende RESTRICT MOVIe Title ="Beautiful mind ASED ON Personal Rating(AVG) SHOW TOP 2 Remember that a rating score for a movie is either explicitly specified by the user or is estimated from the existing user-specified ratings using one of the rating estimation methods described in [2, 4]. The next query is a modification of Query I that makes use of this fact Query 7: Recommend best movies to users that they have not seen yet RECOMMEND Movie To User USING Movie Recommender BASED ON Personal Rating(A VG), Consumed(DISJ) POSTFILTER NOT(Consumed) SHOW TOP I BY PersonalRating This query collects all the ratings given to a movie by a user(note that the user can provide multiple ratings to a movie, seen in different contexts). Consumed is a boolean flag related to PersonalRating
12 Query 5: Recommend movie genre to various professions using only the movies with personal ratings bigger than 6: RECOMMEND Movie.Genre TO User.Profession USING MovieRecommender PREFILTER PersonalRating > 6 BASED ON PersonalRating(AVG) This query aggregates rating scores for individual movies into averaged rating scores for different genres of movies. Also, individual users are aggregated by profession, and each profession becomes a new target for a recommendation. Before the ratings are aggregated, the PREFILTER operator selects the ratings bigger than 6, and only these ratings are aggregated. It differs from the POSTFILTER operator in Query 3 since it deals with non-aggregated ratings, whereas POSTFILTER is applied to the aggregate ratings. This distinction is crucial in some recommendation settings. The next example demonstrates that recommendations are not restricted to the User dimension; in general, different things can be recommended to various objects. Query 6: Identify the top two professions that appreciate the movie “Beautiful Mind” the most. RECOMMEND User.Profession TO Movie USING MovieRecommender RESTRICT Movie.Title = “Beautiful Mind” BASED ON PersonalRating(AVG) SHOW TOP 2 Remember that a rating score for a movie is either explicitly specified by the user or is estimated from the existing user-specified ratings using one of the rating estimation methods described in [2, 4]. The next query is a modification of Query 1 that makes use of this fact. Query 7: Recommend best movies to users that they have not seen yet. RECOMMEND Movie TO User USING MovieRecommender BASED ON PersonalRating(AVG), Consumed(DISJ) POSTFILTER NOT(Consumed) SHOW TOP 1 BY PersonalRating This query collects all the ratings given to a movie by a user (note that the user can provide multiple ratings to a movie, seen in different contexts). Consumed is a Boolean flag related to PersonalRating