use of catdata.aql.exp.SchExpRaw.Fk in project fql by CategoricalData.
the class QueryExpRaw method processBlock.
public static void processBlock(Map<String, String> options, AqlEnv env, Schema<Ty, En, Sym, Fk, Att> src0, Ctx<En, Triple<Ctx<Var, En>, Collection<Eq<Ty, En, Sym, Fk, Att, Var, Var>>, AqlOptions>> ens0, Ctx<En, Collage<Ty, En, Sym, Fk, Att, Var, Var>> cols, Block p, Ctx<String, String> params) {
// p.second.gens);
Ctx<Var, En> ctx = new Ctx<Var, En>(Util.toMapSafely(p.gens));
for (Var v : ctx.map.keySet()) {
En en = ctx.get(v);
if (!src0.ens.contains(en)) {
throw new RuntimeException("from clause contains " + v + ":" + en + ", but " + en + " is not a source entity");
}
}
Collage<Ty, En, Sym, Fk, Att, Var, Var> col = new Collage<>(src0.collage());
Ctx<String, Chc<Ty, En>> ctx0 = unVar(ctx.inRight());
col.gens.putAll(ctx.map);
for (String q : params.keySet()) {
ctx0.put(q, Chc.inLeft(new Ty(params.get(q))));
col.sks.put(new Var(q), new Ty(params.get(q)));
}
cols.put(p.en, col);
Collection<Eq<Ty, En, Sym, Fk, Att, Var, Var>> eqs = new HashSet<>();
for (Pair<RawTerm, RawTerm> eq : p.eqs) {
Triple<Ctx<Var, Chc<catdata.aql.exp.TyExpRaw.Ty, catdata.aql.exp.SchExpRaw.En>>, Term<catdata.aql.exp.TyExpRaw.Ty, catdata.aql.exp.SchExpRaw.En, catdata.aql.exp.TyExpRaw.Sym, catdata.aql.exp.SchExpRaw.Fk, catdata.aql.exp.SchExpRaw.Att, Gen, Sk>, Term<catdata.aql.exp.TyExpRaw.Ty, catdata.aql.exp.SchExpRaw.En, catdata.aql.exp.TyExpRaw.Sym, catdata.aql.exp.SchExpRaw.Fk, catdata.aql.exp.SchExpRaw.Att, Gen, Sk>> x = RawTerm.infer1x(ctx0.map, eq.first, eq.second, null, col.convert(), "In equation " + eq.first + " = " + eq.second + ", ", src0.typeSide.js).first3();
eqs.add(new Eq<>(new Ctx<>(), freeze(x.second.convert(), params), freeze(x.third.convert(), params)));
}
Map<String, String> uu = new HashMap<>(options);
uu.putAll(p.options);
AqlOptions theops = new AqlOptions(uu, null, env.defaults);
Triple<Ctx<Var, En>, Collection<Eq<Ty, En, Sym, Fk, Att, Var, Var>>, AqlOptions> b = new Triple<>(ctx, eqs, theops);
ens0.put(p.en, b);
}
Aggregations