OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <Instantiator.h>
Public Member Functions | |
Instantiator (AtomSpace *as) | |
Handle | instantiate (const Handle &expr, const std::map< Handle, Handle > &vars) |
Handle | execute (const Handle &expr) |
Private Member Functions | |
Handle | walk_tree (const Handle &tree) |
Private Attributes | |
AtomSpace * | _as |
const std::map< Handle, Handle > * | _vmap |
bool | _halt = false |
Definition at line 42 of file Instantiator.h.
|
inline |
Definition at line 67 of file Instantiator.h.
Definition at line 70 of file Instantiator.h.
References instantiate().
instantiate – create a grounded expression from an ungrounded one.
Given a handle to an ungrounded expression, and a set of groundings, this will create a grounded expression.
The set of groundings is to be passed in with the map 'vars', which maps variable names to their groundings – it maps variable names to atoms that already exist in the atomspace. This method will then go through all of the variables in the expression, and substitute them with their values, creating a new expression. The new expression is added to the atomspace, and its handle is returned.
Definition at line 194 of file Instantiator.cc.
References _as, _vmap, opencog::AtomSpace::add_atom(), opencog::Handle::UNDEFINED, and walk_tree().
Recursively walk a tree starting with the root of the hypergraph to instantiate (typically an ExecutionOutputLink).
Return the current result of the execution. If the node is an ExecutionOutputLink then it returns the final result. If the node is another list (typically a ListLink) it returns a copy of it, replacing the variables in its outgoing by their respective groundings.
See also the related function VariableList::substitute(), which will simply perform a substitution, without performing any execution. See also PutLink, which does substituion. (actually, beta reduction).
Definition at line 33 of file Instantiator.cc.
References _as, _halt, _vmap, opencog::AtomSpace::add_atom(), opencog::classserver(), createExecutionOutputLink, createLink, createPutLink, opencog::FunctionLink::factory(), opencog::FunctionLinkCast(), opencog::Atom::getTruthValue(), opencog::Atom::getType(), opencog::LinkCast(), opencog::PutLinkCast(), python.stop_go::red, opencog::AtomSpace::remove_atom(), opencog::satisfying_set(), python.undocumented.blocksworld::t, and opencog::Handle::UNDEFINED.
|
private |
Definition at line 45 of file Instantiator.h.
|
private |
Definition at line 47 of file Instantiator.h.
Definition at line 46 of file Instantiator.h.