-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra incoming link from derived atomspace #1921
Comments
@linas, if you can confidently tell me what is the expected behavior I don't mind attempting to fixing it myself. |
In the first example, this is an ugly side effect. There is no clear or obvious "easy" fix. There is also no clear or obvious idea of what "should" happen -- its not fixable, if you don't know what "should" happen. The second example is working as designed, and is clearly correct, and working exactly as specified. There is no "second" inheritance link created, because it already exists in the base space. If you really really want to force creation of a second link in the derived space, mark the base-space as read-only, then create it, then alter it's truth value, then re-mark the base space as read-write. So the fix is in two steps: explain what "should" happen in the first example. Then explain how to fix that. |
So I thought about this some more. A key issue is that the scheme bindings always assume a "current" atomspace. Thus, in the first example, there is no simple way (in scheme) to move AC from the derived atomspace to the base atomspace. (its easy to do this in C++) So three utilities are possible:
I like alternative 3 the best, as it seems to be the one that makes the most sense, to me, in standard usage scenarios. I can see how 1) could be useful. Option 2) seems like the worst, as it just leads to multiple copies of atoms, which mostly need to be avoided. The only case where 2) make sense is if the base is read-only, and one wants to modify an atom in the base; then one must copy to make ti read-write. But this is already done automatically, so no explicit option 2 is needed. . |
OK, I thought about this some more, and have an "even better" solution, although it will take much longer to implement. It is hinted here: https://wiki.opencog.org/w/AtomSpace#Atoms_are_fat.3B_Atomspace_insertion_is_slow The idea is this: denote atomspace membership using a new |
I have a question about first example provided by @ngeiswei. It is not obvious for me why adding AC to the derived atomspace modifies parent atomspace. Am I right that side effect reason is that only instance of A atom is member of both atomspaces and adding link to its incoming set leads to this link appears in parent atomspace? If so why this behavior will be fixed by #1967? Is it because it will be possible to implement get-incoming-set-by-atomspace? |
It doesn't. In step 2, AC is added only to the derived atomspace.
atom A is "really" "only" in the base atomspace. Its not "really" in the derived atomspace; it is only "virtually" in the derived atomspace. That is, the base atomspace is the only one actually holding A in a C++ Now apply this same logic to AC. Step 2 creates AC in the derived space. Step 3 creates it in the base space. As a result, two different atoms AC are stored in
Oh, huh. Maybe I spoke too soon, without thinking about it enough. As a part of #1967, I guess we would still need to have a global check: "is AC in any atomspace, anywhere?" If so, then use that copy. |
Thanks, Linas. |
This has been fixed in the recent spate of changes to support AtomSpace frames. Fixed in pull req #2925, I believe. (Early April 2022) |
cog-incoming-set
returns an extra link from a derived atomspace. I suspect it is a bug. Here's how to reproduce it.As you may see the last call of
cog-incoming-set
returnsAC
twice. I do understand why asAC
is both inbase-as
andderived-as
but is it normal?Here's what is even more suspicious, if I add
AC
into the base atomspace before addingAC
in the derived atomspace, then the duplicate never shows up. Specifically I mean (starting from a new guile session)As you can see this time the last
cog-incoming-set
call only shows 2 incoming atoms, contradicting the first example.The text was updated successfully, but these errors were encountered: