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

#include <AtomSpace.h>

+ Collaboration diagram for opencog::AtomSpace:

Public Member Functions

 AtomSpace (AtomSpace *parent=NULL)
 
 ~AtomSpace ()
 
int get_size () const
 
int get_num_nodes () const
 
int get_num_links () const
 
int get_num_atoms_of_type (Type type, bool subclass=false) const
 
void clear ()
 Clear the atomspace, remove all atoms. More...
 
Handle add_atom (AtomPtr atom, bool async=false)
 
Handle add_node (Type t, const std::string &name="", bool async=false)
 
Handle add_link (Type t, const HandleSeq &outgoing, bool async=false)
 
Handle add_link (Type t, Handle h)
 
Handle add_link (Type t, Handle ha, Handle hb)
 
Handle add_link (Type t, Handle ha, Handle hb, Handle hc)
 
Handle add_link (Type t, Handle ha, Handle hb, Handle hc, Handle hd)
 
Handle add_link (Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he)
 
Handle add_link (Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf)
 
Handle add_link (Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg)
 
Handle add_link (Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg, Handle hh)
 
Handle add_link (Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg, Handle hh, Handle hi)
 
void barrier (void)
 
Handle fetch_atom (Handle h)
 
Handle get_atom (Handle)
 
void fetch_all_atoms_of_type (Type t)
 
Handle fetch_incoming_set (Handle, bool)
 
void store_atom (Handle h)
 
bool purge_atom (Handle h, bool recursive=false)
 
bool remove_atom (Handle h, bool recursive=false)
 
Handle get_node (Type t, const std::string &name="")
 
Handle get_handle (Type t, const std::string &str)
 
Handle get_link (Type t, const HandleSeq &outgoing)
 
Handle get_link (Type t, Handle ha)
 
Handle get_link (Type t, Handle ha, Handle hb)
 
Handle get_link (Type t, Handle ha, Handle hb, Handle hc)
 
Handle get_link (Type t, Handle ha, Handle hb, Handle hc, Handle hd)
 
Handle get_handle (Type t, const HandleSeq &outgoing)
 
Handle get_handle (Type t, const Handle &ha)
 
Handle get_handle (Type t, const Handle &ha, const Handle &hb)
 
bool is_valid_handle (Handle h) const
 
void get_handles_by_type (HandleSeq &appendToHandles, Type type, bool subclass=false) const
 
template<typename OutputIterator >
OutputIterator get_handles_by_type (OutputIterator result, Type type, bool subclass=false) const
 
template<class T >
bool foreach_handle_of_type (Type atype, bool(T::*cb)(const Handle &), T *data, bool subclass=false)
 
float get_normalised_STI (Handle h, bool average=true, bool clip=false) const
 
float get_normalised_zero_to_one_STI (Handle h, bool average=true, bool clip=false) const
 
template<typename OutputIterator >
OutputIterator get_handles_by_AV (OutputIterator result, AttentionValue::sti_t lowerBound, AttentionValue::sti_t upperBound=AttentionValue::MAXSTI) const
 
template<typename OutputIterator >
OutputIterator get_handle_set_in_attentional_focus (OutputIterator result) const
 
AttentionValue::sti_t get_attentional_focus_boundary () const
 
AttentionValue::sti_t set_attentional_focus_boundary (AttentionValue::sti_t s)
 
AttentionValue::sti_t get_max_STI (bool average=true) const
 
AttentionValue::sti_t get_min_STI (bool average=true) const
 
void update_min_STI (AttentionValue::sti_t m)
 
void update_max_STI (AttentionValue::sti_t m)
 
void update_STI_funds (AttentionValue::sti_t m)
 
void update_LTI_funds (AttentionValue::lti_t m)
 
long get_STI_funds () const
 
long get_LTI_funds () const
 
boost::signals2::connection addAtomSignal (const AtomSignal::slot_type &function)
 
boost::signals2::connection removeAtomSignal (const AtomPtrSignal::slot_type &function)
 
boost::signals2::connection AVChangedSignal (const AVCHSigl::slot_type &function)
 
boost::signals2::connection TVChangedSignal (const TVCHSigl::slot_type &function)
 
boost::signals2::connection AddAFSignal (const AVCHSigl::slot_type &function)
 
