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:
- A classifier rule that classifies users as frequent visitors if they have accumulated
four or more AcmePoints.
- A classifier rule that classifies users as infrequent visitors if they have
accumulated fewer than four AcmePoints.
- A content selector rule that matches frequent visitor message content to user
profiles in the frequent visitor classification.
- 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.
- Make sure WebLogic Commerce Server is running, then go to the Administration
Tools Home page at http://<wlhost>:<port>/tools.
- From the Administration Tools Home page, click the Rules Management icon.
The Rules Management Home page appears.
- Click the rule set named AcmeRules to edit it. The AcmeRules Rule Set view
page appears.
- Click Create in the Classifiers bar to create a new classifier rule. The Create a
Classifier Rule edit page appears.
- Enter the rule name FrequentVisitor into the Rule Name field.
- Enter a description of the rule into the Description field. For example, you might
type Classifies users with 4 or more visits.
- 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.
- Now create another classifier rule by entering the rule name
InfrequentVisitor into the Rule Name field.
- Enter a description for this rule. For example, Classifies users with fewer
than 4 visits.
- 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.
- 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.
- Click the FrequentVisitor classifier rule link on the AcmeRules Rule Set view
page to open it for editing. The Rule view page appears.
- Click Phrase to add a phrase to the rule.
- Select the Single-Value with Constant template to define the phrase, then click
Next. Step 2 of the Create If Phrase Wizard appears.
- 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.
- From the Comparator drop-down list box, select the >= comparator, then enter
the value 4 into the Constant field.
- Click Save to add the phrase to the rule. The Rule view page appears with the
new phrase displayed.
- Click Finished to save the rule set and return to the AcmeRules Rule Set view
page.
- 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.
- Click Phrase to add a phrase to the rule.
- Select the Single-Value with Constant template to define the phrase, then click
Next. Step 2 of the Create If Phrase Wizard appears.
- 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.
- From the Comparator drop-down list box, select the < comparator, then enter the
value 4 into the Constant field.
- Click Save to add the phrase to the rule. The Rule view page appears with the
new phrase displayed.
- 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.
- From the AcmeRules Rule Set view page, click Create in the Content Selectors bar.
The Create a Content Selector Rule edit page appears.
- 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.
- Enter the rule name Hints into the Rule Name field.
- Enter a description of the rule into the Description field. For example, Shows
site usage hints to users in the InfrequentVisitor
classification.
- 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.
- Add another rule that shows promotional messages to frequent visitors. Enter the
rule name FrequentVisitorMessage into the Rule Name field.
- Enter a description of the rule into the Description field. For example, Selects
a preview message for users in the FrequentVisitor
classification.
- 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.
- Click Back to return to the AcmeRules Rule Set view page.
Adding Conditions to the Hints Rule
- From the AcmeRules Rule Set view page, click the Hints content selector rule to
open it for editing. The Rule view page appears.
- 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.
- 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.
- Check the box next to the InfrequentVisitor classifier rule. This will add the
classifier to the Hints rule when you click Save.
- Click Save to commit the changes. The Rule search page refreshes and displays a
message about the process's success.
- Click Back to return to the Rule view page. The Rule view page appears with the
new classifier displayed.
- 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 runtime if a user matches the InfrequentVisitor classification.
- 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.
- 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.
- 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 runtime, 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.
- 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.
- Click the FrequentVisitorMessage content selector rule on the AcmeRules
Rule Set view page to open it for editing. The Rule view page appears.
- 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.
- 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.
- Check the box next to the FrequentVisitor classifier rule. This will add the
classifier to the FrequentVisitorMessage rule when you click Save.
- Click Save to commit the changes. The Rule search page refreshes and displays a
message about the process's success.
- Click Back to return to the Rule view page. The Rule view page appears with the
new classifier displayed.
- 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 runtime if a user matches the FrequentVisitor classification.
- 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.
- 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 FrequentVisitorMessage1.htm and FrequentVisitorMessage2.htm files that the BulkLoader indexed earlier.
- 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.
- 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.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
|