Warning: session_start(): open(/var/lib/php/sessions/sess_tc1utqdb67ibu0muujhsc8sq02, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass AI_SubSpace implements AI_PostHandler, AI_CacheChecker {
int limit;
new MultiMap index;
new HashMap websByID;
new L webs;
bool changed;
*() {}
*(int *limit) {}
// existence of triple has already been checked
public S postTriple(T3 t) {
if (limitReached()) fail("Subspace limit reached");
Web web = webFromTriple(t);
web.source = ai_currentMaker();
addWeb(web);
ret web.globalID();
}
void addWeb(Web web) {
websByID.put(web.globalID(), web);
webs.add(web);
changed = true;
for (WebNode node : web_nodesAndRelations(web))
for (S text : asSet(node.texts()))
index.put(ai_shortenForIndex(text), node);
}
public bool hasTriple(S a, S b, S c) {
L webs = ai_withoutInvalidWebs(nodesToWebs(shortestList3(
index.get(a),
index.get(b),
index.get(c))));
ret webs_search_noVar_bool(webFromTriples(a, b, c), webs);
}
bool limitReached() {
ret limit > 0 && l(websByID) >= limit;
}
L indexedNodes_rawLookup(S s) {
ret index.get(ai_shortenForIndex(s));
}
}