use of catdata.opl.OplQuery.Agg in project fql by CategoricalData.
the class OplParser method fromAgg.
@SuppressWarnings("unused")
private static Agg<String, String, String, String, String, String> fromAgg(Collection vars, Collection consts, Object o, boolean suppressError) {
Tuple5<Tuple4<?, String, String, ?>, List<Tuple3<String, ?, String>>, List<Tuple3<?, ?, ?>>, org.jparsec.functors.Pair<?, ?>, ?> t = (Tuple5<Tuple4<?, String, String, ?>, List<Tuple3<String, ?, String>>, List<Tuple3<?, ?, ?>>, org.jparsec.functors.Pair<?, ?>, ?>) o;
LinkedHashMap<String, String> from = new LinkedHashMap<>();
Set<Pair<OplTerm<String, String>, OplTerm<String, String>>> where = new HashSet<>();
for (Object x : t.b) {
Tuple3 l = (Tuple3) x;
if (from.containsKey(l.a.toString())) {
throw new RuntimeException("Duplicate for: " + l.a);
}
from.put(l.a.toString(), l.c.toString());
}
Set<String> allVars = new HashSet<>();
allVars.addAll(vars);
allVars.addAll(from.keySet());
for (Object x : t.c) {
Tuple3 l = (Tuple3) x;
where.add(new Pair(toTerm(allVars, null, l.a, true), toTerm(allVars, null, l.c, true)));
}
OplTerm<String, String> att = toTerm(allVars, null, t.d.b, true);
return new Agg<>(t.a.b, t.a.c, from, where, att);
}
Aggregations