OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-rocks commits / 1da6692

Special-case the restore of flags.
1da66923c093e33b93e6b67398bddc0b25b994bb
by Linas Vepstas <linasvepstas@gmail.com> · 2025-12-09T00:55:03.000Z

Changed files (2) +51 -0

opencog/persist/monospace/MonoIO.cc +17 -0
……@@ -423,6 +423,23 @@ void MonoStorage::getKeys(AtomSpace* as,
423423 }
424424 if (as) key = as->add_atom(key);
425425
426 // Check for flag marker predicates and restore the flags.
427 // The mark will set the value automatically.
428 if (key->is_type(PREDICATE_NODE))
429 {
430 const std::string& kname = key->get_name();
431 if (kname == "*-IsKeyFlag-*")
432 {
433 markAtomIsKey(h);
434 continue;
435 }
436 if (kname == "*-IsMessageFlag-*")
437 {
438 markAtomIsMessage(h);
439 continue;
440 }
441 }
442
426443 // read-only Atomspaces will refuse insertion of keys.
427444 // However, we have to special-case the truth values.
428445 // Mostly because (PredicateNode "*-TruthValueKey-*")
opencog/persist/rocks/RocksIO.cc +34 -0
……@@ -571,6 +571,23 @@ void RocksStorage::getKeysMonospace(AtomSpace* as,
571571 }
572572 if (as) key = as->add_atom(key);
573573
574 // Check for flag marker predicates and restore the flags.
575 // The mark will set the value automatically.
576 if (key->is_type(PREDICATE_NODE))
577 {
578 const std::string& kname = key->get_name();
579 if (kname == "*-IsKeyFlag-*")
580 {
581 markAtomIsKey(h);
582 continue;
583 }
584 if (kname == "*-IsMessageFlag-*")
585 {
586 markAtomIsMessage(h);
587 continue;
588 }
589 }
590
574591 // read-only Atomspaces will refuse insertion of keys.
575592 // However, we have to special-case the truth values.
576593 // Mostly because (PredicateNode "*-TruthValueKey-*")
……@@ -651,6 +668,23 @@ void RocksStorage::getKeysMulti(AtomSpace* as,
651668 Handle key = getAtom(rks.substr(kidoff));
652669 key = as->add_atom(key);
653670
671 // Check for flag marker predicates and restore the flags.
672 // The mark will set the value automatically.
673 if (key->is_type(PREDICATE_NODE))
674 {
675 const std::string& kname = key->get_name();
676 if (kname == "*-IsKeyFlag-*")
677 {
678 markAtomIsKey(h);
679 continue;
680 }
681 if (kname == "*-IsMessageFlag-*")
682 {
683 markAtomIsMessage(h);
684 continue;
685 }
686 }
687
654688 size_t junk = 0;
655689 ValuePtr vp = Sexpr::decode_value(it->value().ToString(), junk);
656690 if (vp) vp = as->add_atoms(vp);