sclass WebToCAL { BufferedImage img = newBufferedImage(20, 20, Color.white); new CirclesAndLines cal; new Map map; //new Map, Line> lines; S makeLabel(Lisp lisp) { ret conceptLanguageToEnglish(clUnparse(lisp)); } void convert(Web web) { for (WebNode node : web.nodes) { Circle c = cal.circle(img, makeLabel(first(node.labels)), cal_randomCircleCoord(), cal_randomCircleCoord()); map.put(node, c); for (Lisp l : dropFirst(node.labels)) c.addLabel(makeLabel(l)); } for (Pair p : keys(web.relations)) { WebNode rel = web.relations.get(p); Circle a = map.get(p.a), b = map.get(p.b); if (a == null || b == null) { warn("webToCAL: Circle not found"); continue; } /*Line line = lines.get(p); if (line == null) lines.put(p,*/ Line line = cal.arrow(a, makeLabel(first(rel.labels)), b); for (Lisp l : dropFirst(rel.labels)) line.addLabel(makeLabel(l)); } } } static CirclesAndLines webToCAL(Web web) { new WebToCAL wtc; wtc.convert(web); ret wtc.cal; }