static void ai_spec_moveToMiddle(S term) { L mtmRels = ai_spec_moveToMiddle_mtmRels(); for ping (Web web : indexedWebs(term)) ai_spec_moveToMiddle(web, mtmRels); } static void ai_spec_moveToMiddle(Web web) { ai_spec_moveToMiddle(web, ai_spec_moveToMiddle_mtmRels()); } static void ai_spec_moveToMiddle(Web web, L mtmRels) { for (WebRelation r : web_relationObjects(web)) { S rel = web_text(r), b = web_text(r.b); for (WebRelation mtm : mtmRels) { L l = splitAtSlash_keepAll(web_text(mtm.a)); L lReplacement = splitAtSlash_keepAll(web_text(mtm.b)); //print("Trying " + sfu(l) + " -> " + sfu(lReplacement) + " on " + rel + " / " + b); continue unless l(l) == 2 && l(lReplacement) == 2; new Matches m; S prefix = second(l) + " "; continue unless eqic(first(l), rel) && swic(b, prefix, m); //print("Match."); ai_postTriple(web_text(r.a), first(lReplacement), second(lReplacement) + " " + m.rest()); } } } static L ai_spec_moveToMiddle_mtmRels() { ret indexedRelations_verified("move to middle"); }