OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
Namespaces | |
spatial | |
Typedefs | |
typedef std::shared_ptr< BindLink > | BindLinkPtr |
typedef std::shared_ptr < DefineLink > | DefineLinkPtr |
typedef std::shared_ptr < LambdaLink > | LambdaLinkPtr |
typedef std::shared_ptr < PatternLink > | PatternLinkPtr |
typedef std::shared_ptr < VariableList > | VariableListPtr |
typedef std::shared_ptr< FreeLink > | FreeLinkPtr |
typedef std::shared_ptr< PutLink > | PutLinkPtr |
typedef std::shared_ptr < EvaluationLink > | EvaluationLinkPtr |
typedef std::shared_ptr < ExecutionOutputLink > | ExecutionOutputLinkPtr |
typedef std::shared_ptr < NumberNode > | NumberNodePtr |
typedef std::shared_ptr < ArithmeticLink > | ArithmeticLinkPtr |
typedef std::shared_ptr < AssignLink > | AssignLinkPtr |
typedef std::shared_ptr < InsertLink > | InsertLinkPtr |
typedef std::shared_ptr < RemoveLink > | RemoveLinkPtr |
typedef std::shared_ptr < DeleteLink > | DeleteLinkPtr |
typedef std::shared_ptr< FoldLink > | FoldLinkPtr |
typedef std::shared_ptr < FunctionLink > | FunctionLinkPtr |
typedef std::shared_ptr< PlusLink > | PlusLinkPtr |
typedef std::shared_ptr < TimesLink > | TimesLinkPtr |
typedef std::shared_ptr< TypeNode > | TypeNodePtr |
typedef std::shared_ptr< Link > | LinkPtr |
typedef std::vector< LinkPtr > | IncomingSet |
typedef std::weak_ptr< Link > | WinkPtr |
typedef std::set< WinkPtr, std::owner_less< WinkPtr > > | WincomingSet |
typedef boost::signals2::signal< void(AtomPtr, LinkPtr)> | AtomPairSignal |
typedef std::set< AtomPtr > | AtomPtrSet |
typedef boost::signals2::signal< void(const Handle &)> | AtomSignal |
typedef boost::signals2::signal< void(const AtomPtr &)> | AtomPtrSignal |
typedef boost::signals2::signal< void(const Handle &, const AttentionValuePtr &, const AttentionValuePtr &)> | AVCHSigl |
typedef boost::signals2::signal< void(const Handle &, const TruthValuePtr &, const TruthValuePtr &)> | TVCHSigl |
typedef boost::signals2::signal< void(const Handle &, const AttentionValuePtr &, const AttentionValuePtr &)> | AFCHSigl |
typedef std::shared_ptr < AttentionValue > | AttentionValuePtr |
typedef ClassServer * | ClassServerFactory (void) |
typedef boost::signals2::signal< void(Type)> | TypeSignal |
typedef std::shared_ptr < CountTruthValue > | CountTruthValuePtr |
typedef std::unordered_set < Atom * > | UnorderedAtomSet |
typedef std::shared_ptr < FuzzyTruthValue > | FuzzyTruthValuePtr |
typedef float | strength_t |
typedef float | confidence_t |
typedef double | count_t |
typedef double | entropy_t |
typedef std::shared_ptr < GenericTruthValue > | GenericTruthValuePtr |
typedef unsigned long | UUID |
UUID == Universally Unique Identifier. More... | |
typedef std::shared_ptr< Atom > | AtomPtr |
typedef std::vector< Handle > | HandleSeq |
a list of handles More... | |
typedef std::vector< HandleSeq > | HandleSeqSeq |
a list of lists of handles More... | |
typedef std::unordered_set < Handle, handle_hash > | UnorderedHandleSet |
a hash that associates the handle to its unique identificator More... | |
typedef std::shared_ptr < IndefiniteTruthValue > | IndefiniteTruthValuePtr |
typedef unsigned short | Arity |
arity of Links, represented as short integer (16 bits) More... | |
typedef std::shared_ptr< Node > | NodePtr |
typedef std::shared_ptr < ProbabilisticTruthValue > | ProbabilisticTruthValuePtr |
typedef std::shared_ptr < SimpleTruthValue > | SimpleTruthValuePtr |
typedef std::shared_ptr < TruthValue > | TruthValuePtr |
typedef unsigned short | Type |
type of Atoms, represented as short integer (16 bits) More... | |
typedef boost::tuple< clock_t, clock_t > | timepair_t |
typedef std::map< Handle, const std::set< Type > > | VariableTypeMap |
typedef std::shared_ptr < PatternTerm > | PatternTermPtr |
typedef std::vector < PatternTermPtr > | PatternTermSeq |
typedef std::map< Handle, UnorderedHandleSet > | VarMultimap |
typedef std::map< Handle, Handle > | VarMap |
Enumerations | |
enum | TruthValueType { NULL_TRUTH_VALUE = 0, SIMPLE_TRUTH_VALUE = 1, COUNT_TRUTH_VALUE, INDEFINITE_TRUTH_VALUE, FUZZY_TRUTH_VALUE, PROBABILISTIC_TRUTH_VALUE, NUMBER_OF_TRUTH_VALUE_TYPES } |
enum | TVMergeStyle { USE_OLDER_TV_TYPE, USE_NEWER_TV_TYPE, USE_STRONGER_TV_TYPE, USE_WEAKER_TV_TYPE, DEFAULT } |
enum | source_selection_mode { TV_FITNESS_BASED, STI_BASED } |
Functions | |
static BindLinkPtr | BindLinkCast (const Handle &h) |
static BindLinkPtr | BindLinkCast (AtomPtr a) |
static DefineLinkPtr | DefineLinkCast (const Handle &h) |
static DefineLinkPtr | DefineLinkCast (AtomPtr a) |
static LambdaLinkPtr | LambdaLinkCast (const Handle &h) |
static LambdaLinkPtr | LambdaLinkCast (AtomPtr a) |
static PatternLinkPtr | PatternLinkCast (const Handle &h) |
static PatternLinkPtr | PatternLinkCast (AtomPtr a) |
bool | remove_constants (const std::set< Handle > &vars, std::vector< Handle > &clauses) |
void | get_connected_components (const std::set< Handle > &vars, const HandleSeq &clauses, std::vector< HandleSeq > &components, std::vector< std::set< Handle >> &component_vars) |
HandleSeq | get_free_vars_in_tree (const Handle &tree) |
static VariableListPtr | VariableListCast (const Handle &h) |
static VariableListPtr | VariableListCast (AtomPtr a) |
static FreeLinkPtr | FreeLinkCast (const Handle &h) |
static FreeLinkPtr | FreeLinkCast (AtomPtr a) |
static PutLinkPtr | PutLinkCast (const Handle &h) |
static PutLinkPtr | PutLinkCast (AtomPtr a) |
static EvaluationLinkPtr | EvaluationLinkCast (const Handle &h) |
static EvaluationLinkPtr | EvaluationLinkCast (AtomPtr a) |
static ExecutionOutputLinkPtr | ExecutionOutputLinkCast (const Handle &h) |
static ExecutionOutputLinkPtr | ExecutionOutputLinkCast (AtomPtr a) |
static NumberNodePtr | NumberNodeCast (const Handle &h) |
static NumberNodePtr | NumberNodeCast (AtomPtr a) |
static ArithmeticLinkPtr | ArithmeticLinkCast (const Handle &h) |
static ArithmeticLinkPtr | ArithmeticLinkCast (AtomPtr a) |
static AssignLinkPtr | AssignLinkCast (const Handle &h) |
static AssignLinkPtr | AssignLinkCast (AtomPtr a) |
static InsertLinkPtr | InsertLinkCast (const Handle &h) |
static InsertLinkPtr | InsertLinkCast (AtomPtr a) |
static RemoveLinkPtr | RemoveLinkCast (const Handle &h) |
static RemoveLinkPtr | RemoveLinkCast (AtomPtr a) |
static DeleteLinkPtr | DeleteLinkCast (const Handle &h) |
static DeleteLinkPtr | DeleteLinkCast (AtomPtr a) |
static FoldLinkPtr | FoldLinkCast (const Handle &h) |
static FoldLinkPtr | FoldLinkCast (AtomPtr a) |
static FunctionLinkPtr | FunctionLinkCast (const Handle &h) |
static FunctionLinkPtr | FunctionLinkCast (AtomPtr a) |
static PlusLinkPtr | PlusLinkCast (const Handle &h) |
static PlusLinkPtr | PlusLinkCast (AtomPtr a) |
static TimesLinkPtr | TimesLinkCast (const Handle &h) |
static TimesLinkPtr | TimesLinkCast (AtomPtr a) |
static TypeNodePtr | TypeNodeCast (const Handle &h) |
static TypeNodePtr | TypeNodeCast (AtomPtr a) |
ClassServer & | classserver (ClassServerFactory *=ClassServer::createInstance) |
static bool | operator== (std::nullptr_t, const Handle &rhs) noexcept |
static bool | operator!= (std::nullptr_t, const Handle &rhs) noexcept |
std::size_t | hash_value (Handle const &h) |
Boost needs this function to be called by exactly this name. More... | |
static std::string | operator+ (const char *lhs, Handle h) |
append string representation of the Hash to the string More... | |
static std::string | operator+ (const std::string &lhs, Handle h) |
append string representation of the Hash to the string More... | |
static IndefiniteTruthValuePtr | IndefiniteTVCast (TruthValuePtr tv) |
static LinkPtr | LinkCast (const Handle &h) |
static LinkPtr | LinkCast (const AtomPtr &a) |
static NodePtr | NodeCast (const Handle &h) |
static NodePtr | NodeCast (const AtomPtr &a) |
Handle | add_prefixed_node (AtomSpace &as, Type t, const std::string &prefix) |
bool | remove_hypergraph (AtomSpace &as, Handle h) |
HandleSeq | get_all_nodes (Handle h) |
UnorderedHandleSet | get_all_unique_nodes (Handle h) |
HandleSeq | get_all_atoms (Handle h) |
UnorderedHandleSet | get_all_unique_atoms (Handle h) |
HandleSeq | get_neighbors (const Handle &h, bool fanin, bool fanout, Type desiredLinkType, bool subClasses) |
UnorderedHandleSet | get_outgoing_nodes (const Handle &hinput, const std::vector< Type > &types) |
static void | get_distant_neighbors_rec (const Handle &h, UnorderedHandleSet &res, int dist) |
UnorderedHandleSet | get_distant_neighbors (const Handle &h, int dist) |
HandleSeq | get_predicates (const Handle &target, Type predicateType, bool subClasses) |
HandleSeq | get_predicates_for (const Handle &target, const Handle &predicate) |
static bool | is_atom_in_tree (const Handle &tree, const Handle &atom) |
static bool | is_quoted_in_tree (const Handle &tree, const Handle &atom) |
static bool | is_unquoted_in_tree (const Handle &tree, const Handle &atom) |
static bool | any_atom_in_tree (const Handle &tree, const std::set< Handle > &atoms) |
static bool | any_unquoted_in_tree (const Handle &tree, const std::set< Handle > &atoms) |
static unsigned int | num_unquoted_in_tree (const Handle &tree, const std::set< Handle > &atoms) |
static bool | is_atom_in_any_tree (const std::vector< Handle > &trees, const Handle &atom) |
static bool | is_unquoted_in_any_tree (const std::vector< Handle > &trees, const Handle &atom) |
static bool | contains_atomtype (const Handle &clause, Type atom_type) |
template<typename T > | |
bool | foreach_binary_link (const Handle &h, Type ltype, bool(T::*cb)(const Handle &), T *data) |
template<typename T > | |
bool | foreach_binary_link (const Handle &h, Type ltype, bool(T::*cb)(const Handle &, const Handle &), T *data) |
template<typename T > | |
bool | foreach_reverse_binary_link (const Handle &h, Type ltype, bool(T::*cb)(const Handle &), T *data) |
template<typename T > | |
bool | foreach_reverse_binary_link (const Handle &h, Type ltype, bool(T::*cb)(const Handle &, const Handle &), T *data) |
template<typename T > | |
bool | foreach_link (const Handle &h, Type ltype, int from, int to, bool(T::*cb)(const Handle &), T *data) |
template<typename T > | |
bool | foreach_link (const Handle &h, Type ltype, int from, int to, bool(T::*cb)(const Handle &, const Handle &), T *data) |
template<typename T > | |
bool | foreach_unordered_binary_link (const Handle &h, Type ltype, bool(T::*cb)(const Handle &), T *data) |
template<typename T > | |
bool | foreach_unordered_binary_link (const Handle &h, Type ltype, bool(T::*cb)(const Handle &, const Handle &), T *data) |
template<class T > | |
bool | foreach_atom_pair (const std::vector< Handle > &va, const std::vector< Handle > &vb, bool(T::*cb)(const Handle &, const Handle &), T *data) |
Handle | stub_bindlink (AtomSpace *, Handle) |
Handle | do_execute (AtomSpace *, Handle) |
std::string | eval_scheme (AtomSpace &as, const std::string &s) |
Handle | eval_scheme_h (AtomSpace &as, const std::string &s) |
void | initialize_opencog (AtomSpace *atomSpace, const char *configFile=NULL) |
void | finalize_opencog () |
void | configuration_load (const char *configFile) |
void | global_python_initialize () |
void | global_python_finalize () |
int | load_scm_file (AtomSpace &as, const std::string &filename) |
int | load_scm_file_relative (AtomSpace &as, const std::string &filename, std::vector< std::string > search_paths) |
void | load_scm_files_from_config (AtomSpace &atomSpace, std::vector< std::string > search_paths) |
DECLARE_DECLARE_3 (const std::string &, const std::string &, const std::string &, const std::string &) DECLARE_DECLARE_3(void | |
Handle | bindlink (AtomSpace *, const Handle &) |
Handle | single_bindlink (AtomSpace *, const Handle &) |
Handle | af_bindlink (AtomSpace *, const Handle &) |
TruthValuePtr | satisfaction_link (AtomSpace *, const Handle &) |
Handle | satisfying_set (AtomSpace *, const Handle &) |
Handle | find_approximate_match (AtomSpace *, const Handle &, Type rtn_type=0, const HandleSeq &excl_list={}) |
static Handle | do_imply (AtomSpace *as, const Handle &hbindlink, Implicator &impl, bool do_conn_check=false) |
Variables | |
const bool | NO_SUBCLASSES = false |
tuple | __path__ = extend_path(__path__, __name__) |
Utilities for mangling graphs
Copyright (C) 2009, 2014 Linas Vepstas linas All Rights Reserved veps tas@g mail .com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3 as published by the Free Software Foundation and including the exceptions at http://opencog.org/wiki/Licenses
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program; if not, write to: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Created by Linas Vepstas February 2008
class Instantiator – create grounded expressions from ungrounded ones. Given an ungrounded expression (i.e. an expression containing variables) and a map between variables and ground terms, it will create a new expression, with the ground terms substituted for the variables.
This also implements generic execution: any executable links are executed as the variable substitution is performed. In particular, execution is implemented as instantiation, with an empty variable map.
basic type definitions.
Utilities for finding atoms in trees.
Copyright (C) 2009, 2014, 2015 Linas Vepstas linas All Rights Reserved veps tas@g mail .com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3 as published by the Free Software Foundation and including the exceptions at http://opencog.org/wiki/Licenses
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program; if not, write to: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Created by Linas Vepstas February 2008
Follow a link. Given an atom and a link type, follow the link and and return another atom in the link. It is assumed that there is only one link of the given type that is attached to the given atom; the methods here return the first match found. If multiple-link support is needed, use the ForeachChaseLink<T> class.
This method includes two utility routines, meant to follow binary links (i.e. links with only two members).
Copyright (c) 2008 Linas Vepstas linas @lin as.or g
This file implements a number of link-chasing routines. By "link-chasing", it is meant: given an input atom, find all links of some given link-type that contain it, and then, call a callback on each of the other elements in that link.
Thus, for example, given the hypergraph
SomeLink FirstAtom SecondAtom
then, given a handle to "FirstAtom", and the link type "SomeLink", the "foreach_binary_link" will call the callback on "SecondAtom".
The link-chasing is order dependent; if, instead, one has "SecondAtom" and one wants "FirstAtom", then use the "foreach_reverse_binary_link" routine.
The "foreach_unordered_binary_link" is not order-dependent; given either atom in the link, it will return the other.
The "foreach_link" routine provides the analogous service for N-ary links.
To summarize: foreach_binary_link – follow an ordered, binary link. foreach_reverse_binary_link - follow binary link in reverse. foreach_link – follow an ordered N-ary link. foreach_unordered_binary_link - chase link from one to other atom.
Copyright (c) 2008 Linas Vepstas linas @lin as.or g
Basic pattern-matching iterator constructs.
Copyright (c) 2008,2011 Linas Vepstas linas @lin as.or g
The GenericEval class implements a very simple API for language evaluators. Currently, its sole purpose in life is to make the abstraction of the GenericShell class possible.
typedef std::shared_ptr<Atom> opencog::AtomPtr |
typedef float opencog::confidence_t |
Definition at line 36 of file GenericTruthValue.h.
typedef double opencog::count_t |
Definition at line 37 of file GenericTruthValue.h.
typedef double opencog::entropy_t |
Definition at line 38 of file GenericTruthValue.h.
typedef std::shared_ptr<GenericTruthValue> opencog::GenericTruthValuePtr |
Definition at line 40 of file GenericTruthValue.h.
typedef std::vector<Handle> opencog::HandleSeq |
typedef std::vector<HandleSeq> opencog::HandleSeqSeq |
typedef std::shared_ptr<PatternTerm> opencog::PatternTermPtr |
Definition at line 35 of file PatternTerm.h.
typedef std::vector<PatternTermPtr> opencog::PatternTermSeq |
Definition at line 37 of file PatternTerm.h.
typedef float opencog::strength_t |
Definition at line 35 of file GenericTruthValue.h.
typedef boost::tuple<clock_t,clock_t> opencog::timepair_t |
Definition at line 19 of file AtomSpaceBenchmark.h.
typedef std::shared_ptr<TruthValue> opencog::TruthValuePtr |
Definition at line 85 of file TruthValue.h.
typedef std::unordered_set<Handle, handle_hash> opencog::UnorderedHandleSet |
typedef unsigned long opencog::UUID |
typedef std::map< Handle, Handle > opencog::VarMap |
Definition at line 39 of file BackwardChainer.h.
typedef std::map< Handle, UnorderedHandleSet > opencog::VarMultimap |
Definition at line 38 of file BackwardChainer.h.
Enumerator | |
---|---|
TV_FITNESS_BASED | |
STI_BASED |
Definition at line 32 of file ForwardChainerCallBack.h.
TruthValue types XXX TODO This should probably be removed. The truth-value types are currently used in only two places; The guile interpreter, and the SQL peristance layer. Both of these layers should almost surely use their own private system for serializing/deserializing truth value types, instead of using this. This is unstable, and should be removed ...
Enumerator | |
---|---|
NULL_TRUTH_VALUE | |
SIMPLE_TRUTH_VALUE | |
COUNT_TRUTH_VALUE | |
INDEFINITE_TRUTH_VALUE | |
FUZZY_TRUTH_VALUE | |
PROBABILISTIC_TRUTH_VALUE | |
NUMBER_OF_TRUTH_VALUE_TYPES |
Definition at line 63 of file TruthValue.h.
Enumerator | |
---|---|
USE_OLDER_TV_TYPE | |
USE_NEWER_TV_TYPE | |
USE_STRONGER_TV_TYPE | |
USE_WEAKER_TV_TYPE | |
DEFAULT |
Definition at line 76 of file TruthValue.h.
Attentional Focus specific PatternMatchCallback implementation
Definition at line 182 of file Implicator.cc.
References do_imply().
|
inlinestatic |
Return true if any of the indicated atoms occur somewhere in the tree (that is, in the tree spanned by the outgoing set.)
Definition at line 252 of file FindUtils.h.
References is_atom_in_tree().
|
inlinestatic |
Return true if any of the indicated atoms occur somewhere in the tree (that is, in the tree spanned by the outgoing set.) But ONLY if they are not quoted! This is intended to be used to search for variables; but when a variable is quoted, it is no longer a variable.
Definition at line 269 of file FindUtils.h.
References is_unquoted_in_tree().
Evaluate a pattern and rewrite rule embedded in a BindLink
Use the default implicator to find pattern-matches. Associated truth values are completely ignored during pattern matching; if a set of atoms that could be a ground are found in the atomspace, then they will be reported.
See the do_bindlink function documentation for details.
Definition at line 156 of file Implicator.cc.
References do_imply().
void opencog::configuration_load | ( | const char * | configFile | ) |
Definition at line 64 of file Utilities.cc.
|
inlinestatic |
Returns true if the clause contains an atom of type atom_type. ... but only if it is not quoted. Quoted terms are constants (literals).
Definition at line 329 of file FindUtils.h.
References classserver(), opencog::Atom::getType(), and LinkCast().
Definition at line 16 of file BindlinkStub.cc.
References createExecutionOutputLink, opencog::FunctionLink::do_execute(), ExecutionOutputLinkCast(), opencog::Atom::getType(), and LinkCast().
|
static |
Simplified utility
The do_conn_check
flag stands for "do connectivity check"; if the flag is set, and the pattern is disconnected, then an error will be thrown. The URE explicitly allows disconnected graphs.
Set the default to always allow disconnected graphs. This will get naive users into trouble, but there are legit uses, not just in the URE, for doing disconnected searches.
Definition at line 99 of file Implicator.cc.
References opencog::AtomSpace::add_link(), BindLinkCast(), createBindLink, opencog::Implicator::get_result_list(), opencog::Implicator::implicand, opencog::Implicator::insert_result(), opencog::Implicator::inst, opencog::Instantiator::instantiate(), LinkCast(), opencog::Pattern::mandatory, opencog::Pattern::optionals, and opencog::DefaultPatternMatchCB::optionals_present().
std::string opencog::eval_scheme | ( | AtomSpace & | as, |
const std::string & | s | ||
) |
For easier wrapping by Cython
Definition at line 48 of file PyScheme.cc.
References check_err(), opencog::SchemeEval::eval(), and opencog::SchemeEval::get_evaluator().
Definition at line 61 of file PyScheme.cc.
References check_err(), opencog::SchemeEval::eval_h(), and opencog::SchemeEval::get_evaluator().
void opencog::finalize_opencog | ( | ) |
Definition at line 55 of file Utilities.cc.
References opencog::PythonEval::delete_singleton_instance(), and global_python_finalize().
Handle opencog::find_approximate_match | ( | AtomSpace * | as, |
const Handle & | hp, | ||
Type | rtn_type = 0 , |
||
const HandleSeq & | excl_list = {} |
||
) |
Implement the "cog-fuzzy-match" scheme primitive. It uses the Pattern Matcher to find hypergraphs in the atomspace that are similar to the query hypergraph, and returns the most similar ones.
as | The atomspace that we are using |
hp | The query hypergraph |
rtn_type | The type of atoms that we want |
excl_list | A list of atoms that we don't want any of them to exist in the results |
Definition at line 45 of file FuzzyPatternMatch.cc.
References opencog::AtomSpace::add_link(), createPatternLink, opencog::FuzzyPatternMatchCB::solns, opencog::Atom::toShortString(), and opencog::Handle::UNDEFINED.
void opencog::get_connected_components | ( | const std::set< Handle > & | vars, |
const HandleSeq & | clauses, | ||
std::vector< HandleSeq > & | components, | ||
std::vector< std::set< Handle >> & | component_vars | ||
) |
Given an input set of clauses, partition this set into its connected components, returning a list of the connected components, and a matching list of the variables that appear in each component. The input set of clauses are assumed to be in conjunctive normal form; i.e. they do NOT contain any OrLinks. If they do, then you must used the get_disjoined_components()
function, below.
Two clauses are "connected" if they both contain a common variable. A connected component is the set of all clauses that are connected to one-another, in some way.
This method serves two different purposes. First, if the pattern does not contain any "virtual" links, then the pattern matcher works correctly only if there is one single, connected component (this is by design, since we don't want to deal with the combinatoric explosion of grounding multuple distinct components). If the pattern does contain "virtual" links, then the connected components should be grounded first, and the results then combined by exploring the combinatoric possibilites presented by the virtual link(s).
A side effect of the algorithm is that it sorts the clauses into connected order. That is, given the vector of connected clauses, each element in the vector is connected to some clause that came before it (in the vector). This is handy, because it guarantees that the next clause must be connected to the previous ones. This speeds up the discovery of the next ungrounded clause: it is trivially just the very next clause in the connected set. Of course, users will typically never specify clauses in such order.
Definition at line 109 of file PatternUtils.cc.
References any_unquoted_in_tree(), opencog::FindAtoms::search_set(), and opencog::FindAtoms::varset.
|
static |
Definition at line 191 of file AtomUtils.cc.
References opencog::Atom::getHandle(), opencog::Atom::getIncomingSet(), and LinkCast().
Search for free VariableNode in a tree.
Currently assume any variables within a LambdaLink (and its subtype) are bound, since some subtype does implicit binding.
Treat $A in something like (AndLink $A (LambdaLink $A ...)) as free.
XXX TODO when implicit binding is gone, this method should be changed
Definition at line 186 of file PatternUtils.cc.
References classserver(), LinkCast(), and python.undocumented.blocksworld::t.
void opencog::global_python_finalize | ( | ) |
Finalize Python. Call to cleanup memory used by Python interpreters.
Definition at line 329 of file PythonEval.cc.
References already_initialized, and initialized_outside_opencog.
void opencog::global_python_initialize | ( | ) |
Initialize Python. Must be called before any Python dependent modules are loaded.
Definition at line 263 of file PythonEval.cc.
References already_initialized, get_module_paths(), initialized_outside_opencog, NO_SIGNAL_HANDLERS, and try_to_load_modules().
|
inline |
Boost needs this function to be called by exactly this name.
Definition at line 230 of file Handle.h.
References opencog::Handle::value().
void opencog::initialize_opencog | ( | AtomSpace * | atomSpace, |
const char * | configFile = NULL |
||
) |
Definition at line 15 of file Utilities.cc.
References opencog::PythonEval::create_singleton_instance(), and global_python_initialize().
|
inlinestatic |
Return true if the indicated atom occurs somewhere in any of the trees.
Definition at line 300 of file FindUtils.h.
References is_atom_in_tree().
|
inlinestatic |
Return true if the indicated atom occurs somewhere in the tree (viz, the tree recursively spanned by the outgoing set of the handle)
Definition at line 186 of file FindUtils.h.
References LinkCast(), and opencog::Handle::UNDEFINED.
|
inlinestatic |
Return true if the indicated atom occurs quoted somewhere in the tree. That is, it returns true only if the atom is inside a QuoteLink.
Definition at line 205 of file FindUtils.h.
References opencog::Atom::getType(), is_atom_in_tree(), LinkCast(), and opencog::Handle::UNDEFINED.
|
inlinestatic |
Return true if the indicated atom occurs somewhere in any of the trees, but only if it is not quoted. This is intended to be used to search for variables, which cease to be variable when they are quoted.
Definition at line 315 of file FindUtils.h.
References is_unquoted_in_tree().
|
inlinestatic |
Return true if the indicated atom occurs unquoted somewhere in the tree (viz, the tree recursively spanned by the outgoing set of the handle) but ONLY if it is not quoted! This is meant to be be used to search for variables, but only those variables that have not been quoted, as the quoted variables are constants (literals).
Definition at line 232 of file FindUtils.h.
References opencog::Atom::getType(), LinkCast(), and opencog::Handle::UNDEFINED.
|
inlinestatic |
Return how many of the indicated atoms occur somewhere in the tree (that is, in the tree spanned by the outgoing set.) But ONLY if they are not quoted! This is intended to be used to search for variables; but when a variable is quoted, it is no longer a variable.
Definition at line 286 of file FindUtils.h.
References is_unquoted_in_tree().
|
inlinestaticnoexcept |
|
inlinestatic |
append string representation of the Hash to the string
Definition at line 269 of file Handle.h.
References opencog::Handle::value().
|
inlinestatic |
append string representation of the Hash to the string
Definition at line 278 of file Handle.h.
References opencog::Handle::value().
|
inlinestaticnoexcept |
Remove constant clauses from the list of clauses.
Make sure that every clause contains at least one variable; if not, remove the clause from the list of clauses.
The core idea is that pattern matching against a constant expression "doesn't make sense" – the constant expression will always match to itself and is thus "trivial". In principle, the programmer should never include constants in the list of clauses ... but, due to programmer error, this can happen, and will lead to failures during pattern matching. Thus, the routine below can be used to validate the input.
Terms that contain GroundedSchema or GroundedPrecdicate nodes can have side-effects, and are thus not really constants. They must be evaluated during the pattern search.
Returns true if the list of clauses was modified, else returns false.
Definition at line 51 of file PatternUtils.cc.
References any_unquoted_in_tree(), and contains_atomtype().
TruthValuePtr opencog::satisfaction_link | ( | AtomSpace * | as, |
const Handle & | hlink | ||
) |
Definition at line 67 of file Satisfier.cc.
References opencog::Satisfier::_result, classserver(), createPatternLink, opencog::Atom::getType(), LinkCast(), and PatternLinkCast().
Definition at line 86 of file Satisfier.cc.
References opencog::SatisfyingSet::_satisfying_set, opencog::AtomSpace::add_link(), classserver(), createPatternLink, opencog::Atom::getType(), LinkCast(), and PatternLinkCast().
Evaluate an pattern and rewrite rule embedded in a BindLink
Returns the first match only. Otherwise, the behavior is identical to PatternMatch::bindlink above.
See the do_bindlink function documentation for details.
Definition at line 171 of file Implicator.cc.
References do_imply(), and opencog::Implicator::max_results.
tuple opencog.__path__ = extend_path(__path__, __name__) |
Definition at line 2 of file __init__.py.