opencog / atomspace

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

Use more contains + fix a bug #2836

Closed ngeiswei closed 3 years ago

ngeiswei commented 3 years ago
ngeiswei commented 3 years ago

@linas, I'm fairly confident it's correct so I'm gonna merge now.

I have 2 comments however

  1. Let it be atomspace A and its child B. Atom X is added in B, then a link L is added to X in B as well. Then X is added to A. I think L should be pointing to X in A, and X in B should be destroyed.
  2. There is an inconsistency between Handle::operator< which is content based and Handle::operator== which is pointer based. This creates problems downstream requiring the sort of fix in that PR.
linas commented 3 years ago

Yes, this looks good to me. I am, however, getting a compiler error:

/home/linas/src/novamente/src/atomspace-git/opencog/atoms/core/Context.cc: In member function ‘bool opencog::Context::is_free_variable(const opencog::Handle&) const’:
/home/linas/src/novamente/src/atomspace-git/opencog/atoms/core/Context.cc:84:11: error: ‘contains’ was not declared in this scope
   and not contains(shadow, h);
           ^~~~~~~~

I'll try to figure this out right now.

linas commented 3 years ago

Oh, I see, I needed to pull a new cogutil. Got it. Seems to build now. opencog/cogutil#253