Search in sources :

Example 36 with Att

use of catdata.aql.exp.SchExpRaw.Att 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);
}
Also used : Att(catdata.aql.exp.SchExpRaw.Att) HashMap(java.util.HashMap) Var(catdata.aql.Var) Ctx(catdata.Ctx) En(catdata.aql.exp.SchExpRaw.En) Eq(catdata.aql.Eq) HashSet(java.util.HashSet) Ty(catdata.aql.exp.TyExpRaw.Ty) Fk(catdata.aql.exp.SchExpRaw.Fk) Sym(catdata.aql.exp.TyExpRaw.Sym) RawTerm(catdata.aql.RawTerm) Term(catdata.aql.Term) RawTerm(catdata.aql.RawTerm) Triple(catdata.Triple) Collection(java.util.Collection) AqlOptions(catdata.aql.AqlOptions) Collage(catdata.aql.Collage) Chc(catdata.Chc)

Aggregations

Att (catdata.aql.exp.SchExpRaw.Att)36 En (catdata.aql.exp.SchExpRaw.En)36 Fk (catdata.aql.exp.SchExpRaw.Fk)36 Sym (catdata.aql.exp.TyExpRaw.Sym)34 Ty (catdata.aql.exp.TyExpRaw.Ty)33 Ctx (catdata.Ctx)26 Pair (catdata.Pair)25 Gen (catdata.aql.exp.InstExpRaw.Gen)22 HashSet (java.util.HashSet)20 Chc (catdata.Chc)17 AqlOptions (catdata.aql.AqlOptions)17 Triple (catdata.Triple)16 Sk (catdata.aql.exp.InstExpRaw.Sk)16 List (java.util.List)15 Collage (catdata.aql.Collage)13 Term (catdata.aql.Term)13 HashMap (java.util.HashMap)13 LinkedList (java.util.LinkedList)12 RawTerm (catdata.aql.RawTerm)11 Set (java.util.Set)10