use of catdata.provers.Thue in project fql by CategoricalData.
the class KBViewer method translate.
private static String translate(String s) {
Object o = PPParser.catConst().from(PPParser.TOKENIZER, PPParser.IGNORED).parse(s);
Const c = PPParser.toCatConst(o);
Signature<String, String> sig = new Signature<>(c.nodes, c.arrows, c.eqs);
List<Pair<List<String>, List<String>>> rules = new LinkedList<>();
for (Signature<String, String>.Eq eq : sig.eqs) {
rules.add(new Pair<>(eq.lhs.path.stream().map(x -> x.name).collect(Collectors.toList()), eq.rhs.path.stream().map(x -> x.name).collect(Collectors.toList())));
}
Thue<String> kb = new Thue<>(rules, 16);
kb.complete();
return kb.toString();
}
Aggregations