Home > Articles

📄 Contents

  1. Commended Recommendations
  2. The Curious Incident of the Dog in the Nighttime
  • Print
  • + Share This
Like this article? We recommend

The Curious Incident of the Dog in the Nighttime

If you have been following these articles from the beginning, you may have already guessed that the infamous taxonomy is somehow involved in generating your recommendations. Good guess. Well, come to think of it, I did mention it in my earlier article, "MyInformIT: It's All About Me, Me, Me," and all the ones before that, too. Still, good guess. The taxonomy, like Cerberus, does rear its multiple heads. We'll dig down a little bit and soon enough we'll hear some eerie barking.

The code to display the Recommendations list is nearly identical in form to that used to generate the Saved Content buckets discussed (in mind-numbing detail) in the last article. Therefore, let's skip over the ASP part of the equation and jump straight to the Java and database components. As before, let's use the recommended books section as a demonstration case.

Let me start by describing, in simplified form, the database table structure (see Figure 4). Everything is centered around the users table reviewed in my earlier article "Personalization Personified." Comparing the two versions, you may notice that I've added another field to the table, product_from_clause. This field is updated by a trigger when the profile is filled in or updated. product_from_clause is a repository containing a comma-separated list of the table names for which the user has entered data. In the course of filling out the profile, suppose the user entered data into the Current Job Description, Future Job Description, and Certifications You Currently Hold fields. product_from_clause would then hold the value "user_job_titles,user_certifications". This will be pulled later to help build the query that extracts the user's list of book recommendations. Of course, this information is tied to the user_id, a uniqueidentifier that serves as the primary key for the users table.

Figure 4 User tables still life.

Figure 4 shows three other tables that factor into the solution. user_job_titles ties the user_id to a job_id and job_state. job_id is a foreign key to a previously unmentioned table in the InformIT taxonomy (Woof! Woof!), job_dimension. The list of jobs on the profile page come straight from the job_dimension table. job_state has two valid values, "current" and "future". These clearly indicate which profile box the information came from, Current Job Description or Future Job Description.

user_certifications ties the user_id to a certification_id from the (Bark! Howl!) certification_dimension taxonomy table. The certification_state in the user_certifications table performs the same function as the job_state field in user_job_titles, holding "current" or "future".

Finally, user_interests rounds out our cast. The category and subcategory fields should look familiar. They tie into the (Grrrowwwl!) reference_dimension taxonomy table. That's the same table used to build the BTB and the topics and subtopics therein. The interest_type field holds two possible values, "platforms" or "technologies". These correspond directly to the Platforms That Interest You and Technologies That Interest You profile fields.

I could tie in one other table, user_trade_shows, but I think that you can conjecture what that looks like. The process of gathering the data will be amply demonstrated with what we have here.

Now that we know what we're dealing with on the SQL Server back end, we can start to delve into the Java. Having looked ahead, I can tell you that we're in for a bumpy ride. There is some serious and interesting Java coming up, written by a certain developer—the same guy who used the big variable names in my article 5, "Personalization Personified." I can tell you, he knows what he's doing. It looks as if he went to school for this stuff, which he did. So, if you'll forgive me, we're only going to dip our toes in the water in this outing. With our little piggies damp, we can get ready to plug our noses and cannonball into the deep end in the next article.

The relevant ASP first instantiates a Java object called informit.RecommendedBooks. Within this Java class, we have all of our tools. As in the Saved Content case (see article 5), we set some Public variables within the object, such as the product_group and number of results to return. We also set the user_id within the object so that it knows for whom to pull data. If you recall, the user_id is retrieved from the session_id. Then, with the following, innocuous call, we start on the hunt for the white whale:

informit.RecommendedBooks.getBucketResults()

That brings us within the informit.RecommendedBooks object. Here's what getBucketResults() looks like:

1  public void getBucketResults()
2  {
3   Recordset RS  = null;
4   Recordset Count = null;
5
6   this.verifyClauses();
7
8   if ( user_interests_exist || 
9      user_certifications_exist ||
10     user_job_titles_exist )
11    {
12      //
13      // we know the user and they have a profile
14      //
15
16      if ( user_interests_exist &&
17        user_certifications_exist &&
18        user_job_titles_exist )
19      {
20       setBucketResults( 1 );
21      }
22      else
23      {
24       if ( user_interests_exist ^
25          user_certifications_exist ^
26          user_job_titles_exist )
27       {
28         setBucketResults( 1 );
29       }
30       else
31       {
32         setBucketResults( 0 );
33       }
34      }
35    }
36
37 }

Sure, it looks quiet enough. I'll leave it up to you to guess at what might be coming next given what you see here. I, for one, am getting a little weirded out by all the barking and talk about fish (and sea mammals). I need to desist before I start talking about dogfish. In the next episode, we'll put on our swim trunks and take the Java plunge. I would advise against skinny-dipping! See you then.

  • + Share This
  • 🔖 Save To Your Account