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)

1  
static DependentCache<MultiMap<GlobalID>> ai_trueWebs_cache = new DependentCache(f ai_trueWebs_calc, f cachedNodeIndex /*_changeCount*/);
2  
3  
static Set<GlobalID> ai_trueWebs() {
4  
  ret keys(ai_trueWebs_cache!);
5  
}
6  
7  
static MultiMap<GlobalID> ai_trueWebs_calc() {
8  
  ai_onNewOrRemovedWeb(f ai_trueWebs_onNewWeb, f ai_trueWebs_onRemovedWeb);
9  
  ai_trueWebs_cache.set(new MultiMap);
10  
  Collection<Web> webs = allWebsFromCachedNodeIndex_uncached();
11  
  for (Web web : webs)
12  
    ai_trueWebs_onNewWeb(web);
13  
  ret ai_trueWebs_cache!;
14  
}
15  
16  
svoid ai_trueWebs_onNewWeb(Web web) {
17  
  if (web.unverified) ret;
18  
  lock ai_trueWebs_cache.lock;
19  
  new Matches m;
20  
  for (WebNode n : web_search_dollarX(webFromTriple("$X", "is", "true"), web))
21  
    if (web_match("Web *", n, m) && isGlobalID($1))
22  
      ai_trueWebs_cache->put(asGlobalID($1), web.globalIDObj());
23  
}
24  
25  
svoid ai_trueWebs_onRemovedWeb(Web web) {
26  
  if (web.unverified) ret;
27  
  lock ai_trueWebs_cache.lock;
28  
  new Matches m;
29  
  for (WebNode n : web_search_dollarX(webFromTriple("$X", "is", "true"), web))
30  
    if (web_match("Web *", n, m) && isGlobalID($1))
31  
      ai_trueWebs_cache->remove(asGlobalID($1), web.globalIDObj());
32  
}

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: 373 / 389
Version history: 4 change(s)
Referenced in: [show references]