| … | … | @@ -16,6 +16,8 @@ |
| 16 | 16 | |
| 17 | 17 | ; Create a handle we can hold onto. |
| 18 | 18 | ; Compact but too circular. |
| 19 | |
| 20 | (use-modules (opencog)) |
| 19 | 21 | (Pipe |
| 20 | 22 | (Name "make-as") |
| 21 | 23 | (AtomSpace (AtomSpaceOf (Name "make-as")))) |
| … | … | @@ -38,6 +40,29 @@ |
| 38 | 40 | (cog-set-atomspace! (cog-execute! (Name "make-as"))) |
| 39 | 41 | |
| 40 | 42 | |
| 43 | ;; The following has unexpected results: |
| 44 | (use-modules (opencog)) |
| 45 | (define base-as (cog-atomspace)) |
| 46 | (define named-as (AtomSpace (cog-name (cog-atomspace)))) |
| 47 | (cog-equal? base-as named-as) ; currently prints #t |
| 48 | (Concept "foo") ;; add contents to base-as |
| 49 | (cog-prt-atomspace) ;; view contents of base-as |
| 50 | (cog-set-atomspace! named-as) ;; change to the other atomspace |
| 51 | (cog-prt-atomspace) ;; view contents of named-as -- its empty |
| 52 | (Concept "I'm in named") |
| 53 | (cog-prt-atomspace) ;; view contents of named-as -- its empty |
| 54 | (cog-set-atomspace! base-as) ;; return to the original as |
| 55 | (cog-prt-atomspace) ;; view contents -- we can see the "foo" here |
| 56 | (define nuther-as (AtomSpace (cog-name (cog-atomspace)))) |
| 57 | (cog-set-atomspace! nuther-as) ;; return to the original as |
| 58 | (cog-prt-atomspace) ;; view contents -- |
| 59 | ;; So clearly these two AtomSpaces are NOT the same; one has |
| 60 | ;; (Concept "foo") in it and the other does not. The problem is |
| 61 | ;; that they *should have been* the same AtomSpace -- the name |
| 62 | ;; should have been enough to guarentee that broth reference the |
| 63 | ;; same space. But somehow something is broken... what is broken? |
| 64 | |
| 65 | |
| 41 | 66 | (AtomSpace "bootstrap" (AtomSpaceOf (Link))) |
| 42 | 67 | |
| 43 | 68 | (cog-execute! |
| … | … | @@ -60,9 +85,30 @@ |
| 60 | 85 | ; Where? In the child AtomSpace |
| 61 | 86 | (AtomSpace "bootstrap"))) |
| 62 | 87 | |
| 88 | (define bas (cog-atomspace)) |
| 89 | (cog-set-atomspace! (AtomSpace "bootstrap")) |
| 90 | |
| 63 | 91 | (cog-execute! |
| 64 | 92 | (SetValue |
| 65 | 93 | (RocksStorageNode "rocks:///tmp/foo") |
| 66 | 94 | (Predicate "*-store-atom-*") |
| 67 | 95 | (Concept "I'm from storage"))) |
| 68 | 96 | |
| 97 | (cog-set-atomspace! (AtomSpace "bootstrap")) |
| 98 | (define (ola) (format #t "hello baby!\n")) |
| 99 | (define pip |
| 100 | (Pipe |
| 101 | (Name "bootloader") |
| 102 | (ExecutionOutput |
| 103 | (GroundedSchema "scm:ola") |
| 104 | (List))) |
| 105 | ) |
| 106 | (cog-execute! |
| 107 | (SetValue |
| 108 | (RocksStorageNode "rocks:///tmp/foo") |
| 109 | (Predicate "*-store-atom-*") |
| 110 | pip)) |
| 111 | |
| 112 | (cog-execute! (Name "bootloader")) |
| 113 | |
| 114 | |