static void webs_toTripleFile(Collection webs, PrintWriter out) { new L names; new Map index; new StringBuilder buf; for (Web web : webs) { T3 t = ai_webToTriple(web); if (t == null) fail("Not tripelizable: " + webToStringShort(web)); buf.append( webs_toTripleFile_indexGet(names, index, t.a) + " " + webs_toTripleFile_indexGet(names, index, t.b) + " " + webs_toTripleFile_indexGet(names, index, t.c) + "\n"); } out.println(struct(names)); out.print(buf); } static int webs_toTripleFile_indexGet(L names, Map index, S s) { int i = index.get(s); if (i < 0) { i = l(names); names.add(i); } ret i; }