| … | … | @@ -9,7 +9,7 @@ |
| 9 | 9 | |
| 10 | 10 | #include <cmath> |
| 11 | 11 | #include <cstdlib> |
| 12 | | #include <opencog/atoms/truthvalue/CountTruthValue.h> |
| 12 | #include <opencog/atoms/value/FloatValue.h> |
| 13 | 13 | #include <opencog/atomspace/AtomSpace.h> |
| 14 | 14 | #include <opencog/nlp/types/atom_types.h> |
| 15 | 15 | |
| … | … | @@ -148,10 +148,11 @@ void fetch_link_id(Local* local) |
| 148 | 148 | if (local->stnp) |
| 149 | 149 | local->stnp->fetch_atom(local->idanch); |
| 150 | 150 | |
| 151 | | const TruthValuePtr& tv = local->idanch->getTruthValue(); |
| 152 | | const CountTruthValuePtr ctv(CountTruthValueCast(tv)); |
| 151 | Handle key(createNode(PREDICATE_NODE, "*-LG-last-id-*")); |
| 152 | const ValuePtr& tv = local->idanch->getValue(key); |
| 153 | const FloatValuePtr ctv(FloatValueCast(tv)); |
| 153 | 154 | if (ctv) |
| 154 | | local->last_id = std::round(ctv->get_count()); |
| 155 | local->last_id = std::round(ctv->value()[0]); |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | 158 | // Record the last unissued id. |
| … | … | @@ -159,8 +160,9 @@ void store_link_id(Local* local) |
| 159 | 160 | { |
| 160 | 161 | if (not local->using_external_as) return; |
| 161 | 162 | |
| 162 | | TruthValuePtr tvp(createCountTruthValue(1, 0, local->last_id)); |
| 163 | | local->asp->set_truthvalue(local->idanch, tvp); |
| 163 | Handle key(createNode(PREDICATE_NODE, "*-LG-last-id-*")); |
| 164 | ValuePtr tvp(createFloatValue(local->last_id)); |
| 165 | local->asp->set_value(local->idanch, key, tvp); |
| 164 | 166 | |
| 165 | 167 | // Store, if there is storage. |
| 166 | 168 | if (local->stnp) |