BEA Logo BEA WLCS Release 3.2

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WLCS Doc Home   |   Personalization Tour   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Working with Rules

 

This chapter describes how the Rules Engine matches indexed content to users.

This topic includes the following sections:

 


Creating Rules

Now that we have indexed the content, we need to create rules that will match the content with users when they visit the example portal. To implement this functionality, we need to create four rules:

  1. A classifier rule that classifies users as frequent visitors if they have accumulated four or more AcmePoints.

  2. A classifier rule that classifies users as infrequent visitors if they have accumulated fewer than four AcmePoints.

  3. A content selector rule that matches frequent visitor message content to user profiles in the frequent visitor classification.

  4. A content selector that matches site usage hints to user profiles in the infrequent visitor classification.

Creating the Classifier Rules

In this section, we will create two classifier rules to classify users as frequent visitors or infrequent visitors. We will later use these classifier rules in content selector rules that select a message or hint to display to users.

Note: WebLogic Personalization Server does not save rules until you click the Finished button in a Rule view page.

  1. Make sure WebLogic Commerce Server is running, then go to the Administration Tools Home page at http://<wlhost>:<port>/tools.

  2. From the Administration Tools Home page, click the Rules Management icon. The Rules Management Home page appears.

  3. Click the rule set named AcmeRules to edit it. The AcmeRules Rule Set view page appears.

  4. Click Create in the Classifiers bar to create a new classifier rule. The Create a Classifier Rule edit page appears.

  5. Enter the rule name FrequentVisitor into the Rule Name field.

  6. Enter a description of the rule into the Description field. For example, you might type Classifies users with 4 or more visits.

  7. Click Create to add the rule to the AcmeRules rule set. The Create a Classifier Rule edit page refreshes and displays a message about the rule creation's success.

    Note: We will add phrases to the rule later in the tour.

  8. Now create another classifier rule by entering the rule name InfrequentVisitor into the Rule Name field.

  9. Enter a description for this rule. For example, Classifies users with fewer than 4 visits.

  10. Click Create to save the rule in the AcmeRules rule set. The Create a Classifier Rule edit page refreshes and displays a message about the rule creation's success.

  11. Click Back to return to the AcmeRules Rule Set view page.

Adding Phrases to the Classifier Rules

We need to add conditions to the classifier rules to classify users depending on the value of their AcmePoints.

  1. Click the FrequentVisitor classifier rule link on the AcmeRules Rule Set view page to open it for editing. The Rule view page appears.

  2. Click Phrase to add a phrase to the rule.

  3. Select the Single-Value with Constant template to define the phrase, then click Next. Step 2 of the Create If Phrase Wizard appears.

  4. Click the USER.AcmePoints property to define the left operand of the rule phrase, then click Next. Step 3 of the Create If Phrase Wizard appears.

  5. From the Comparator drop-down list box, select the >= comparator, then enter the value 4 into the Constant field.

  6. Click Save to add the phrase to the rule. The Rule view page appears with the new phrase displayed.

  7. Click Finished to save the rule set and return to the AcmeRules Rule Set view page.

  8. Now we will repeat the process to add a phrase to the InfrequentVisitor rule.
    Click the InfrequentVisitor classifier rule on the AcmeRules Rule Set view page to open it for editing. The Rule view page appears.

  9. Click Phrase to add a phrase to the rule.

  10. Select the Single-Value with Constant template to define the phrase, then click Next. Step 2 of the Create If Phrase Wizard appears.

  11. Click on the USER.AcmePoints property to define the left operand of the rule phrase, then click Next. Step 3 of the Create If Phrase Wizard appears.

  12. From the Comparator drop-down list box, select the < comparator, then enter the value 4 into the Constant field.

  13. Click Save to add the phrase to the rule. The Rule view page appears with the new phrase displayed.

  14. Click Finished to save the rule set and return to the AcmeRules Rule Set view page.

Creating the Content Selector Rules

We have created two classifier rules to categorize users as frequent visitors or infrequent visitors. In this section, we will create two content selector rules that use the classifier rules. The content selector rules will match content to users based on the user's classification. Let's create a rule to show site usage hints to infrequent visitors.

Note: The hints will tell new users how to use example portal's features.

  1. From the AcmeRules Rule Set view page, click Create in the Content Selectors bar. The Create a Content Selector Rule edit page appears.

  2. From the Content Type drop-down list box, select the LoadedData content type.

    Note: The BulkLoader utility created the LoadedData content type. If you use a different document management system, you will see different content types.

  3. Enter the rule name Hints into the Rule Name field.

  4. Enter a description of the rule into the Description field. For example, Shows site usage hints to users in the InfrequentVisitor classification.

  5. Click Create to add the rule to the AcmeRules rule set. The Create a Content Selector Rule edit page refreshes and displays a message about the rule creation's success.

  6. Add another rule that shows promotional messages to frequent visitors. Enter the rule name FrequentVisitorMessage into the Rule Name field.

  7. Enter a description of the rule into the Description field. For example, Selects a preview message for users in the FrequentVisitor classification.

  8. Click Create to save the new rule in the AcmeRules rule set. The Create a Content Selector Rule edit page refreshes and displays a message about the rule creation's success.

  9. Click Back to return to the AcmeRules Rule Set view page.

