Search in sources :

Example 1 with Relationalize

use of catdata.fql.decl.TransExp.Relationalize in project fql by CategoricalData.

the class TransChecker method visit.

@Override
public Pair<String, String> visit(FQLProgram env, Squash e) {
    InstExp s = env.insts.get(e.src);
    if (!(s instanceof InstExp.Relationalize)) {
        throw new RuntimeException("Not a relationalize: " + e);
    }
    InstExp.Relationalize xxx = (InstExp.Relationalize) s;
    return new Pair<>(xxx.I, e.src);
}
Also used : Relationalize(catdata.fql.decl.TransExp.Relationalize) InstExp(catdata.fql.decl.InstExp) Pair(catdata.Pair)

Example 2 with Relationalize

use of catdata.fql.decl.TransExp.Relationalize in project fql by CategoricalData.

the class TransChecker method visit.

@Override
public Pair<String, String> visit(FQLProgram env, Relationalize e) {
    Pair<String, String> ht = e.h.type(env);
    InstExp i1 = env.insts.get(e.src);
    if (!(i1 instanceof InstExp.Relationalize)) {
        throw new RuntimeException(i1 + " is not a relationalize in " + e);
    }
    String i1x = ((InstExp.Relationalize) i1).I;
    if (!i1x.equals(ht.first)) {
        throw new RuntimeException("Source mismatch on " + e + ": " + i1x + " and " + ht.first);
    }
    InstExp i2 = env.insts.get(e.dst);
    if (!(i2 instanceof InstExp.Relationalize)) {
        throw new RuntimeException(i2 + " is not a relationalize in " + e);
    }
    String i2x = ((InstExp.Relationalize) i2).I;
    if (!i2x.equals(ht.second)) {
        throw new RuntimeException("Target mismatch on " + e + ": " + i2x + " and " + ht.second);
    }
    return new Pair<>(e.src, e.dst);
}
Also used : Relationalize(catdata.fql.decl.TransExp.Relationalize) InstExp(catdata.fql.decl.InstExp) Pair(catdata.Pair)

Aggregations

Pair (catdata.Pair)2 InstExp (catdata.fql.decl.InstExp)2 Relationalize (catdata.fql.decl.TransExp.Relationalize)2