Skip to content

Commit

Permalink
Fix up issue of LG id's
Browse files Browse the repository at this point in the history
  • Loading branch information
linas committed Feb 21, 2023
1 parent 9c64e69 commit ada28c5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions link-grammar/dict-atomese/link-names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ std::string cached_linkname(Local* local, const Handle& lnk)
// Get the last issued link ID from the data store.
void fetch_link_id(Local* local)
{
if (nullptr == local->stnp) return;
if (not local->using_external_as) return;

// Location where issued link ID's are stored.
if (local->stnp)
local->stnp->fetch_atom(local->idanch);

// Used to hold issued link ID's.
local->stnp->fetch_atom(local->idanch);
const TruthValuePtr& tv = local->idanch->getTruthValue();
const CountTruthValuePtr ctv(CountTruthValueCast(tv));
if (ctv)
Expand All @@ -129,11 +131,14 @@ void fetch_link_id(Local* local)
// Record the last unissued id.
void store_link_id(Local* local)
{
if (nullptr == local->stnp) return;
if (not local->using_external_as) return;

TruthValuePtr tvp(createCountTruthValue(1, 0, local->last_id));
local->asp->set_truthvalue(local->idanch, tvp);
local->stnp->store_atom(local->idanch);

// Store, if there is storage.
if (local->stnp)
local->stnp->store_atom(local->idanch);
}

// ===============================================================
Expand Down

0 comments on commit ada28c5

Please sign in to comment.