| … | … | @@ -0,0 +1,68 @@ |
| 1 | |
| 2 | (use-modules (opencog)) |
| 3 | (AtomSpace (cog-atomspace)) ;; XXX not pure Atomese |
| 4 | (AtomSpace (AtomSpaceOf (Concept "x"))) ;; Yes, creates chold, OK. |
| 5 | |
| 6 | ; Create just one child atomspace, stash it where we can find it. |
| 7 | (cog-execute! (SetValue |
| 8 | (AnchorNode "observer") |
| 9 | (Predicate "*-space-*") |
| 10 | (AtomSpace (AtomSpaceOf (AnchorNode "observer"))))) |
| 11 | |
| 12 | (cog-execute! (ValueOf (AnchorNode "observer") (Predicate "*-space-*"))) |
| 13 | (cog-new-atom (Concept "x") (... some atomspace)) |
| 14 | |
| 15 | ; --------------------------- |
| 16 | |
| 17 | ; Create a handle we can hold onto. |
| 18 | ; Compact but too circular. |
| 19 | (Pipe |
| 20 | (Name "make-as") |
| 21 | (AtomSpace (AtomSpaceOf (Name "make-as")))) |
| 22 | |
| 23 | ; Create a handle we can hold onto. |
| 24 | (Pipe |
| 25 | (Name "make-as") |
| 26 | (AtomSpace "boostrap" (AtomSpaceOf (Link)))) |
| 27 | |
| 28 | ; Verify that the handle works as expected |
| 29 | (cog-execute! (Name "make-as")) |
| 30 | (cog-execute! (AtomSpaceOf (Name "make-as"))) |
| 31 | |
| 32 | (cog-execute! (SetValue |
| 33 | (RocksStorageNode "rocks:///tmp/foo") |
| 34 | (Predicate "*-open-*") |
| 35 | (Name "make-as")) |
| 36 | |
| 37 | (cog-prt-atomspace) |
| 38 | (cog-set-atomspace! (cog-execute! (Name "make-as"))) |
| 39 | |
| 40 | |
| 41 | (AtomSpace "bootstrap" (AtomSpaceOf (Link))) |
| 42 | |
| 43 | (cog-execute! |
| 44 | ; Execute a sequence of steps to load the boostrap space, |
| 45 | ; and get things started in there. |
| 46 | (PureExec |
| 47 | ; Step one: Open the StorageNode |
| 48 | (SetValue |
| 49 | (RocksStorageNode "rocks:///tmp/foo") |
| 50 | (Predicate "*-open-*") |
| 51 | (AtomSpace "bootstrap")) |
| 52 | |
| 53 | ; Step two: Load up the child space with data: |
| 54 | (SetValue |
| 55 | (RocksStorageNode "rocks:///tmp/foo") |
| 56 | (Predicate "*-load-atomspace-*") |
| 57 | (Link)) |
| 58 | |
| 59 | ; Step three: run something... |
| 60 | ; Where? In the child AtomSpace |
| 61 | (AtomSpace "bootstrap"))) |
| 62 | |
| 63 | (cog-execute! |
| 64 | (SetValue |
| 65 | (RocksStorageNode "rocks:///tmp/foo") |
| 66 | (Predicate "*-store-atom-*") |
| 67 | (Concept "I'm from storage"))) |
| 68 | |