opencog / atomspace

The OpenCog (hyper-)graph database and graph rewriting system
https://wiki.opencog.org/w/AtomSpace
Other
801 stars 225 forks source link

Derived AtomSpace's getHandlesByType() bug? #97

Closed williampma closed 9 years ago

williampma commented 9 years ago

Some inconsistency while working with InitiateSearchCB::link_type_search() lead me to this problem:

Empty AtomSpace _as:

    AtomSpace temp(_as);

    _as->addNode(CONCEPT_NODE, "lalala");
    temp.addNode(CONCEPT_NODE, "kakaka");

    HandleSeq handle_set;
    temp.getHandlesByType(handle_set, CONCEPT_NODE);

I expected handle_set will be size 2, but instead got size 1. Only "kakaka" was found, even though "lalala" should also be considered part of "temp"?

williampma commented 9 years ago

I can sort of see the problem.

AtomTable's getHandlesByType only look at its typeIndex member, but typeIndex does not contain information on the parent's typeIndex...

Perhaps to fix this I just need to change the function to also copy _environ->getHandlesByType...?

linas commented 9 years ago

Yes, I think that is the correct semantics and the correct fix.