boost::signals2::connection RemoveAFSignal (const AVCHSigl::slot_type &function)
 
template<typename OutputIterator >
OutputIterator get_handles_by_name (OutputIterator result, const std::string &name, Type type=NODE, bool subclass=true)
 
template<typename OutputIterator >
OutputIterator get_incoming_set_by_type (OutputIterator result, Handle handle, Type type, bool subclass) const
 
HandleSeq get_incoming (Handle h) const
 
bool is_node (Handle h) const
 
bool is_link (Handle h) const
 
std::string atom_as_string (Handle h, bool terse=true) const
 
const std::string & get_name (Handle h) const
 
void set_STI (Handle h, AttentionValue::sti_t stiValue) const
 
void set_LTI (Handle h, AttentionValue::lti_t ltiValue) const
 
void inc_VLTI (Handle h) const
 
void dec_VLTI (Handle h) const
 
AttentionValue::sti_t get_STI (Handle h) const
 
AttentionValue::lti_t get_LTI (Handle h) const
 
AttentionValue::vlti_t get_VLTI (Handle h) const
 
const HandleSeqget_outgoing (Handle h) const
 
Handle get_outgoing (Handle h, Arity idx) const
 
Arity get_arity (Handle h) const
 
bool is_source (Handle source, Handle link) const
 
AttentionValuePtr get_AV (Handle h) const
 
void set_AV (Handle h, AttentionValuePtr av) const
 
Type get_type (Handle h) const
 
TruthValuePtr get_TV (Handle h) const
 
strength_t get_mean (Handle h) const
 
confidence_t get_confidence (Handle h) const
 
void set_TV (Handle h, TruthValuePtr tv) const
 

Protected Member Functions

void registerBackingStore (BackingStore *)
 
void unregisterBackingStore (BackingStore *)
 

Private Member Functions

AtomSpaceoperator= (const AtomSpace &)
 
 AtomSpace (const AtomSpace &)
 
AtomTableget_atomtable (void)
 

Private Attributes

AtomTable atomTable
 
AttentionBank bank
 
BackingStorebacking_store
 

Friends

class SavingLoading
 
class SQLPersistSCM
 
class ::AtomTableUTest
 

Detailed Description

The AtomSpace class exposes the public API of the OpenCog AtomSpace

// Create an atomspace

Definition at line 54 of file AtomSpace.h.

Constructor & Destructor Documentation

AtomSpace::AtomSpace ( const AtomSpace )
private

Definition at line 70 of file AtomSpace.cc.

AtomSpace::AtomSpace ( AtomSpace parent = NULL)

Definition at line 56 of file AtomSpace.cc.

AtomSpace::~AtomSpace ( )

Definition at line 63 of file AtomSpace.cc.

References bank, and opencog::AttentionBank::shutdown().

Member Function Documentation

Handle AtomSpace::add_atom ( AtomPtr  atom,
bool  async = false 
)

Add an atom to the Atom Table. If the atom already exists then new truth value is ignored, and the existing atom is returned.

Definition at line 100 of file AtomSpace.cc.

References opencog::AtomTable::add(), atomTable, backing_store, opencog::BackingStore::getAtom(), opencog::AtomTable::getHandle(), opencog::BackingStore::ignoreType(), and python.undocumented.blocksworld::t.

+ Here is the caller graph for this function:

Handle AtomSpace::add_link ( Type  t,
const HandleSeq outgoing,
bool  async = false 
)

Add a link to the Atom Table. If the atom already exists, then that is returned.

Parameters
tType of the link
outgoinga const reference to a HandleSeq containing the outgoing set of the link

Definition at line 175 of file AtomSpace.cc.

References opencog::AtomTable::add(), atomTable, backing_store, createLink, opencog::AtomTable::getHandle(), opencog::BackingStore::getLink(), opencog::BackingStore::ignoreAtom(), and opencog::BackingStore::ignoreType().

+ Here is the caller graph for this function:

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  h 
)
inline

Definition at line 126 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb 
)
inline

Definition at line 131 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc 
)
inline

Definition at line 136 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc,
Handle  hd 
)
inline

Definition at line 141 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc,
Handle  hd,
Handle  he 
)
inline