Adding Conditions to the Hints Rule

  1. From the AcmeRules Rule Set view page, click the Hints content selector rule to open it for editing. The Rule view page appears.

  2. From the "If the user has the following characteristics" bar, click Classifier to add a classifier to the Hints rule. The Rule search page appears.

  3. Enter InfrequentVisitor in the Classifier Name field to find the InfrequentVisitor classifier rule, then click Search.

    Note: The * character allows you to perform a wildcard search. Using the * character alone returns a list of all classifier rules. The search is case sensitive.

  4. Check the box next to the InfrequentVisitor classifier rule. This will add the classifier to the Hints rule when you click Save.

  5. Click Save to commit the changes. The Rule search page refreshes and displays a message about the process's success.

  6. Click Back to return to the Rule view page. The Rule view page appears with the new classifier displayed.

  7. Now we will add a phrase to select hints to match to infrequent visitors. Click Phrase in the "Then display content based on" bar. Step 1 of the Create Then Phrase Wizard appears.

    Note: This phrase defines the query that will execute at run time if a user matches the InfrequentVisitor classification.

  8. Select the Value with Constant template to use to define the content query, then click Next. Step 2 of the Create Then Phrase Wizard appears.

  9. Select the CONTENT.visitingFrequency property from the Property list, then click Next. Step 3 of the Create Then Phrase Wizard appears.

    Note: The property list receives its data from the metadata stored in the document management system. In this case, content property comes from the information in the <meta> tags in the hints1.htm and hints2.htm files the BulkLoader indexed earlier.

    Note: If the "back" and "save" buttons do not appear on the screen after selecting this property, resize the browser until the horizontal scroll bar appears.

  10. Select the == comparator and enter InfrequentVisitor into the Constant field. Click Save to add the phrase to the rule. The Rule view page appears with the new phrase displayed.

    Note: The value InfrequentVisitor is stored in the metadata in the hint1.htm and hint2.htm files. We loaded the metadata using the BulkLoader earlier in the tour. At run time, a user who logs in with fewer than four AcmePoints in the AcmePoints property will match the InfrequentVisitor classification and will see the hints content selected through the query defined here.

  11. Click Finished to save the rule set and return to the AcmeRules Rule Set view page.

Adding Conditions to the FrequentVisitorMessage Rule

Now we will add conditions to the FrequentVisitorMessage rule.

Note: The steps are the same as the process we used above to add conditions to the Hints rule, except that in this case we are operating on the FrequentVisitorMessage content selector rule, and the Classifier Name is FrequentVisitor.

  1. Click the FrequentVisitorMessage content selector rule on the AcmeRules Rule Set view page to open it for editing. The Rule view page appears.

  2. From the "If the user has the following characteristics" bar, click Classifier to add a classifier to the FrequentVisitorMessage rule. The Rule search page appears.

  3. Enter FrequentVisitor in the Classifier Name field to find the FrequentVisitor classifier rule, then click Search.

    Note: The * character allows you to perform a wildcard search. Using the * character alone returns a list of all classifier rules. The search is case sensitive.

  4. Check the box next to the FrequentVisitor classifier rule. This will add the classifier to the FrequentVisitorMessage rule when you click Save.

  5. Click Save to commit the changes. The Rule search page refreshes and displays a message about the process's success.

  6. Click Back to return to the Rule view page. The Rule view page appears with the new classifier displayed.

  7. Now we will add a phrase to select special messages to match to frequent visitors. Click Phrase in the "Then display content based on" bar. Step 1 of the Create Then Phrase Wizard appears.

    Note: This phrase defines the query that will execute at run time if a user matches the FrequentVisitor classification.

  8. Select the Value with Constant template to use to define the content query, then click Next. Step 2 of the Create Then Phrase Wizard appears.

  9. Select the CONTENT.visitingFrequency property from the Property list and click Next. Step 3 of the Create Then Phrase Wizard appears.

    Note: The property list receives its data from the metadata stored in the document management system. In this case, content property comes from the information in the metadata in the prev1.htm and prev2.htm files that the BulkLoader indexed earlier.

  10. Select the == comparator and enter FrequentVisitor into the Constant field. Click Save to add the phrase to the rule. The Rule view page appears with the new phrase displayed.

  11. Click Finished to save the rule set and return to the AcmeRules Rule Set view page.

You have completed indexing the content and creating the rules to match the content to users who log into the example portal. In the next section, we will use the Advisor's JSP tags to create the JSP page to pull the entire personalized application together.

Note: Remember that WebLogic Personalization Server does not save rules until you click the Finished button in a Rule view page.