33 using namespace opencog;
49 throw InvalidParamException(TRACE_INFO,
50 "Expecting an AssignLink, got %s", tname.c_str());
64 throw InvalidParamException(TRACE_INFO,
65 "Expecting an AssignLink, got %s", tname.c_str());
79 throw InvalidParamException(TRACE_INFO,
80 "AssignLinks must have members!");
82 Type t = oset[0]->getType();
84 throw InvalidParamException(TRACE_INFO,
85 "Invalid format for a AssignLink! First member must be a type node!");
87 const std::string& name =
NodeCast(oset[0])->getName();
89 throw InvalidParamException(TRACE_INFO,
90 "Invalid format for a AssignLink! Not a defined type!");
95 for (
size_t j=1; j < oset.size(); j++)
118 if (
_osetz != lp->getArity())
continue;
120 const HandleSeq& hs = lp->getOutgoingSet();
121 if (hs[0] !=
_outset[0])
continue;
124 for (
size_t i=1; i <
_osetz; i++)
127 if (VARIABLE_NODE == hs[i]->
getType())
133 if (not match)
continue;
169 throw InvalidParamException(TRACE_INFO,
170 "Expecting a InsertLink, got %s", tname.c_str());
190 size_t narsz = SIZE_MAX;
191 for (
size_t i=0; i <
_osetz; i++)
194 size_t isz =
_outset[i]->getIncomingSetSize();
211 if (_osetz != lp->getArity())
continue;
213 const HandleSeq& hs = lp->getOutgoingSet();
215 for (
size_t i=0; i <
_osetz; i++)
220 if (VARIABLE_NODE == hs[i]->
getType() or
227 if (not match)
continue;
239 for (
const Handle& h : seq)
244 if (_osetz != lp->getArity())
continue;
246 const HandleSeq& hs = lp->getOutgoingSet();
248 for (
size_t i=0; i <
_osetz; i++)
251 if (VARIABLE_NODE == hs[i]->
getType())
258 if (not match)
continue;
277 throw InvalidParamException(TRACE_INFO,
278 "Expecting a RemoveLink, got %s", tname.c_str());
const HandleSeq & getOutgoingSet() const
std::vector< Handle > HandleSeq
a list of handles
std::shared_ptr< TruthValue > TruthValuePtr
std::shared_ptr< AttentionValue > AttentionValuePtr
virtual Handle execute(AtomSpace *=NULL) const
RemoveLink(const HandleSeq &, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
std::shared_ptr< Link > LinkPtr
void get_handles_by_type(HandleSeq &appendToHandles, Type type, bool subclass=false) const
ClassServer & classserver(ClassServerFactory *=ClassServer::createInstance)
static NodePtr NodeCast(const Handle &h)
static const Handle UNDEFINED
InsertLink(const HandleSeq &, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
AssignLink(const HandleSeq &, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
bool remove_atom(Handle h, bool recursive=false)
virtual Handle execute(AtomSpace *=NULL) const
const std::string & getTypeName(Type type)
virtual Handle execute(AtomSpace *=NULL) const
static LinkPtr LinkCast(const Handle &h)
std::vector< LinkPtr > IncomingSet
Type getType(const std::string &typeName)
unsigned short Type
type of Atoms, represented as short integer (16 bits)
Handle add_atom(AtomPtr atom, bool async=false)