Definition at line 146 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc,
Handle  hd,
Handle  he,
Handle  hf 
)
inline

Definition at line 152 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc,
Handle  hd,
Handle  he,
Handle  hf,
Handle  hg 
)
inline

Definition at line 158 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc,
Handle  hd,
Handle  he,
Handle  hf,
Handle  hg,
Handle  hh 
)
inline

Definition at line 164 of file AtomSpace.h.

References add_link().

Handle opencog::AtomSpace::add_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc,
Handle  hd,
Handle  he,
Handle  hf,
Handle  hg,
Handle  hh,
Handle  hi 
)
inline

Definition at line 171 of file AtomSpace.h.

References add_link().

Handle AtomSpace::add_node ( Type  t,
const std::string &  name = "",
bool  async = false 
)

Add a node to the Atom Table. If the atom already exists then that is returned.

Parameters
tType of the node
nameName of the node

Definition at line 135 of file AtomSpace.cc.

References opencog::AtomTable::add(), atomTable, backing_store, createNode, opencog::AtomTable::getHandle(), opencog::BackingStore::getNode(), and opencog::BackingStore::ignoreType().

+ Here is the caller graph for this function:

boost::signals2::connection opencog::AtomSpace::AddAFSignal ( const AVCHSigl::slot_type &  function)
inline

Definition at line 612 of file AtomSpace.h.

References opencog::AttentionBank::AddAFSignal(), and bank.

boost::signals2::connection opencog::AtomSpace::addAtomSignal ( const AtomSignal::slot_type &  function)
inline

Definition at line 596 of file AtomSpace.h.

References opencog::AtomTable::addAtomSignal(), and atomTable.

