Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

32
LINES

< > BotCompany Repo | #1011487 // ai_trueWebs - general truth webs

JavaX fragment (include)

static DependentCache<MultiMap<GlobalID>> ai_trueWebs_cache = new DependentCache(f ai_trueWebs_calc, f cachedNodeIndex /*_changeCount*/);

static Set<GlobalID> ai_trueWebs() {
  ret keys(ai_trueWebs_cache!);
}

static MultiMap<GlobalID> ai_trueWebs_calc() {
  ai_onNewOrRemovedWeb(f ai_trueWebs_onNewWeb, f ai_trueWebs_onRemovedWeb);
  ai_trueWebs_cache.set(new MultiMap);
  Collection<Web> webs = allWebsFromCachedNodeIndex_uncached();
  for (Web web : webs)
    ai_trueWebs_onNewWeb(web);
  ret ai_trueWebs_cache!;
}

svoid ai_trueWebs_onNewWeb(Web web) {
  if (web.unverified) ret;
  lock ai_trueWebs_cache.lock;
  new Matches m;
  for (WebNode n : web_search_dollarX(webFromTriple("$X", "is", "true"), web))
    if (web_match("Web *", n, m) && isGlobalID($1))
      ai_trueWebs_cache->put(asGlobalID($1), web.globalIDObj());
}

svoid ai_trueWebs_onRemovedWeb(Web web) {
  if (web.unverified) ret;
  lock ai_trueWebs_cache.lock;
  new Matches m;
  for (WebNode n : web_search_dollarX(webFromTriple("$X", "is", "true"), web))
    if (web_match("Web *", n, m) && isGlobalID($1))
      ai_trueWebs_cache->remove(asGlobalID($1), web.globalIDObj());
}

Author comment

Began life as a copy of #1011416

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011487
Snippet name: ai_trueWebs - general truth webs
Eternal ID of this version: #1011487/5
Text MD5: 8e3aee3aa270de00e6bbb77f984f270c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-26 20:55:20
Source code size: 1180 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 372 / 388
Version history: 4 change(s)
Referenced in: [show references]