use of catdata.fql.cat.Inst in project fql by CategoricalData.
the class Instance method toFunctor2.
public Inst<Node, Path, Object, Object> toFunctor2() throws FQLException {
FinCat<Node, Path> cat = thesig.toCategory2().first;
Map<Node, Set<Value<Object, Object>>> objM = new HashMap<>();
for (Node obj : cat.objects) {
if (data.get(obj.string) == null) {
throw new RuntimeException("No data for " + obj + " in " + data);
}
objM.put(obj, conv(data.get(obj.string)));
}
Map<Arr<Node, Path>, Map<Value<Object, Object>, Value<Object, Object>>> arrM = new HashMap<>();
for (Arr<Node, Path> arr : cat.arrows) {
List<String> es = arr.arr.asList();
String h = es.get(0);
Set<Pair<Object, Object>> h0 = data.get(h);
for (int i = 1; i < es.size(); i++) {
h0 = compose2(h0, data.get(es.get(i)));
}
Map<Value<Object, Object>, Value<Object, Object>> xxx = FDM.degraph(h0);
arrM.put(arr, xxx);
}
return new Inst<>(objM, arrM, cat);
}