std::string opencog::AtomSpace::atom_as_string ( Handle  h,
bool  terse = true 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 681 of file AtomSpace.h.

References opencog::Atom::toShortString(), and opencog::Atom::toString().

boost::signals2::connection opencog::AtomSpace::AVChangedSignal ( const AVCHSigl::slot_type &  function)
inline

Definition at line 604 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::AVChangedSignal().

void opencog::AtomSpace::barrier ( void  )
inline

Make sure all atom writes have completed, before returning. This only has an effect when the atomspace is backed by some sort of storage, or is sending atoms to some remote location asynchronously. This simply guarantees that the asynch operations have completed. NB: at this time, we don't distinguish barrier and flush.

Definition at line 186 of file AtomSpace.h.

References atomTable, backing_store, opencog::BackingStore::barrier(), and opencog::AtomTable::barrier().

+ Here is the caller graph for this function:

void AtomSpace::clear ( )

Clear the atomspace, remove all atoms.

Definition at line 355 of file AtomSpace.cc.

References atomTable, DPRINTF, opencog::AtomTable::getHandlesByType(), and purge_atom().

+ Here is the caller graph for this function:

void opencog::AtomSpace::dec_VLTI ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 713 of file AtomSpace.h.

References opencog::Atom::decVLTI().

void opencog::AtomSpace::fetch_all_atoms_of_type ( Type  t)
inline

Load all atoms of the given type, but only if they are not already in the AtomTable.

Definition at line 219 of file AtomSpace.h.

References atomTable, backing_store, and opencog::BackingStore::loadType().

+ Here is the caller graph for this function:

Handle AtomSpace::fetch_atom ( Handle  h)

Unconditionally fetch an atom from the backingstore. If there is no backingstore, then Handle::UNDEINFED is returned. If the atom is found in the backingstore, then it is placed in the atomtable before returning. If the atom is already in the atomtable, and is also found in the backingstore, then the TV's are merged.

The fetch is 'unconditional', in that it is fetched, even if it already is in the atomspace. Also, the ignored-types of the backing store are not used.

To avoid a fetch if the atom already is in the atomtable, use the getAtom() method instead.

Definition at line 253 of file AtomSpace.cc.

References python.create_atoms_by_type::a, opencog::AtomTable::add(), atomTable, backing_store, opencog::BackingStore::getAtom(), opencog::AtomTable::getHandle(), opencog::AtomTable::holds(), opencog::LinkCast(), and opencog::Handle::value().

+ Here is the caller graph for this function:

Handle AtomSpace::fetch_incoming_set ( Handle  h,
bool  recursive 
)

Use the backing store to load the entire incoming set of the atom. If the flag is true, then the load is done recursively. This method queries the backing store to obtain all atoms that contain this one in their outgoing sets. All of these atoms are then loaded into this atomtable/atomspace.

Definition at line 321 of file AtomSpace.cc.

References backing_store, get_atom(), opencog::BackingStore::getIncomingSet(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

template<class T >
bool opencog::AtomSpace::foreach_handle_of_type ( Type  atype,
bool(T::*)(const Handle &)  cb,
T *  data,
bool  subclass = false 
)
inline

Invoke the callback on each handle of the given type.

Definition at line 447 of file AtomSpace.h.

References get_handles_by_type().

Arity opencog::AtomSpace::get_arity ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 752 of file AtomSpace.h.

References opencog::LinkCast().

Handle AtomSpace::get_atom ( Handle  h)

Get an atom from the AtomTable. If not found there, get it from the backingstore (and add it to the AtomTable). If the atom is not found in either place, return Handle::UNDEFINED.

Definition at line 312 of file AtomSpace.cc.

References atomTable, backing_store, fetch_atom(), opencog::AtomTable::getHandle(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

AtomTable& opencog::AtomSpace::get_atomtable ( void  )
inlineprivate

Definition at line 74 of file AtomSpace.h.

References atomTable.

+ Here is the caller graph for this function:

AttentionValue::sti_t opencog::AtomSpace::get_attentional_focus_boundary ( ) const
inline

Get attentional focus boundary Generally atoms below this threshold shouldn't be accessed unless search methods are unsuccessful on those that are above this value.

Returns
Short Term Importance threshold value

Definition at line 538 of file AtomSpace.h.

References bank, and opencog::AttentionBank::getAttentionalFocusBoundary().

+ Here is the caller graph for this function:

AttentionValuePtr opencog::AtomSpace::get_AV ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 769 of file AtomSpace.h.

References opencog::Atom::getAttentionValue().

confidence_t opencog::AtomSpace::get_confidence ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 800 of file AtomSpace.h.

References opencog::Atom::getTruthValue().

Handle opencog::AtomSpace::get_handle ( Type  t,
const std::string &  str 
)
inline

Definition at line 294 of file AtomSpace.h.

References get_node().

+ Here is the caller graph for this function:

Handle opencog::AtomSpace::get_handle ( Type  t,
const HandleSeq outgoing 
)
inline

Definition at line 324 of file AtomSpace.h.

References get_link().

Handle opencog::AtomSpace::get_handle ( Type  t,
const Handle ha 
)
inline

Definition at line 327 of file AtomSpace.h.

References get_handle().

Handle opencog::AtomSpace::get_handle ( Type  t,
const Handle ha,
const Handle hb 
)
inline

Definition at line 330 of file AtomSpace.h.

References get_handle().

template<typename OutputIterator >
OutputIterator opencog::AtomSpace::get_handle_set_in_attentional_focus ( OutputIterator  result) const
inline

Gets the set of all handles in the Attentional Focus

Returns
The set of all atoms in the Attentional Focus
Note
: This method utilizes the ImportanceIndex

Definition at line 526 of file AtomSpace.h.

References get_attentional_focus_boundary(), and get_handles_by_AV().

+ Here is the caller graph for this function:

template<typename OutputIterator >
OutputIterator opencog::AtomSpace::get_handles_by_AV ( OutputIterator  result,
AttentionValue::sti_t  lowerBound,
AttentionValue::sti_t  upperBound = AttentionValue::MAXSTI 
) const
inline

Returns the set of atoms within the given importance range.

Parameters
Importancerange lower bound (inclusive).
Importancerange upper bound (inclusive).
Returns
The set of atoms within the given importance range.
Note
: This method utilizes the ImportanceIndex

Definition at line 511 of file AtomSpace.h.

References atomTable, opencog::AtomTable::getHandlesByAV(), and python.bindlink::result.

+ Here is the caller graph for this function:

template<typename OutputIterator >
OutputIterator opencog::AtomSpace::get_handles_by_name ( OutputIterator  result,
const std::string &  name,
Type  type = NODE,
bool  subclass = true 
)
inline

DEPRECATED! DO NOT USE IN NEW CODE! If you need this function, just cut and paste the code below into whatever you are doing!

Definition at line 630 of file AtomSpace.h.

References opencog::classserver(), opencog::ClassServer::foreachRecursive(), get_handle(), get_handles_by_type(), python.bindlink::result, and python.undocumented.blocksworld::t.

void opencog::AtomSpace::get_handles_by_type ( HandleSeq appendToHandles,
Type  type,
bool  subclass = false 
) const
inline

Gets a set of handles that matches with the given type (subclasses optionally).

Parameters
appendToHandlesthe HandleSeq to which to append the handles.
typeThe desired type.
subclassWhether type subclasses should be considered.
Note
The matched entries are appended to a container whose OutputIterator is passed as the first argument.

Example of call to this method, which would return all entries in AtomSpace:

std::list<Handle> ret;
atomSpace.getHandlesByType(back_inserter(ret), ATOM, true);

Definition at line 392 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::getNumAtomsOfType().

+ Here is the caller graph for this function:

template<typename OutputIterator >
OutputIterator opencog::AtomSpace::get_handles_by_type ( OutputIterator  result,
Type  type,
bool  subclass = false 
) const
inline

Gets a set of handles that matches with the given type (subclasses optionally).

Parameters
resultAn output iterator.
typeThe desired type.
subclassWhether type subclasses should be considered.
Returns
The set of atoms of a given type (subclasses optionally).
Note
The matched entries are appended to a container whose OutputIterator is passed as the first argument.

Example of call to this method, which would return all entries in AtomSpace:

std::list<Handle> ret;
atomSpace.getHandlesByType(back_inserter(ret), ATOM, true);

Definition at line 432 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::getHandlesByType().

HandleSeq opencog::AtomSpace::get_incoming ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 668 of file AtomSpace.h.

References opencog::Atom::getIncomingSet().

+ Here is the caller graph for this function:

template<typename OutputIterator >
OutputIterator opencog::AtomSpace::get_incoming_set_by_type ( OutputIterator  result,
Handle  handle,
Type  type,
bool  subclass 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this function, just copy the one-liner below. XXX ONLY the python bindings use this. XXX kill that code.

Definition at line 658 of file AtomSpace.h.

References opencog::Atom::getIncomingSetByType().

Handle AtomSpace::get_link ( Type  t,
const HandleSeq outgoing 
)

Get a link from the AtomTable, if it's in there. If its not found in the AtomTable, and there's a backing store, then the atom will be fetched from the backingstore (and added to the AtomTable). If the atom can't be found in either place, Handle::UNDEFINED will be returned.

See also the get_atom() method.

Parameters
tType of the node
outgoinga reference to a HandleSeq containing the outgoing set of the link.

Definition at line 217 of file AtomSpace.cc.

References opencog::AtomTable::add(), atomTable, backing_store, opencog::AtomTable::getHandle(), opencog::BackingStore::getLink(), opencog::BackingStore::ignoreAtom(), opencog::BackingStore::ignoreType(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

Handle opencog::AtomSpace::get_link ( Type  t,
Handle  ha 
)
inline

Definition at line 312 of file AtomSpace.h.

References get_link().

Handle opencog::AtomSpace::get_link ( Type  t,
Handle  ha,
Handle  hb 
)
inline

Definition at line 315 of file AtomSpace.h.

References get_link().

Handle opencog::AtomSpace::get_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc 
)
inline

Definition at line 318 of file AtomSpace.h.

References get_link().

Handle opencog::AtomSpace::get_link ( Type  t,
Handle  ha,
Handle  hb,
Handle  hc,
Handle  hd 
)
inline

Definition at line 321 of file AtomSpace.h.

References get_link().

AttentionValue::lti_t opencog::AtomSpace::get_LTI ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 723 of file AtomSpace.h.

References opencog::Atom::getAttentionValue().

long opencog::AtomSpace::get_LTI_funds ( ) const
inline

Definition at line 591 of file AtomSpace.h.

References bank, and opencog::AttentionBank::getLTIFunds().

AttentionValue::sti_t opencog::AtomSpace::get_max_STI ( bool  average = true) const
inline

Get the maximum STI observed in the AtomSpace.

Parameters
averageIf true, return an exponentially decaying average of maximum STI, otherwise return the actual maximum.
Returns
Maximum STI

Definition at line 558 of file AtomSpace.h.

References bank, and opencog::AttentionBank::getMaxSTI().

strength_t opencog::AtomSpace::get_mean ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 794 of file AtomSpace.h.

References opencog::Atom::getTruthValue().

AttentionValue::sti_t opencog::AtomSpace::get_min_STI ( bool  average = true) const
inline

Get the minimum STI observed in the AtomSpace.

Parameters
averageIf true, return an exponentially decaying average of minimum STI, otherwise return the actual maximum.
Returns
Minimum STI

Definition at line 567 of file AtomSpace.h.

References bank, and opencog::AttentionBank::getMinSTI().

const std::string& opencog::AtomSpace::get_name ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 688 of file AtomSpace.h.

References opencog::NodeCast().

+ Here is the caller graph for this function:

Handle AtomSpace::get_node ( Type  t,
const std::string &  name = "" 
)

Get a node from the AtomTable, if it's in there. If its not found in the AtomTable, and there's a backing store, then the atom will be fetched from the backingstore (and added to the AtomTable). If the atom can't be found in either place, Handle::UNDEFINED will be returned.

Parameters
tType of the node
strName of the node

Definition at line 155 of file AtomSpace.cc.

References opencog::AtomTable::add(), atomTable, backing_store, opencog::AtomTable::getHandle(), opencog::BackingStore::getNode(), opencog::BackingStore::ignoreType(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

float opencog::AtomSpace::get_normalised_STI ( Handle  h,
bool  average = true,
bool  clip = false 
) const
inline

Retrieve the doubly normalised Short-Term Importance between -1..1 for a given Handle. STI above and below threshold normalised separately and linearly.

Parameters
hThe atom handle to get STI for
averageShould the recent average max/min STI be used, or the exact min/max?
clipShould the returned value be clipped to -1..1? Outside this range can be returned if average=true
Returns
normalised STI between -1..1

Definition at line 483 of file AtomSpace.h.

References bank, opencog::Atom::getAttentionValue(), and opencog::AttentionBank::getNormalisedSTI().

float opencog::AtomSpace::get_normalised_zero_to_one_STI ( Handle  h,
bool  average = true,
bool  clip = false 
) const
inline

Retrieve the linearly normalised Short-Term Importance between 0..1 for a given Handle.

Parameters
hThe atom handle to get STI for
averageShould the recent average max/min STI be used, or the exact min/max?
clipShould the returned value be clipped to 0..1? Outside this range can be returned if average=true
Returns
normalised STI between 0..1

Definition at line 497 of file AtomSpace.h.

References bank, opencog::Atom::getAttentionValue(), and opencog::AttentionBank::getNormalisedZeroToOneSTI().

int opencog::AtomSpace::get_num_atoms_of_type ( Type  type,
bool  subclass = false 
) const
inline

Definition at line 93 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::getNumAtomsOfType().

+ Here is the caller graph for this function:

int opencog::AtomSpace::get_num_links ( ) const
inline

Definition at line 92 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::getNumLinks().

int opencog::AtomSpace::get_num_nodes ( ) const
inline

Definition at line 91 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::getNumNodes().

const HandleSeq& opencog::AtomSpace::get_outgoing ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 735 of file AtomSpace.h.

References opencog::LinkCast().

+ Here is the caller graph for this function:

Handle opencog::AtomSpace::get_outgoing ( Handle  h,
Arity  idx 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 744 of file AtomSpace.h.

References opencog::LinkCast(), and opencog::Handle::UNDEFINED.

int opencog::AtomSpace::get_size ( ) const
inline

Return the number of atoms contained in the space.

Definition at line 90 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::getSize().

AttentionValue::sti_t opencog::AtomSpace::get_STI ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 717 of file AtomSpace.h.

References opencog::Atom::getAttentionValue().

long opencog::AtomSpace::get_STI_funds ( ) const
inline

Definition at line 590 of file AtomSpace.h.

References bank, and opencog::AttentionBank::getSTIFunds().

TruthValuePtr opencog::AtomSpace::get_TV ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 787 of file AtomSpace.h.

References opencog::Atom::getTruthValue().

+ Here is the caller graph for this function:

Type opencog::AtomSpace::get_type ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 781 of file AtomSpace.h.

References opencog::Atom::getType().

+ Here is the caller graph for this function:

AttentionValue::vlti_t opencog::AtomSpace::get_VLTI ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 729 of file AtomSpace.h.

References opencog::Atom::getAttentionValue().

void opencog::AtomSpace::inc_VLTI ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 709 of file AtomSpace.h.

References opencog::Atom::incVLTI().

bool opencog::AtomSpace::is_link ( Handle  h) const
inline

Definition at line 677 of file AtomSpace.h.

References opencog::LinkCast().

bool opencog::AtomSpace::is_node ( Handle  h) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 676 of file AtomSpace.h.

References opencog::NodeCast().

bool opencog::AtomSpace::is_source ( Handle  source,
Handle  link 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 760 of file AtomSpace.h.

References opencog::LinkCast().

bool opencog::AtomSpace::is_valid_handle ( Handle  h) const
inline

Return true if the handle points to an atom that is in some (any) atomspace; else return false.

Currently, this code has the side-effect of resolving the handle. That is, if the handle's atom-pointer was non-null, and the atom can be located based on its UUID, then the atom will be instantiated in the appropriate atomspace. Thus, this method returns false only if the handles UUID is -1 or if the UUID is positive, but no atomspace can lay claim to it.

A UUID can be positive, but not a part of any atomspace, if the atom was recently removed from some atomspace. In this case, the handle is still caching its old UUID, although the atom itself now has a UUID of -1.

Note also: a handle that is pointing to a recently-created atom that is not in any atomspace will have a UUID of -1, and thus is considered "invalid", even though it points to an atom that exists in RAM (and is thus usable as a naked atom).

Definition at line 355 of file AtomSpace.h.

References opencog::Atom::getHandle(), and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

AtomSpace & AtomSpace::operator= ( const AtomSpace )
private

Override and declare copy constructor and equals operator, to prevent the accidental copying of large objects.

Definition at line 79 of file AtomSpace.cc.

bool opencog::AtomSpace::purge_atom ( Handle  h,
bool  recursive = false 
)
inline

Purge an atom from the atomspace. This only removes the atom from the AtomSpace; it may still remain in persistent storage. To also delete from persistant storage, use the removeAtom() method. The atom remains valid as long as there are Handles or AtomPtr's that reference it; it is deleted only when the last reference goes away.

Parameters
hThe Handle of the atom to be removed.
recursiveRecursive-removal flag. If the flag is set, then this atom, and everything that points to it will be removed from the atomspace. This can cause a large cascade of removals! If the flag is not set, then the atom will be removed only if its incoming set is empty. By default, recursion is disabled.
Returns
True if the Atom for the given Handle was successfully removed. False, otherwise.

Definition at line 261 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::extract().

+ Here is the caller graph for this function:

void AtomSpace::registerBackingStore ( BackingStore bs)
protected

Register a provider of backing storage.

Definition at line 88 of file AtomSpace.cc.

References backing_store.

+ Here is the caller graph for this function:

bool AtomSpace::remove_atom ( Handle  h,
bool  recursive = false 
)

Removes an atom from the atomspace, and any attached storage. The atom remains valid as long as there are Handles or AtomPtr's that reference it; it is deleted only when the last reference goes away.

Parameters
hThe Handle of the atom to be removed.
recursiveRecursive-removal flag. If the flag is set, then this atom, and everything that points to it will be removed from the atomspace. This can cause a large cascade of removals! If the flag is not set, then the atom will be removed only if its incoming set is empty. By default, recursion is disabled.
Returns
True if the Atom for the given Handle was successfully removed. False, otherwise.

Definition at line 344 of file AtomSpace.cc.

References atomTable, backing_store, and opencog::AtomTable::extract().

+ Here is the caller graph for this function:

boost::signals2::connection opencog::AtomSpace::RemoveAFSignal ( const AVCHSigl::slot_type &  function)
inline

Definition at line 616 of file AtomSpace.h.

References bank, and opencog::AttentionBank::RemoveAFSignal().

boost::signals2::connection opencog::AtomSpace::removeAtomSignal ( const AtomPtrSignal::slot_type &  function)
inline

Definition at line 600 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::removeAtomSignal().

AttentionValue::sti_t opencog::AtomSpace::set_attentional_focus_boundary ( AttentionValue::sti_t  s)
inline

Change the attentional focus boundary. Some situations may benefit from less focussed searches.

Parameters
sNew threshold
Returns
Short Term Importance threshold value

Definition at line 548 of file AtomSpace.h.

References bank, and opencog::AttentionBank::setAttentionalFocusBoundary().

+ Here is the caller graph for this function:

void opencog::AtomSpace::set_AV ( Handle  h,
AttentionValuePtr  av 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 775 of file AtomSpace.h.

References opencog::Atom::setAttentionValue().

void opencog::AtomSpace::set_LTI ( Handle  h,
AttentionValue::lti_t  ltiValue 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 703 of file AtomSpace.h.

References opencog::Atom::setLTI().

void opencog::AtomSpace::set_STI ( Handle  h,
AttentionValue::sti_t  stiValue 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 697 of file AtomSpace.h.

References opencog::Atom::setSTI().

void opencog::AtomSpace::set_TV ( Handle  h,
TruthValuePtr  tv 
) const
inline

DEPRECATED! Do NOT USE IN NEW CODE! If you need this, just copy the code below into your app!

Definition at line 806 of file AtomSpace.h.

References opencog::Atom::setTruthValue().

void AtomSpace::store_atom ( Handle  h)

Recursively store the atom to the backing store. I.e. if the atom is a link, then store all of the atoms in its outgoing set as well, recursively.

Definition at line 245 of file AtomSpace.cc.

References backing_store, and opencog::BackingStore::storeAtom().

+ Here is the caller graph for this function:

boost::signals2::connection opencog::AtomSpace::TVChangedSignal ( const TVCHSigl::slot_type &  function)
inline

Definition at line 608 of file AtomSpace.h.

References atomTable, and opencog::AtomTable::TVChangedSignal().

void AtomSpace::unregisterBackingStore ( BackingStore bs)
protected

Definition at line 93 of file AtomSpace.cc.

References backing_store.

+ Here is the caller graph for this function:

void opencog::AtomSpace::update_LTI_funds ( AttentionValue::lti_t  m)
inline

Definition at line 589 of file AtomSpace.h.

References bank, and opencog::AttentionBank::updateLTIFunds().

void opencog::AtomSpace::update_max_STI ( AttentionValue::sti_t  m)
inline

Update the maximum STI observed in the AtomSpace. Min/max are not updated on setSTI because average is calculate by lobe cycle, although this could potentially also be handled by the cogServer.

Warning
Should only be used by attention allocation system.
Parameters
mNew maximum STI

Definition at line 587 of file AtomSpace.h.

References bank, and opencog::AttentionBank::updateMaxSTI().

void opencog::AtomSpace::update_min_STI ( AttentionValue::sti_t  m)
inline

Update the minimum STI observed in the AtomSpace. Min/max are not updated on setSTI because average is calculate by lobe cycle, although this could potentially also be handled by the cogServer.

Warning
Should only be used by attention allocation system.
Parameters
mNew minimum STI

Definition at line 577 of file AtomSpace.h.

References bank, and opencog::AttentionBank::updateMinSTI().

void opencog::AtomSpace::update_STI_funds ( AttentionValue::sti_t  m)
inline

Definition at line 588 of file AtomSpace.h.

References bank, and opencog::AttentionBank::updateSTIFunds().

Friends And Related Function Documentation

friend class ::AtomTableUTest
friend

Definition at line 58 of file AtomSpace.h.

friend class SavingLoading
friend

Definition at line 56 of file AtomSpace.h.

friend class SQLPersistSCM
friend

Definition at line 57 of file AtomSpace.h.

Member Data Documentation

AtomTable opencog::AtomSpace::atomTable
private

Definition at line 67 of file AtomSpace.h.

BackingStore* opencog::AtomSpace::backing_store
private

Used to fetch atoms from disk.

Definition at line 72 of file AtomSpace.h.

AttentionBank opencog::AtomSpace::bank
private

Definition at line 68 of file AtomSpace.h.


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