OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <Implicator.h>
Public Member Functions | |
Implicator (AtomSpace *as) | |
virtual bool | grounding (const std::map< Handle, Handle > &var_soln, const std::map< Handle, Handle > &term_soln) |
virtual void | insert_result (const Handle &) |
virtual UnorderedHandleSet | get_result_set () |
virtual HandleSeq | get_result_list () |
![]() | |
virtual | ~PatternMatchCallback () |
virtual bool | node_match (const Handle &patt_node, const Handle &grnd_node)=0 |
virtual bool | variable_match (const Handle &patt_node, const Handle &grnd_node)=0 |
virtual bool | link_match (const LinkPtr &patt_link, const LinkPtr &grnd_link)=0 |
virtual bool | post_link_match (const LinkPtr &patt_link, const LinkPtr &grnd_link) |
virtual bool | fuzzy_match (const Handle &ph, const Handle &gh) |
virtual bool | evaluate_sentence (const Handle &eval, const std::map< Handle, Handle > &gnds)=0 |
virtual bool | clause_match (const Handle &pattrn_link_h, const Handle &grnd_link_h) |
virtual bool | optional_clause_match (const Handle &pattrn, const Handle &grnd)=0 |
virtual IncomingSet | get_incoming_set (const Handle &h) |
virtual void | push (void) |
virtual void | pop (void) |
virtual const std::set< Type > & | get_connectives (void) |
virtual bool | initiate_search (PatternMatchEngine *)=0 |
virtual void | set_pattern (const Variables &vars, const Pattern &pat)=0 |
Public Attributes | |
Instantiator | inst |
Handle | implicand |
size_t | max_results |
Protected Attributes | |
UnorderedHandleSet | _result_set |
HandleSeq | _result_list |
bool | _result_changed |
class Implicator – pattern matching callback for grounding implicands.
This class is meant to be used with the pattern matcher. When the pattern matcher calls the callback, it will do so with a particular grounding of the search pattern. If this class is holding an ungrounded implicand, it will create a grounded version of the implicand. If the implicand is already grounded, then it's a no-op – this class alone will NOT change its truth value. Use a derived class for this.
The 'var_soln' argument in the callback contains the map from variables to ground terms. 'class Instantiator' is used to perform the actual grounding. A set of grounded expressions is created in 'result_set'. Note that the callback may be called many times reporting the same results. In that case the 'result_set' will contain unique solutions.
Definition at line 54 of file Implicator.h.
|
inline |
Definition at line 63 of file Implicator.h.
|
virtual |
Returns unique results from 'result_set' converted to list.
Definition at line 72 of file Implicator.cc.
References _result_changed, _result_list, and _result_set.
|
inlinevirtual |
Definition at line 73 of file Implicator.h.
References _result_set.
|
virtual |
This callback takes the reported grounding, runs it through the instantiator, to create the implicand, and then records the result in the public member result_set
. If the number of results so far is less than max_results
, it then returns false, to search for more groundings. (The engine will halt its search for a grounding once an acceptable one has been found; so, to continue hunting for more, we return false
here. We want to find all possible groundings.)
Implements opencog::PatternMatchCallback.
Reimplemented in opencog::ForwardChainerPMCB, and opencog::VarGroundingPMCB.
Definition at line 44 of file Implicator.cc.
References _result_set, implicand, insert_result(), inst, opencog::Instantiator::instantiate(), and max_results.
|
virtual |
Definition at line 57 of file Implicator.cc.
References _result_changed, _result_set, and opencog::Handle::UNDEFINED.
|
protected |
Definition at line 60 of file Implicator.h.
|
protected |
Definition at line 59 of file Implicator.h.
|
protected |
Definition at line 58 of file Implicator.h.
Handle opencog::Implicator::implicand |
Definition at line 66 of file Implicator.h.
Instantiator opencog::Implicator::inst |
Definition at line 65 of file Implicator.h.
size_t opencog::Implicator::max_results |
Definition at line 67 of file Implicator.h.