Creating and Managing Rules
This following topics are included:
What is the Rules Manager?
Well-known objects
What are Rulesheets?
Classifier rules
Content selector rules
Debugging rulesheets
Using the Rules Management Administration Tool
Creating a rulesheet
Opening a rulesheet
Editing rulesheet properties
Saving a rulesheet
Deleting a rulesheet
Navigating between rule types
Finding a rule
Creating a classifier rule
Editing a rule
Editing rule properties
Adding an If user phrase to a rule
Editing an If user phrase
Deleting a rule phrase
Creating a content selector rule
Adding an If user classifier to a content selector rule phrase
Adding an And when phrase to a content selector rule
Adding a Then display content phrase to a content selector rule
Editing a Then display content phrase
Rules Management forms a key part of the personalization process by prescribing custom content to fit individual user profiles. The business logic encompassed by these rules allows robust delivery of personalized content marketed specifically to each end-user type.
What is the Rules Manager?
WebLogic Personalization Server 2.0 offers a robust personalization solution through a set of components that provide edit-time and run-time services for delivering personalized content to end-users while browsing a web site. These personalization components use business rules to match users and groups with appropriate content. The logic encompassed by the rules forms a critical piece of the personalization process.
The Rules Management component of WLPS provides editing, deploying, and run-time capabilities for providing personalized content based on externalized rules. This component includes two major parts: an edit-time tool with a graphical user interface that allows developers to define classification and content selection rules and a run-time service that matches users with content based on these rules.
Well-known objects
The Rules Management component uses several well-known objects:
- Content: This object is relevant to content selector rules. It corresponds to whatever content type is selected for set of object types. For each content selector rule invocation, a single Content object will be provided in the editor as a shorthand way for the rule writer to specify the nature of the content query to be produced. For instance, Content.size < 10000 would specify a part of a query to find content items who have a size attribute with a value less than 10,000.
- Now: A well-known object in the rule editor, of type Datetime. A valid expression might be: Now == Jan 01, 2000, 00:00:00 MST.
- User: For each call to the rules component, a single User object will be provided for use by the rules. User has a fixed schema, determined dynamically at edit-time by calling the User Management component. Given that the User might have a Numeric schema attribute called age, a valid expression might be: User.age > 35.
- Request: This object is used in the same way as the User object. The Request properties are defined in a default property set (see the Foundation documentation).
- Session: This object is used in the same way as the User object. The Session properties are defined in a default property set (see the Foundation documentation).
What are Rulesheets?
The BEA WebLogic Personalization Server 2.0 provides rulesheets that comprise a set of classifier and content selector rules. These rulesheets act as containers for rules that match personalized content with users.
A saved rulesheet generally contains a set of related rules and always has a relationship with a property set (see Creating and Managing Property Sets) that defines the attributes available for user and group profiles.
Note: Once you define a rulesheet and the property set to which it relates, you cannot change the relationship. You must create a new rulesheet and relate it to another property set if you want to change the property set for a rulesheet. This relationship between rulesheets and property sets makes it important to be careful when modifying property sets that rulesheets depend on. In general, you shouldn't change or delete properties if a rule refers to it. Adding properties does not affect existing rules.
Classifier rules
Classifier rules categorize users into groups using simple Boolean logic that determines if a user profile meets a set of conditions and places the user in a category based upon the result. Essentially, if the user profile meets the conditions, it is classified according to the classifier rule; if it doesn't meet the classification conditions, the user profile is not included in the classification group.
The following examples illustrate the logic involved in processing a classifier rule (note the implicit and between the rule phrases):
Classifier MiddleAgeMan
If User has the following characteristics:
User.age > 35
and User.age < 65
and User.gender == "M" OR "male"
Classifier HighEarner
If User has the following characteristics:
User.income > 100000
Classifier rules are the building blocks of more complicated rules. Content selector rules (see Content selector rules) can use classifier rules as they select personalized content to match a user or group profile.
Use the <pz:div> (see the JSP documentation) JSP tag to include a classifier rule in a JSP page.
Content selector rules
Content selector rules construct queries on the fly and return content based on the user profile. This type of rule adds time and content components to the basic classifier rule and may use references to classifier rules to define it. It also produces dynamic queries at run-time to select content from a document collection.
The power of producing dynamic queries that match content with user profiles allows content selectors to deliver highly customized content to end-users. Since content selector rules can use queries to select content based on run-time parameters, they allow the system to match personalized content to user profiles.
Note: Although a profile may meet the criteria of a content selector rule, the rule may not return any content objects. Why? If no content that matches the query's criteria, the query cannot return a content object.
Content selector rules contain three parts. Each part contains zero to many phrases. The generic description of each rule part includes:
- if user: The decision structure that determines if a profile meets a set of criteria
- and when: The time component of the rule
- then display content based on: Queries and selects content based on a set of criteria
The following example demonstrates the prototype for a content selector rule:
ContentSelector JanuaryStockQuotes (type: StockQuote)
If user has the following characteristics:
Classifier MiddleAgeMan
and Classifier HighEarner
and User.net_worth > 1000000
And when:
Now >= "Jan 01, 2000, 00:00:00 MST"
and Now < " Feb 01, 2000, 00:00:00 MST"
Then select Content where:
Content.size < 20000
and Content.MIMEType LIKE "*html*"
and Content.investment_type == User.investor_type;
and ANY Content.investment_qualities == User.risk_preference
and Content.creation_date > Now
Note: Once you define a content selector rule and the content type it uses, you cannot change the content type.
Use the <pz:contentselector> JSP tag to include content selector rules in JSP pages. (See the JSP documentation.)
Debugging rulesheets
You might notice that a rulesheet you've used in the past begins functioning oddly. This bug is probably because of a change in the property set with which the rulesheet has a relationship.
What is the relationship between Property sets and rulesheets?
Rulesheets rely on property sets to provide the properties they use to evaluate user and group profiles. If a property is modified after a rulesheet that uses it has been created, rules may contain dangling references to properties that no longer exist or that have been changed.
As much as possible, you should avoid modifying properties after defining rules that rely upon them. Since the property set defines the schema for the properties the rulesheet acts upon, any change to the properties the rules use will affect the schema and may alter the validity of the rulesheet. In general, be careful when modifying or deleting existing properties.
Note: You can add properties without affecting existing rules.
Content type and content selector rules
Another problem can occur when you change a content's metadata types after creating a content selector rule based on that content type's metadata. Remember that the content selector rule relies upon metadata to locate content. If you change content metadata and a content selector rule references the previous metadata, the rule will not work correctly.
Using the Rules Management Administration Tool
The Rules Management administration tool is an edit-time tool that provides an HTML-based GUI for creating, editing, and deleting rulesheets.
The run-time rules service uses rulesheets to create personalized content for end-users. The rulesheets created via the Rules Management Administration Tools interface produce XML output that is stored and evaluated at run-time.
Note: You should already have defined at least one property set before creating rulesheets. Property sets provide the template that defines the parameters that rules act upon at run-time.
Creating a rulesheet
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- On the Rules Management home page, click create. The Create a Rulesheet edit
page appears.
- Enter a name for the rulesheet in the Name field.
Note: You must populate all fields that have a red star to their right before you can create the rulesheet.
- Enter a description for the rulesheet in the Description field.
- Select a property set for the rulesheet from the choices in the Property Set
drop-down list box.
Note: You cannot change the property set after you create the rulesheet because the rules in the rulesheet fit only the schema defined in the property set.
- Click create to save the rulesheet with the parameters you've selected. WebLogic
Personalization Server saves the new rulesheet and returns to the Rules
Management home page.
Note: Clicking back cancels the operation and returns you to the Rules Management home page without creating a new rulesheet.
Opening a rulesheet
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- On the Rules Management home page, click the name of the rulesheet to open.
The Rulesheet view page appears, displaying rulesheet information and a list of
the classifier and content selector rules included in the rulesheet.
Editing rulesheet properties
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet you want to edit.
- On the Rulesheet view page, click edit in the Definition bar. The Edit Rulesheet
edit page appears.
- Enter a new name and description.
Note: Remember you can't change the property set. You must create a new rulesheet to change the property set. See Creating a rulesheet for instructions on creating a rulesheet.
- Click save to commit the changes or back to cancel the changes. If you save the
changes, the Rulesheet view page appears with the new information displayed.
Saving a rulesheet
- On the Rulesheet view page, click finished. The rulesheet is saved with the
changes you made and WebLogic Personalization Server returns to the Rules
Management home page.
Note: This is the only time the rulesheet is saved, so ensure you click finished before closing the rulesheet.
Deleting a rulesheet
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- On the Rules Management home page, click delete.
- Select the name of the rulesheet to delete from the Rulesheet Name drop-down
list box.
- Click delete to permanently delete the rulesheet or click back to cancel the delete
operation. The Rules Management home page appears after the delete operation
completes.
Note: You must click OK in the dialog that appears to confirm the delete operation.
Navigating between rule types
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open a rulesheet. See Creating a rulesheet for instructions on creating a rulesheet.
The Rulesheet view page appears.
- In the rules list, click to content selectors or to classifiers to navigate to the top
of the rule type sections.
Finding a rule
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet which contains the rule you want to locate. See Creating a
rulesheet for instructions on creating a rulesheet. The Rulesheet view page
appears.
- Locate the top of the rule type list (classifier or content selector type). See
Navigating between rule types for the procedure to navigate between rule types.
- Click the letter in the alphabet bar that matches the first letter of the rule you
want to find. An underlined letter indicates that a rule name begins with that
letter. The browser displays the rule names beginning with the letter you selected
at the top of the browser.
Note: You can also scroll to the rule using the browser's scroll bar.
- Locate the rule you need. See Editing a rule for information about making
changes to the rule.
Creating a classifier rule
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet in which you want to create the rule by clicking the rulesheet
name. See Creating a rulesheet for instructions on creating a rulesheet. The
Rulesheet view page appears.
- Click create in the Classifiers bar of the Rules list. The Create a Classifier Rule
edit page appears.
- Enter the rule's name into the Rule Name field.
Note: Rule names cannot include spaces and punctuation.
- Enter a description of the rule into the Description field.
- Click create to save the rule in the current rulesheet. The Create a Classifier Rule
edit page refreshes and displays a message about the rule creation's success or
failure.
- Create as many more rules as you need. Click back to return to the Rulesheet
view page. The Rulesheet view page appears with the new rule(s) you created
displayed in the alphabetical rule list.
Editing a rule
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet that contains the rule by clicking the rulesheet name. See
Creating a rulesheet for instructions on creating a rulesheet. The Rulesheet view
page appears.
- Locate the rule you want to edit. See Finding a rule for information on locating a
rule.
- Click the name of the rule. The Rule view page appears.
- Edit the rule using the instructions included in this documentation.
Editing rule properties
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet containing the rule you want to edit (see Opening a rulesheet).
The Rulesheet view page appears.
- Find the appropriate rule to edit. See Finding a rule for information on locating a
rule.
- Click the name of the rule. The Rule view page appears.
- Click edit in the Definition bar. The Edit Rule Definition edit page appears.
- Enter a new name and description.
- Click save to commit the changes or back to cancel the changes. The Rule view
page appears with the new information displayed.
Adding an If user phrase to a rule
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet that contains the rule to which you want to add a phrase. See
Creating a rulesheet for instructions on creating a rulesheet. The Rulesheet view
page appears.
- Find the rule you want to modify. See Finding a rule for information on locating a
rule.
- Click the name of the rule. The Rule view page appears.
- Click phrase to add a phrase to the rule. Step 1 of the Create If Phrase Wizard
appears.
- Select the Single-Value with Constant template to define the phrase and click
next. Step 2 of the Create If Phrase Wizard appears.
Note: Click back in any wizard page to return to the preceding page in the Rules Management interface.
- Click on the property to use to define the left operand of the rule phrase and click
next. Step 3 of the Create If Phrase Wizard appears.
- Select a comparator from the Comparator drop-down list box and enter a value
into the Constant field.
- To add an or condition to the phrase, click the
icon. The wizard page adds
another Comparator drop-down list box and Constant field to the phrase below
the current Comparator drop-down list box and Constant field.
- Select a comparator and enter a value into the new Constant field. Click the
icon again to add any number of conditions to the phrase.
- When you have completed construction of the phrase, click save to add the
phrase to the rule or back to return to the previous step of the Create If Phrase
Wizard.
Editing an If user phrase
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet which contains the rule you want to edit. See Creating a
rulesheet for instructions on creating a rulesheet. The Rulesheet view page
appears.
- Find the rule to edit. See Finding a rule for information on locating a rule.
- Click the name of the rule. The Rule view page appears.
- Click one of the phrases listed below the If the user has the following
characteristics bar. Step 3 of the Create If Phrase Wizard appears.
- Select a comparator from the Comparator drop-down list box and enter a value
into the Constant field.
- Click save to commit the changes or back to cancel the changes. The Rule view
page appears with the changes you made to the phrase displayed.
Deleting a rule phrase
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet which contains the rule to which you want to add a phrase.
See Creating a rulesheet for instructions on creating a rulesheet. The Rulesheet
view page appears.
- Find the rule which contains the rule phrase to delete. See Finding a rule for
information on locating a rule.
- Click the name of the rule. The Rule view page appears.
- To delete a phrase, click the
icon next to the phrase name. After you confirm
the delete process, the page refreshes and the new page does not show the phrase
you deleted.
Creating a content selector rule
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet in which you want to create the rule by clicking the rulesheet
name. See Creating a rulesheet for instructions on creating a rulesheet. The
Rulesheet view page appears.
- Click create in the Content Selectors bar of the Rules list. The Create a Content
Selector Rule edit page appears.
- Select the content type from the Content Type drop-down list box.
- Enter the rule's name into the Rule Name field.
Note: Rule names cannot include spaces and punctuation.
- Enter a description of the rule into the Description field.
- Click create to save the rule in the current rulesheet. The Create a Content
Selector Rule edit page refreshes and displays a message about the rule creation's
success or failure.
- Create as many rules as you need. Click back to return to the Rulesheet view
page. The Rulesheet view page appears with the new rule(s) you created
displayed in the alphabetical rule list.
Adding an If user classifier to a content selector rule phrase
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet which contains the rule you want to edit. See Creating a
rulesheet for instructions on creating a rulesheet. The Rulesheet view page
appears.
- Find the rule to edit. See Finding a rule for information on locating a rule.
- Click the name of the rule. The Rule view page appears.
- Click class in the If the user has the following characteristics bar. The Rule
search page appears.
- Enter the name of the rule in the Classifier Name field and click search to find a
rule or click a letter to view all classifier rules that begin with the letter you click.
Rules matching the search criteria populate the page when the search completes.
Note: The * character allows you to perform a wildcard search. Using the * character alone returns a list of all classifier rules.
- Check the boxes next to the classifier you want to add to the rule.
- Click save to commit the changes. The Rule search page refreshes and displays a
message about the process's success or failure.
- Add as many classifier rules as you need. When you finish, click back to return
to the Rule view page. The Rule view page appears with the new classifier(s)
displayed in the beneath the If the user has the following characteristics bar.
Adding an And when phrase to a content selector rule
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet which contains the rule you want to edit. See Creating a
rulesheet for instructions on creating a rulesheet. The Rulesheet view page
appears.
- Find the rule to edit. See Finding a rule for information on locating a rule.
- Click the name of the rule. The Rule view page appears.
- Click phrase in the And when bar. The Edit And When Phrase edit page appears.
- Select a comparator from the Comparator drop-down list box.
- Select a date and time to compare using the
icon to display a calendar or
by entering a date into the Date field.
Note: You must include the date string in `MM/dd/yyyy HH:mm:ss z' format.
- Click save to add the phrase to the rule or click back to cancel the phrase
creation and leave the rule as it was before. The Rule view page appears and
displays the new phrase.
Adding a Then display content phrase to a content selector rule
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet which contains the rule you want to edit. See Creating a
rulesheet for instructions on creating a rulesheet. The Rulesheet view page
appears.
- Find the rule to edit. See Finding a rule for information on locating a rule.
- Click the name of the rule. The Rule view page appears.
- Click phrase in the Then display content based on bar. Step 1 of the Create Then
Phrase Wizard appears.
- Select a template to use to define the content query and click next. Step 2 of the
Create Then Phrase Wizard appears.
- Select a property from the Property list and click next. Step 3 of the Create Then
Phrase Wizard appears.
Note: The list receives its data from the metadata stored in the document management system.
- Select a comparator and one of the following, depending on the template:
- Enter a constant value if you selected the Value with Constant template.
- Select a property from the Property drop-down list if you selected the Value with Property template.
- You cannot change the value of now if you selected the Value with Date template.
Editing a Then display content phrase
- From the Administration Tools Home Page, click the Rules Management icon. The
Rules Management home page appears.
- Open the rulesheet which contains the rule you want to edit. See Creating a
rulesheet for instructions on creating a rulesheet. The Rulesheet view page
appears.
- Find the rule to edit. See Finding a rule for information on locating a rule.
- Click the name of the rule. The Rule view page appears.
- Click one of the phrases listed below the phrase bar. Step 3 of the Create Then
Phrase Wizard appears.
- Select a comparator from the Comparator drop-down list and enter a value into
the Constant field.
- Click save to commit the changes or back to cancel the changes. The Rule view
page appears with the changes you made to the phrase displayed.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
|