Bric::Biz::Keyword - A general class to manage keywords.
$Revision: 1.10.2.1 $
$Date: 2002/09/04 21:08:51 $
use Bric::Biz::Keyword;
# Create a new keyword object.
my $key = new Bric::Biz::Keyword($init);
# Lookup an existing keyword.
my $key = new Bric::Biz::Keyword($key_id);
# Create a list of keyword objects.
my $key = list Bric::Biz::Keyword($param);
# Get/set the keyword name.
$name = $key->get_name();
$success = $key->set_name($name);
# Get/set the screen (display) name.
$screen = $key->get_screen_name();
$success = $key->set_screen_name($screen);
# Mark this keyword inactive
$success = $key->delete();
# Save this asset to the database.
$success = $key->save();
# Link a keyword with a story (or media object or category)
$key->associate($story);
# Break the link between a keyword and a story (or media object or category)a
$key->dissociate($story);
The Keyword module allows assets to be characterized by a set of topical keywords. These keywords can be used to group assets or during a search on a particular topic.
Creates a new keyword and keyword object. Keys for %init are:
The name of this keyword - required.
The way this name should be displayed on screen (ie name='George', screen name='George Washington'). If not specified name will be used for screen_name.
The word used to sort keywords. If not specified then name will be used for sort_name.
Throws: NONE
Side Effects: NONE
Notes: NONE
Retrieves a single existing keyword from the database. Takes either a keyword ID or the keyword name.
Throws:
Bad parameters passed to 'lookup'
Side Effects: NONE
Notes: NONE
Searches for keywords returning matches ordered by sort_name. The possible keys to $param are the following;
Search for keywords by name. Matched with LIKE.
Search for keywords by screen name. Matched with LIKE.
Search for keywords by sort name. Matched with LIKE.
Search for keywords by active flag. If you don't set this flag then active => 1 is implicitely used.
Returns all the synonyms for the given keyword or keyword ID. Cannot be legally combined with the object param.
Returns all keywords for a given object - may be a Bric::Biz::Category, Bric::Biz::Asse::Business::Media or a Bric::Biz::Asse::Business::Story object. Cannot be legally combined with the synonyms param.
Throws:
Unsupported object type : $ref
Synonyms search cannot be combined with object search.
Side Effects: NONE
Notes: NONE
Marks a keyword inactive in the database. Equivalent to calling set_active(0).
Throws: NONE
Side Effects: NONE
Notes: NONE
Introspect this object.
Throws:
NONE
Side Effects:
NONE
Notes:
NONE
Associates a keyword with an object. The object must by of a type that supports keywords - currently Bric::Biz::Asset::Business::Story, Bric::Biz::Asset:::Business::Media and Bric::Biz::Category. This call commits the change directly to the database. There is no need to call save() afterward.
Returns 0 if $key is already associated with $obj, 1 if a new relationship was created.
Throws:
Unsupported object type : $ref.
Side Effects: NONE
Notes: Cannot be called on an unsaved keyword. Call save() first.
Dissociates a keyword from an object. The object must by of a type that supports keywords - currently Bric::Biz::Asset::Business::Story, Bric::Biz::Asset:::Business::Media and Bric::Biz::Category. This call commits the change directly to the database. There is no need to call save() afterward.
Returns 0 if $key is not associated with $obj, 1 if the relationship was successfully removed.
Throws:
Unsupported object type : $ref.
Side Effects: NONE
Notes: Cannot be called on an unsaved keyword. Call save() first.
Returns the name of this keyword
Throws: NONE
Side Effects: NONE
Notes: NONE
Sets the name of this keyword
Throws: NONE
Side Effects: NONE
Notes: NONE
Returns the screen name of this keyword. The screen name is how the synonym should be displayed on screen (i.e. name='george' screen_name='Washington, George')
Throws: NONE
Side Effects: NONE
Notes: NONE
Sets the screen name of this keyword.
Throws: NONE
Side Effects: NONE
Notes: NONE
Deprecated alias for get_active().
Throws: NONE
Side Effects: NONE
Notes: NONE
Deprecated alias for set_active().
Throws: NONE
Side Effects: NONE
Notes: NONE
Save the keyword to the database.
Throws:
"Unable to save";
Side Effects:
Will give default values to screen_name and sort_name if they are not set.
Notes: NONE
NONE
Selects keywords from the database given an SQL where clause and a ref to an array of bind parameters. Returns fully constructed Bric::Biz::Keyword objects.
Updates the keyword object in the database.
Inserts the new keyword object into the database.
Returns the correct relationship table and field name for a given supported object. For example, for a story object it returns ("story_keyword", "story_id").
Throws:
Unsupported object type : $ref.
Side Effects: NONE
Notes: NONE
NONE
"Garth Webb" <garth@perijove.com> Bricolage Engineering
Sam Tregar <stregar@about-inc.com>
Hey! The above document had some coding errors, which are explained below:
You forgot a '=back' before '=head2'
'=item' outside of any '=over'
You forgot a '=back' before '=head2'
'=item' outside of any '=over'
You forgot a '=back' before '=head2'