OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <Substitutor.h>
Public Member Functions | |
Substitutor (AtomSpace *as) | |
Handle | substitute (const Handle &expr, const std::map< Handle, Handle > &vars) |
Private Member Functions | |
Handle | walk_tree (const Handle &expr) |
Private Attributes | |
AtomSpace * | _as |
const std::map< Handle, Handle > * | _vmap |
Like the Instantiator but does not execute stuff, and also works for non-VariableNode.
Also a bit like VariableList's substitute, but again also works for non-VariableNode.
Won't recurse into the atom substituted; so if the new atom also contains sub-atom to be subsituted, they will be ignored.
Definition at line 44 of file Substitutor.h.
|
inline |
Definition at line 74 of file Substitutor.h.
|
inline |
The main method to call to substitue sub-atoms.
expr | the original atom |
vars | an atom to atom mapping |
Definition at line 83 of file Substitutor.h.
References _as, _vmap, opencog::AtomSpace::add_atom(), opencog::Handle::UNDEFINED, and walk_tree().
Definition at line 50 of file Substitutor.h.
References _vmap, createLink, opencog::Atom::getTruthValue(), opencog::Atom::getType(), and opencog::LinkCast().
|
private |
Definition at line 47 of file Substitutor.h.
Definition at line 48 of file Substitutor.h.