Search in sources :

Example 36 with Tuple4

use of org.jparsec.functors.Tuple4 in project fql by CategoricalData.

the class SqlToFql method toECreateTable.

@SuppressWarnings("rawtypes")
private static ECreateTable toECreateTable(Object decl) {
    Tuple4 t = (Tuple4) decl;
    String name = t.c.toString();
    Tuple3 t0 = (Tuple3) t.d;
    List t1 = (List) t0.b;
    List<Pair<String, String>> types = new LinkedList<>();
    List<Pair<String, String>> fks = new LinkedList<>();
    for (Object o : t1) {
        org.jparsec.functors.Pair p = (org.jparsec.functors.Pair) o;
        if (p.a.toString().equals("FOREIGN")) {
            Tuple5 x = (Tuple5) o;
            Tuple3 y = (Tuple3) x.b;
            fks.add(new Pair<>(y.b.toString(), x.d.toString()));
        } else {
            types.add(new Pair<>(p.a.toString(), p.b.toString()));
        }
    }
    return new ECreateTable(name, types, fks);
}
Also used : LinkedList(java.util.LinkedList) Tuple4(org.jparsec.functors.Tuple4) Tuple5(org.jparsec.functors.Tuple5) Tuple3(org.jparsec.functors.Tuple3) LinkedList(java.util.LinkedList) List(java.util.List) Pair(catdata.Pair)

Aggregations

Tuple4 (org.jparsec.functors.Tuple4)36 Pair (catdata.Pair)30 Tuple3 (org.jparsec.functors.Tuple3)30 List (java.util.List)25 LinkedList (java.util.LinkedList)24 Tuple5 (org.jparsec.functors.Tuple5)18 HashMap (java.util.HashMap)14 LinkedHashMap (java.util.LinkedHashMap)8 HashSet (java.util.HashSet)6 XPair (catdata.fpql.XExp.XPair)5 Map (java.util.Map)4 Triple (catdata.Triple)3 Pair (org.jparsec.functors.Pair)3 Chc (catdata.Chc)2 RawTerm (catdata.aql.RawTerm)2 ColimSchExpRaw (catdata.aql.exp.ColimSchExp.ColimSchExpRaw)2 Delta (catdata.fql.decl.FullQueryExp.Delta)2 Pi (catdata.fql.decl.FullQueryExp.Pi)2 Sigma (catdata.fql.decl.FullQueryExp.Sigma)2 External (catdata.fql.decl.InstExp.External)2