Search in sources :

Example 11 with Const

use of catdata.fql.decl.SigExp.Const in project fql by CategoricalData.

the class JDBCBridge method gatherSubstInv2.

private static void gatherSubstInv2(FQLProgram prog, Map<String, Set<Map<Object, Object>>> ret, Statement Stmt, String k, InstExp v) throws SQLException {
    Const t = v.type(prog).toConst(prog);
    for (String n : t.nodes) {
        ResultSet RS = Stmt.executeQuery("SELECT c0,c1 FROM " + k + "_" + n + "_subst_inv");
        Set<Map<Object, Object>> ms = new HashSet<>();
        while (RS.next()) {
            Map<Object, Object> m = new HashMap<>();
            m.put("c0", RS.getObject("c0").toString());
            m.put("c1", RS.getObject("c1").toString());
            ms.add(m);
        }
        RS.close();
        ret.put(k + "_" + n + "_subst_inv", ms);
    }
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Const(catdata.fql.decl.SigExp.Const) ResultSet(java.sql.ResultSet) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 12 with Const

use of catdata.fql.decl.SigExp.Const in project fql by CategoricalData.

the class JDBCBridge method gatherSubstInv.

private static void gatherSubstInv(FQLProgram prog, Map<String, Set<Map<Object, Object>>> ret, Statement Stmt, String k, InstExp v) throws SQLException {
    Const t = v.type(prog).toConst(prog);
    for (String n : t.nodes) {
        ResultSet RS = Stmt.executeQuery("SELECT c0,c1 FROM " + k + "_" + n + "_subst_inv");
        Set<Map<Object, Object>> ms = new HashSet<>();
        while (RS.next()) {
            Map<Object, Object> m = new HashMap<>();
            m.put("c0", Integer.parseInt(RS.getObject("c0").toString()));
            m.put("c1", Integer.parseInt(RS.getObject("c1").toString()));
            ms.add(m);
        }
        RS.close();
        ret.put(k + "_" + n + "_subst_inv", ms);
    }
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Const(catdata.fql.decl.SigExp.Const) ResultSet(java.sql.ResultSet) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Aggregations

Const (catdata.fql.decl.SigExp.Const)12 Pair (catdata.Pair)8 Triple (catdata.Triple)7 MapExp (catdata.fql.decl.MapExp)4 HashSet (java.util.HashSet)4 ResultSet (java.sql.ResultSet)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 InstExp (catdata.fql.decl.InstExp)2 Var (catdata.fql.decl.SigExp.Var)2 LinkedList (java.util.LinkedList)2 Comp (catdata.fql.decl.FullQueryExp.Comp)1 Delta (catdata.fql.decl.FullQueryExp.Delta)1 Pi (catdata.fql.decl.FullQueryExp.Pi)1 Sigma (catdata.fql.decl.FullQueryExp.Sigma)1 Signature (catdata.fql.decl.Signature)1 TransExp (catdata.fql.decl.TransExp)1 ExpPSM (catdata.fql.sql.ExpPSM)1 PSM (catdata.fql.sql.PSM)1