OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
opencog::Rule Class Reference

#include <Rule.h>

+ Inheritance diagram for opencog::Rule:
+ Collaboration diagram for opencog::Rule:

Public Member Functions

 Rule (Handle rule)
 
bool operator== (const Rule &r) const
 
bool operator< (const Rule &r) const
 
void set_handle (Handle h) throw (InvalidParamException)
 
void set_name (const string &name)
 
void set_category (const string &name)
 
void set_weight (float p)
 
string & get_name ()
 
const string & get_name () const
 
string & get_category ()
 
const string & get_category () const
 
Handle get_handle ()
 
Handle get_vardecl ()
 
Handle get_implicant ()
 
HandleSeq get_implicant_seq ()
 
Handle get_implicand ()
 
HandleSeq get_implicand_seq ()
 
float get_weight ()
 
Rule gen_standardize_apart (AtomSpace *as)
 

Private Member Functions

Handle standardize_helper (AtomSpace *as, Handle, std::map< Handle, Handle > &)
 

Private Attributes

Handle rule_handle_
 
string name_
 
string category_
 
float weight_
 

Detailed Description

Mainly wraps a BindLink but with other important attributes

Definition at line 39 of file Rule.h.

Constructor & Destructor Documentation

Member Function Documentation

Rule Rule::gen_standardize_apart ( AtomSpace as)

Create a new rule where all variables are renamed.

Parameters
aspointer to the atomspace where the new BindLink will be added
Returns
a new Rule object with its own new BindLink

Definition at line 220 of file Rule.cc.

References rule_handle_, set_handle(), and standardize_helper().

+ Here is the caller graph for this function:

string & Rule::get_category ( )

Definition at line 63 of file Rule.cc.

References category_.

const string & Rule::get_category ( ) const

Definition at line 68 of file Rule.cc.

References category_.

Handle Rule::get_handle ( )

Definition at line 93 of file Rule.cc.

References rule_handle_.

+ Here is the caller graph for this function:

Handle Rule::get_implicand ( void  )

Get the implicand (output) of the rule defined in a BindLink.

Returns
the Handle of the implicand

Definition at line 146 of file Rule.cc.

References opencog::BindLinkCast(), rule_handle_, and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

HandleSeq Rule::get_implicand_seq ( )

Get the implicand (output) of the rule defined in a BindLink.

This function does extra processing to find the real output over an ExecutionOutputLink. ie, skip to the ListLink under the ExLink.

Returns
the HandleSeq of the implicand

Definition at line 163 of file Rule.cc.

References opencog::BindLinkCast(), opencog::Atom::getType(), opencog::LinkCast(), rule_handle_, and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

Handle Rule::get_implicant ( )

Get the implicant (input) of the rule defined in a BindLink.

Returns
the Handle of the implicant

Definition at line 113 of file Rule.cc.

References opencog::BindLinkCast(), rule_handle_, and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

HandleSeq Rule::get_implicant_seq ( )

Get the set of members of the implicant which are connected by a root logical link.

Returns
HandleSeq of members of the implicant

Definition at line 128 of file Rule.cc.

References get_implicant(), opencog::Atom::getType(), opencog::LinkCast(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

string & Rule::get_name ( void  )

Definition at line 78 of file Rule.cc.

References name_.

+ Here is the caller graph for this function:

const string & Rule::get_name ( void  ) const

Definition at line 83 of file Rule.cc.

References name_.

Handle Rule::get_vardecl ( )

Get the typed variable list of the Rule.

Returns
the VariableList or the lone VariableNode

Definition at line 103 of file Rule.cc.

References opencog::LinkCast(), and rule_handle_.

+ Here is the caller graph for this function:

float Rule::get_weight ( )

Definition at line 53 of file Rule.cc.

References weight_.

bool opencog::Rule::operator< ( const Rule r) const
inline

Definition at line 54 of file Rule.h.

References weight_.

bool opencog::Rule::operator== ( const Rule r) const
inline

Definition at line 51 of file Rule.h.

References rule_handle_.

void Rule::set_category ( const string &  name)

Definition at line 58 of file Rule.cc.

References category_.

void Rule::set_handle ( Handle  h)
throw (InvalidParamException
)

Definition at line 88 of file Rule.cc.

+ Here is the caller graph for this function:

void Rule::set_name ( const string &  name)

Definition at line 73 of file Rule.cc.

References name_.

void Rule::set_weight ( float  p)

Definition at line 209 of file Rule.cc.

References weight_.

Handle Rule::standardize_helper ( AtomSpace as,
Handle  h,
std::map< Handle, Handle > &  dict 
)
private

Basic helper function to standardize apart the BindLink.

Parameters
aspointer to an atomspace where new atoms are added
han input atom to standardize apart
dicta mapping of old VariableNode and new VariableNode
Returns
the new atom

Definition at line 240 of file Rule.cc.

References opencog::AtomSpace::add_atom(), createLink, createNode, opencog::Atom::getTruthValue(), opencog::Atom::getType(), opencog::LinkCast(), opencog::NodeCast(), and rule_handle_.

+ Here is the caller graph for this function:

Member Data Documentation

string opencog::Rule::category_
private

Definition at line 87 of file Rule.h.

string opencog::Rule::name_
private

Definition at line 84 of file Rule.h.

Handle opencog::Rule::rule_handle_
private

Definition at line 81 of file Rule.h.

float opencog::Rule::weight_
private

Definition at line 91 of file Rule.h.


The documentation for this class was generated from the following files: