static S ai_subst_web(S webID) { int n = websMadeInThread(); Web web = allWebsByID().get(webID); if (web == null) ret "Web not found: " + webID; WebRelation rel = web_findRelationNamed(web, "matches"); if (rel == null) ret "No 'matches' relation"; S pat = web_unquoted(rel.a), input = web_unquoted(rel.b); if (neq(pat, "substitute * => * with *")) ret "Wrong pattern"; new Matches m; if (!flexMatchIC(pattern, input, m)) ret "No match"; S src = unquote(m.get(0)); L terms = unquoteAll(trimAll(splitAtJavaToken(m.get(1), ","))); for (S term : terms) ai_postTriple(src, "see:", term); ret nWebs(websMadeInThread()-n) + " made"; }