OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <AssignLink.h>
Protected Attributes | |
Type | _link_type |
HandleSeq | _outset |
size_t | _osetz |
![]() | |
HandleSeq | _varseq |
std::map< Handle, unsigned int > | _index |
![]() | |
HandleSeq | _outgoing |
![]() | |
UUID | _uuid |
AtomTable * | _atomTable |
Type | _type |
char | _flags |
TruthValuePtr | _truthValue |
AttentionValuePtr | _attentionValue |
std::mutex | _mtx |
InSetPtr | _incoming_set |
Additional Inherited Members | |
![]() | |
static Handle | do_execute (AtomSpace *, const Handle &) |
static LinkPtr | factory (LinkPtr) |
static Handle | factory (Type, const HandleSeq &) |
![]() | |
typedef std::shared_ptr< InSet > | InSetPtr |
The InsertLink is used to create atoms at some defered time in the future, while still being able to describe and talk about them at the present time. The issue that it is solving is this: when an atom is explicitly named, it also becomes a member of the AtomSpace; that is, it is brought into existance by naming it. The usual mechanism for deferring the creation of an atom is to place a VariableNode in it; theatom is then created later, when the Variable is given a value. The InsertLink provides an alternative mechanism, without requiring the use of VariableNodes.
The InsertLink is a kind of executable link; that it, upon execution, it transforms into another link. It should have the following form:
InsertLink TypeNode "SomeLink" SomeAtom OtherAtom
Upon execution, this will result in the following being created:
SomeLink SomeAtom OtherAtom
The RemoveLink is like the InsertLink, except that it causes the indicated form to be deleted (removed from the atomspace). If the RemoveLink contains variables, and those variables are free, then all matching paterns will be deleted from the AtomSpace.
The InsertLink vaguely resembles the ProLog predicate "assert()" with respect to what it does to the atomspace database. The RemoveLink behaves like the ProLog "retract()" predicate.
The AssignLink combines the Insert and Remove into one. Since the format does not allow a close specification of the exact link to be removed, it will remove all atoms fitting the general pattern, i.e. those links having the indicated link type, the same first atom (SomeAtom, above), and the same arity. It will not remove those links containing variables, as these are not concrete (closed), but open. It will do this before performing the Insert.
To be precise:
AssignLink TypeNode "SomeLink" SomeAtom OtherAtom
is identical to saying:
RemoveLink TypeNode "SomeLink" SomeAtom VariableNode "$free" InsertLink TypeNode "SomeLink" SomeAtom OtherAtom
Definition at line 97 of file AssignLink.h.
AssignLink::AssignLink | ( | const HandleSeq & | oset, |
TruthValuePtr | tv = TruthValue::DEFAULT_TV() , |
||
AttentionValuePtr | av = AttentionValue::DEFAULT_AV() |
||
) |
Definition at line 35 of file AssignLink.cc.
References opencog::FreeLink::init().
AssignLink::AssignLink | ( | Type | t, |
const HandleSeq & | oset, | ||
TruthValuePtr | tv = TruthValue::DEFAULT_TV() , |
||
AttentionValuePtr | av = AttentionValue::DEFAULT_AV() |
||
) |
Definition at line 42 of file AssignLink.cc.
References opencog::classserver(), opencog::ClassServer::getTypeName(), and opencog::FreeLink::init().
AssignLink::AssignLink | ( | Link & | l | ) |
Definition at line 56 of file AssignLink.cc.
References opencog::classserver(), opencog::Link::getOutgoingSet(), opencog::Atom::getType(), opencog::ClassServer::getTypeName(), and opencog::FreeLink::init().
Reimplemented from opencog::FunctionLink.
Reimplemented in opencog::RemoveLink, and opencog::InsertLink.
Definition at line 103 of file AssignLink.cc.
References _link_type, _osetz, _outset, opencog::AtomSpace::add_atom(), createLink, opencog::Atom::getType(), opencog::Atom::Handle, and opencog::AtomSpace::remove_atom().
|
protected |
Definition at line 73 of file AssignLink.cc.
References _link_type, _osetz, _outset, opencog::classserver(), opencog::ClassServer::getType(), opencog::NodeCast(), and python.undocumented.blocksworld::t.
|
protected |
Definition at line 101 of file AssignLink.h.
|
protected |
Definition at line 103 of file AssignLink.h.
|
protected |
Definition at line 102 of file AssignLink.h.