The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

AI::ExpertSystem::Simple::Knowledge - Utility class for a simple expert system

VERSION

This document refers to verion 1.2 of AI::ExpertSystem::Simple::Knowledge, released June 10, 2003

SYNOPSIS

This class handles the attributes and their values within the expert system along with the optional question that can be asked of the user to set the value of the attribute. The valid responses to the optional question are also held.

DESCRIPTION

Overview

This is a utility class for AI::ExpertSystem::Simple

Constructors and initialisation

new( NAME )

The constructor sets up the basic attribute name / value pairing. In the base case an attribute has a name with no value.

Optional questions and the valid responses can be set later and the value of the attribute is set during the consultation.

Public methods

reset( )

Resets the state of knowledge back to what it was when the object was created

set_value( VALUE, SETTER )

During the consultation process the VALUE for an attribute can be set by either asking the user a question or by deduction. The value is then recorded along with the rule that set the value (or blank it if was a question).

get_value( )

Returns the current value of the attribute.

get_setter( )

Returns the current setter of the attribute.

is_value_set( )

Returns true if the value of the attribute is set or false if not.

set_question( QUESTION, RESPONSES )

Allows a question to ask of the user to set the value of the attribute. QUESTION is the text that will be displayed to the user and RESPONSES is a list of valid responses that the user may select from.

get_question( )

Returns the QUESTION and list of valid RESPONSES for the attribute.

has_question( )

Returns true if the attribute has a question to ask the user if the VALUE of the attribute has not already been set.

name( )

This method returns the value of the NAME argument that was set when the object was constructed.

Private methods

None

ENVIRONMENT

None

DIAGNOSTICS

Knowledge->new() takes 1 argument

When the constructor is initialised it requires one argument. This message is given if more of less arguments are given.

Knowledge->new() argument 1, (NAME) is undefined

The correct number of arguments were supplied to the constructor, however the first argument, NAME, was undefined.

Knowledge->reset() takes no arguments

When the method is called it requires no arguments. This message is given if some where supplied.

Knowledge->set_value() takes 2 argument

When the method is called it requires two arguments. This message is given if more of less arguments are given.

Knowledge->set_value() argument 1, (VALUE) is undefined

The correct number of arguments were supplied to the method call, however the first argument, VALUE, was undefined.

Knowledge->set_value() argument 2, (SETTER) is undefined

The correct number of arguments were supplied to the method call, however the second argument, SETTER, was undefined.

Knowledge->set_value() has already been set

This method has already been called and the value set. It cannot be called twice.

Knowledge->get_value() takes no arguments

When the method is called it requires no arguments. This message is given if some where supplied.

Knowledge->get_setter() takes no arguments

When the method is called it requires no arguments. This message is given if some where supplied.

Knowledge->is_value_set() takes no arguments

When the method is called it requires no arguments. This message is given if some where supplied.

Knowledge->set_question() takes 2 arguments

When the method is called it requires two arguments. This message is given if more of less arguments are given.

Knowledge->set_question() argument 1, (QUESTION) is undefined

The correct number of arguments were supplied to the method call, however the first argument, QUESTION, was undefined.

Knowledge->set_question() has already been set

This method has already been called and the value set. It cannot be called twice.

Knowledge->get_question() takes no arguments

When the method is called it requires no arguments. This message is given if some where supplied.

Knowledge->get_question() has not been set

The value has not been set by Knowledge->set_question() and, therefore, cannot be retrieved.

Knowledge->has_question() takes no arguments

When the method is called it requires no arguments. This message is given if some where supplied.

Knowledge->name() takes no arguments

When the method is called it requires no arguments. This message is given if some where supplied.

BUGS

None

FILES

See Knowledge.t in the test directory

SEE ALSO

AI::ExpertSystem::Simple - The base class for the expert system shell

AI::ExpertSystem::Simple::Goal - A utility class

AI::ExpertSystem::Simple::Rules - A utility class

AUTHORS

Peter Hickman (peterhi@ntlworld.com)

COPYRIGHT

Copyright (c) 2003, Peter Hickman. All rights reserved.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.