Search in sources :

Example 26 with Ty

use of catdata.aql.exp.TyExpRaw.Ty in project fql by CategoricalData.

the class ColimitSchema method removeAtt.

public ColimitSchema<N> removeAtt(Att src, Var v, Term<Ty, En, Sym, Fk, Att, Void, Void> t, boolean checkJava) {
    if (!schemaStr.atts.containsKey(src)) {
        throw new RuntimeException(src + " is not an attribute in \n" + schemaStr);
    }
    En en1 = schemaStr.atts.get(src).first;
    Ty ty0 = schemaStr.atts.get(src).second;
    if (!schemaStr.type(new Pair<>(v, en1), t).equals(Chc.inLeft(ty0))) {
        throw new RuntimeException("The term " + t + " has type " + schemaStr.type(new Pair<>(v, en1), t).toStringMash() + " and not " + ty0 + " as expected.");
    }
    if (!schemaStr.dp.eq(new Ctx<>(v, Chc.inRight(en1)), t, Term.Att(src, Term.Var(v)))) {
        throw new RuntimeException("The term " + t + " is not provably equal to " + Term.Att(src, Term.Var(v)));
    }
    if (t.contains(Head.Att(src))) {
        throw new RuntimeException("Cannot replace " + src + " with " + t + " because that term contains " + src);
    }
    Mapping<Ty, En, Sym, Fk, Att, En, Fk, Att> isoToUser = Mapping.id(schemaStr);
    Mapping<Ty, En, Sym, Fk, Att, En, Fk, Att> isoFromUser = Mapping.id(schemaStr);
    Map<Att, Pair<En, Ty>> atts = new HashMap<>(schemaStr.atts.map);
    atts.remove(src);
    Set<Triple<Pair<Var, En>, Term<Ty, En, Sym, Fk, Att, Void, Void>, Term<Ty, En, Sym, Fk, Att, Void, Void>>> eqs = new HashSet<>();
    for (Triple<Pair<Var, En>, Term<Ty, En, Sym, Fk, Att, Void, Void>, Term<Ty, En, Sym, Fk, Att, Void, Void>> eq : schemaStr.eqs) {
        Triple<Pair<Var, En>, Term<Ty, En, Sym, Fk, Att, Void, Void>, Term<Ty, En, Sym, Fk, Att, Void, Void>> tr = new Triple<>(eq.first, eq.second.replaceHead(Head.Att(src), Util.singList(v), t), eq.third.replaceHead(Head.Att(src), Util.singList(v), t));
        if (!tr.second.equals(tr.third) && !eqs.contains(tr)) {
            eqs.add(tr);
        }
    }
    DP<Ty, En, Sym, Fk, Att, Void, Void> dp = new DP<Ty, En, Sym, Fk, Att, Void, Void>() {

        @Override
        public String toStringProver() {
            return "remove attribute of " + schemaStr.dp.toStringProver();
        }

        @Override
        public boolean eq(Ctx<Var, Chc<Ty, En>> ctx, Term<Ty, En, Sym, Fk, Att, Void, Void> lhs, Term<Ty, En, Sym, Fk, Att, Void, Void> rhs) {
            return schemaStr.dp.eq(ctx, lhs, rhs);
        }
    };
    Schema<Ty, En, Sym, Fk, Att> schemaStr2 = new Schema<>(ty, schemaStr.ens, atts, schemaStr.fks.map, eqs, dp, checkJava);
    Map<Att, Triple<Var, En, Term<Ty, En, Sym, Fk, Att, Void, Void>>> attsM = new HashMap<>(isoToUser.atts.map);
    attsM.put(src, new Triple<>(v, en1, t));
    isoToUser = new Mapping<>(isoToUser.ens.map, attsM, isoToUser.fks.map, schemaStr, schemaStr2, checkJava);
    Map<Att, Triple<Var, En, Term<Ty, En, Sym, Fk, Att, Void, Void>>> attsM2 = new HashMap<>(isoFromUser.atts.map);
    attsM2.remove(src);
    isoFromUser = new Mapping<>(isoFromUser.ens.map, attsM2, isoFromUser.fks.map, schemaStr2, schemaStr, checkJava);
    return wrap(isoToUser, isoFromUser);
}
Also used : Att(catdata.aql.exp.SchExpRaw.Att) HashMap(java.util.HashMap) Ctx(catdata.Ctx) En(catdata.aql.exp.SchExpRaw.En) Pair(catdata.Pair) HashSet(java.util.HashSet) Ty(catdata.aql.exp.TyExpRaw.Ty) Fk(catdata.aql.exp.SchExpRaw.Fk) Sym(catdata.aql.exp.TyExpRaw.Sym) Triple(catdata.Triple)

Example 27 with Ty

use of catdata.aql.exp.TyExpRaw.Ty in project fql by CategoricalData.

the class RawTerm method infer2.

public static Triple<Ctx<Var, Chc<Ty, En>>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>> infer2(List<Pair<String, String>> l, RawTerm a, RawTerm b, Collage<Ty, En, Sym, Fk, Att, Gen, Sk> col, AqlJs<Ty, Sym> js) {
    Map<String, Chc<Ty, En>> ctx = new HashMap<>();
    for (Pair<String, String> p : l) {
        if (ctx.containsKey(p.first)) {
            throw new RuntimeException("Duplicate variable " + p.first + " in context " + Ctx.toString(l));
        }
        if (p.second != null) {
            if (col.tys.contains(p.second) && col.ens.contains(p.second)) {
                throw new RuntimeException("Ambiguous: " + p.second + " is an entity and a type");
            } else if (col.tys.contains(p.second)) {
                Ty tt = new Ty(p.second);
                // TODO aql remove for
                ctx.put(p.first, Chc.inLeft(tt));
            // loops for other ones
            } else if (col.ens.contains(p.second)) {
                En tt = new En(p.second);
                ctx.put(p.first, Chc.inRight(tt));
            } else {
                throw new RuntimeException(p.second + " is neither a type nor entity");
            }
        } else {
            ctx.put(p.first, null);
        }
    }
    Triple<Ctx<Var, Chc<Ty, En>>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>> eq0 = infer1x(ctx, a, b, null, col, "", js).first3();
    LinkedHashMap<Var, Chc<Ty, En>> map = new LinkedHashMap<>();
    for (String k : ctx.keySet()) {
        Chc<Ty, En> v = eq0.first.get(new Var(k));
        map.put(new Var(k), v);
    }
    Ctx<Var, Chc<Ty, En>> ctx2 = new Ctx<>(map);
    Triple<Ctx<Var, Chc<Ty, En>>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>> tr = new Triple<>(ctx2, eq0.second, eq0.third);
    return tr;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Ty(catdata.aql.exp.TyExpRaw.Ty) Ctx(catdata.Ctx) En(catdata.aql.exp.SchExpRaw.En) LinkedHashMap(java.util.LinkedHashMap) Triple(catdata.Triple) Chc(catdata.Chc)

Example 28 with Ty

use of catdata.aql.exp.TyExpRaw.Ty in project fql by CategoricalData.

the class RawTerm method infer_good.

private static Set<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>> infer_good(RawTerm e, Chc<Ty, En> expected, Collage<Ty, En, Sym, Fk, Att, Gen, Sk> col, String pre, AqlJs<Ty, Sym> js, Map<Var, Chc<Ty, En>> vars) {
    if (e.annotation != null && !col.tys.contains(new Ty(e.annotation))) {
        throw new RuntimeException(pre + "Annotation " + e.annotation + " is not a type (" + col.tys + ").");
    }
    Set<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>> ret = new HashSet<>();
    if (vars.keySet().contains(new Var((String) e.head)) && e.annotation == null) {
        Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Var(new Var((String) e.head));
        if (expected != null) {
            Ctx<Var, Chc<Ty, En>> ret2 = new Ctx<>();
            ret2.put(new Var((String) e.head), expected);
            if (ret2.agreeOnOverlap(Ctx.fromNullable(vars))) {
                ret.add(new Triple<>(ret1, ret2, expected));
            }
        } else {
            for (En en : col.ens) {
                Ctx<Var, Chc<Ty, En>> ret2 = new Ctx<>();
                ret2.put(new Var((String) e.head), Chc.inRight(en));
                if (ret2.agreeOnOverlap(Ctx.fromNullable(vars))) {
                    ret.add(new Triple<>(ret1, ret2, Chc.inRight(en)));
                }
            }
            for (Ty ty : col.tys) {
                Ctx<Var, Chc<Ty, En>> ret2 = new Ctx<>();
                if (ret2.agreeOnOverlap(Ctx.fromNullable(vars))) {
                    ret2.put(new Var((String) e.head), Chc.inLeft(ty));
                }
                ret.add(new Triple<>(ret1, ret2, Chc.inLeft(ty)));
            }
        }
    }
    if (col.syms.containsKey(new Sym(e.head)) && e.annotation == null) {
        // //System.out.println("a " + e);
        List<List<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>>> l = new LinkedList<>();
        l.add(new LinkedList<>());
        for (int i = 0; i < e.args.size(); i++) {
            RawTerm arg = e.args.get(i);
            // //System.out.println("arg " + arg);
            Ty ty = col.syms.get(new Sym(e.head)).first.get(i);
            Set<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>> z = infer_good(arg, Chc.inLeft(ty), col, pre, js, vars);
            List<List<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>>> l2 = new LinkedList<>();
            for (List<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>> old : l) {
                // //System.out.println("old " + old);
                for (Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>> y : z) {
                    if (y.third.equals(Chc.inLeft(ty))) {
                        // //System.out.println("z z");
                        l2.add(Util.append(old, Util.singList(y)));
                    }
                }
            }
            l = l2;
        }
        outer: for (List<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>> outcome : l) {
            // //System.out.println("outcome " + outcome);
            List<Term<Ty, En, Sym, Fk, Att, Gen, Sk>> w = outcome.stream().map(x -> x.first).collect(Collectors.toList());
            Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Sym(new Sym(e.head), w);
            Ctx<Var, Chc<Ty, En>> ret2 = new Ctx<>();
            for (Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>> ctx0 : outcome) {
                if (!ctx0.second.agreeOnOverlap(ret2) || !ctx0.second.agreeOnOverlap(Ctx.fromNullable(vars))) {
                    // //System.out.println("xxx ");
                    continue outer;
                }
                // //System.out.println("yyy");
                ret2.map.putAll(ctx0.second.map);
            }
            for (int i = 0; i < e.args.size(); i++) {
                RawTerm arg = e.args.get(i);
                // //System.out.println("2arx " + arg);
                Chc<Ty, En> ty = Chc.inLeft(col.syms.get(new Sym(e.head)).first.get(i));
                Var v = new Var((String) arg.head);
                if (vars.keySet().contains(v)) {
                    // //System.out.println("a " + v);
                    if (ret2.containsKey(v) && !ret2.get(v).equals(ty)) {
                        // //System.out.println("b " + v);
                        continue;
                    } else if (!ret2.containsKey(v)) {
                        // //System.out.println("c " + v);
                        ret2.put(new Var(e.args.get(i).head), ty);
                    }
                }
            }
            Chc<Ty, En> ret3 = Chc.inLeft(col.syms.get(new Sym(e.head)).second);
            if (expected != null && !expected.equals(ret3)) {
            // //System.out.println("d " );
            } else {
                // //System.out.println("e " );
                if (ret2.agreeOnOverlap(Ctx.fromNullable(vars))) {
                    ret.add(new Triple<>(ret1, ret2, ret3));
                }
            }
        }
    }
    for (En en : col.ens) {
        if (col.fks.containsKey(new Fk(en, e.head)) && e.args.size() == 1 && e.annotation == null) {
            for (Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>> outcome : infer_good(e.args.get(0), Chc.inRight(col.fks.get(new Fk(en, e.head)).first), col, pre, js, vars)) {
                Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Fk(new Fk(en, e.head), outcome.first);
                // System.out.println("trying " + en + " and " + e.head);
                Ctx<Var, Chc<Ty, En>> ret2 = new Ctx<>(outcome.second.map);
                Var v = new Var(e.args.get(0).head);
                Chc<Ty, En> ty = Chc.inRight(col.fks.get(new Fk(en, e.head)).first);
                if (vars.keySet().contains(v)) {
                    if (ret2.containsKey(v) && !ret2.get(v).equals(ty)) {
                        // System.out.println("no1");
                        continue;
                    } else if (!ret2.containsKey(v)) {
                        ret2.put(new Var(e.args.get(0).head), ty);
                    }
                }
                Chc<Ty, En> ret3 = Chc.inRight(col.fks.get(new Fk(en, e.head)).second);
                Chc<Ty, En> argt = Chc.inRight(col.fks.get(new Fk(en, e.head)).first);
                if (expected != null && !expected.equals(ret3)) {
                } else {
                    if (argt.equals(outcome.third)) {
                        if (ret2.agreeOnOverlap(Ctx.fromNullable(vars))) {
                            ret.add(new Triple<>(ret1, ret2, ret3));
                        } else {
                        // System.out.println("b3");
                        }
                    } else {
                    // System.out.println("c3");
                    }
                }
            }
        }
        if (col.atts.containsKey(new Att(en, e.head)) && e.args.size() == 1 && e.annotation == null) {
            // System.out.println("x " + e);
            for (Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>> outcome : infer_good(e.args.get(0), Chc.inRight(col.atts.get(new Att(en, e.head)).first), col, pre, js, vars)) {
                // System.out.println("y " + outcome);
                Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Att(new Att(en, e.head), outcome.first);
                Ctx<Var, Chc<Ty, En>> ret2 = new Ctx<>(outcome.second.map);
                Var v = new Var(e.args.get(0).head);
                Chc<Ty, En> ty = Chc.inRight(col.atts.get(new Att(en, e.head)).first);
                if (vars.keySet().contains(v)) {
                    if (ret2.containsKey(v) && !ret2.get(v).equals(ty)) {
                        continue;
                    } else if (!ret2.containsKey(v)) {
                        // System.out.println("b " + v);
                        ret2.put(v, ty);
                    }
                }
                Chc<Ty, En> ret3 = Chc.inLeft(col.atts.get(new Att(en, e.head)).second);
                Chc<Ty, En> argt = Chc.inRight(col.atts.get(new Att(en, e.head)).first);
                if (expected != null && !expected.equals(ret3)) {
                // System.out.println("d " + v);
                } else {
                    // System.out.println("e " + v);
                    if (argt.equals(outcome.third)) {
                        // System.out.println("f " + v);
                        if (ret2.agreeOnOverlap(Ctx.fromNullable(vars))) {
                            ret.add(new Triple<>(ret1, ret2, ret3));
                        }
                    }
                }
            }
        }
    }
    if (col.gens.containsKey(new Gen(e.head)) && e.args.isEmpty() && e.annotation == null) {
        Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Gen(new Gen(e.head));
        Chc<Ty, En> ret3 = Chc.inRight(col.gens.get(new Gen(e.head)));
        if (expected != null && !expected.equals(ret3)) {
        } else {
            ret.add(new Triple<>(ret1, new Ctx<>(), ret3));
        }
    }
    if (col.sks.containsKey(new Sk(e.head)) && e.args.isEmpty() && e.annotation == null) {
        Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Sk(new Sk(e.head));
        Chc<Ty, En> ret3 = Chc.inLeft(col.sks.get(new Sk(e.head)));
        if (expected != null && !expected.equals(ret3)) {
        } else {
            ret.add(new Triple<>(ret1, new Ctx<>(), ret3));
        }
    }
    if (e.args.isEmpty() && e.annotation != null) {
        Ty ty = new Ty(e.annotation);
        Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Obj(js.parse(ty, e.head), ty);
        Chc<Ty, En> ret3 = Chc.inLeft(ty);
        if (expected != null && !expected.equals(ret3)) {
        } else {
            ret.add(new Triple<>(ret1, new Ctx<>(), ret3));
        }
    }
    // as primitive - only if not a variable/generator/etc in scope i.e. none above fired
    if (e.args.isEmpty() && e.annotation == null && ret.isEmpty()) {
        for (Ty ty : col.tys) {
            if (expected != null && !expected.equals(Chc.inLeft(ty))) {
                continue;
            }
            try {
                Term<Ty, En, Sym, Fk, Att, Gen, Sk> ret1 = Term.Obj(js.parse(ty, e.head), ty);
                Chc<Ty, En> ret3 = Chc.inLeft(ty);
                if (expected != null && !expected.equals(ret3)) {
                // System.out.println("zzz");
                } else {
                    ret.add(new Triple<>(ret1, new Ctx<>(), ret3));
                // System.out.println("added " + ret + " and " + ret3);
                }
            } catch (Exception ex) {
                if (expected != null) {
                    ex.printStackTrace();
                // throw ex;
                }
            // //ex.printStackTrace();
            }
        }
    }
    return ret;
}
Also used : Att(catdata.aql.exp.SchExpRaw.Att) Ctx(catdata.Ctx) En(catdata.aql.exp.SchExpRaw.En) List(java.util.List) LinkedList(java.util.LinkedList) HashSet(java.util.HashSet) Ty(catdata.aql.exp.TyExpRaw.Ty) Fk(catdata.aql.exp.SchExpRaw.Fk) Sym(catdata.aql.exp.TyExpRaw.Sym) LinkedList(java.util.LinkedList) Triple(catdata.Triple) Gen(catdata.aql.exp.InstExpRaw.Gen) Sk(catdata.aql.exp.InstExpRaw.Sk) Chc(catdata.Chc)

Example 29 with Ty

use of catdata.aql.exp.TyExpRaw.Ty in project fql by CategoricalData.

the class AqlViewer method viewDP.

/*public static <Ty, En, Sym, Fk, Att> JComponent viewSchema2(Schema<Ty, En, Sym, Fk, Att> schema) {
		mxGraph graph = new mxGraph();
		Object parent = graph.getDefaultParent();

		Ctx<Chc<En,Ty>, Object> nodes = new Ctx<>();
		for (En en : schema.ens) {
			Object v1 = graph.insertVertex(parent, null, en.toString(), 20, 20, 80, 30);
			nodes.put(Chc.inLeft(en), v1);
		}
		for (Ty ty : schema.typeSide.tys) {
			Object v1 = graph.insertVertex(parent, null, ty.toString(), 20, 20, 80, 30);
			nodes.put(Chc.inRight(ty), v1);
		}
		for (Att att : schema.atts.keySet()) {
			graph.insertEdge(parent, null, att.toString(), nodes.get(Chc.inLeft(schema.atts.get(att).first)), nodes.get(Chc.inRight(schema.atts.get(att).second)));
		}
		for (Fk fk : schema.fks.keySet()) {
			graph.insertEdge(parent, null, fk.toString(), nodes.get(Chc.inLeft(schema.fks.get(fk).first)), nodes.get(Chc.inLeft(schema.fks.get(fk).second)));
		}
		mxGraphLayout layout = new mxOrganicLayout(graph); // or whatever layouting algorithm
		layout.execute(parent);
		
		mxGraphComponent graphComponent = new mxGraphComponent(graph);
		
		//  Map<String, Object> style = graph.getStylesheet().getDefaultEdgeStyle();
		 // style.put(mxConstants.STYLE_ROUNDED, true);
		//  style.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_ENTITY_RELATION);
		
		return graphComponent;
	}	*/
private static <Ty, En, Sym, Fk, Att, Gen, Sk> JComponent viewDP(DP<Ty, En, Sym, Fk, Att, Gen, Sk> dp, Collage col, AqlJs js) {
    CodeTextPanel input = new CodeTextPanel("Input (either equation-in-ctx or term-in-ctx)", "");
    CodeTextPanel output = new CodeTextPanel("Output", "");
    JButton eq = new JButton("Decide Equation-in-ctx");
    JButton nf = new JButton("Normalize Term-in-ctx");
    /*
		 * if (!dp.hasNFs()) { nf.setEnabled(false); }
		 */
    JButton print = new JButton("Show Info");
    JPanel buttonPanel = new JPanel(new GridLayout(1, 3));
    buttonPanel.add(eq);
    buttonPanel.add(nf);
    buttonPanel.add(print);
    // TODO: aql does not position correctly
    Split split = new Split(.5, JSplitPane.VERTICAL_SPLIT);
    split.add(input);
    split.add(output);
    JPanel main = new JPanel(new BorderLayout());
    main.add(split, BorderLayout.CENTER);
    main.add(buttonPanel, BorderLayout.NORTH);
    print.addActionListener(x -> output.setText(dp.toStringProver()));
    eq.addActionListener(x -> {
        try {
            Triple<List<Pair<String, String>>, RawTerm, RawTerm> y = AqlParser.getParser().parseEq(input.getText());
            Triple<Ctx<Var, Chc<Ty, En>>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>> z = RawTerm.infer2(y.first, y.second, y.third, col, js);
            boolean isEq = dp.eq(z.first, z.second, z.third);
            output.setText(Boolean.toString(isEq));
        } catch (Exception ex) {
            ex.printStackTrace();
            output.setText(ex.getMessage());
        }
    });
    nf.addActionListener(x -> {
        try {
            Pair<List<Pair<String, String>>, RawTerm> y = AqlParser.getParser().parseTermInCtx(input.getText());
            Triple<Ctx<Var, Chc<Ty, En>>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Term<Ty, En, Sym, Fk, Att, Gen, Sk>> z = RawTerm.infer2(y.first, y.second, y.second, col, js);
            Term<Ty, En, Sym, Fk, Att, Gen, Sk> w = dp.nf(z.first, z.second);
            output.setText(w.toString());
        } catch (Exception ex) {
            ex.printStackTrace();
            output.setText(ex.getMessage());
        }
    });
    return main;
}
Also used : Att(catdata.aql.exp.SchExpRaw.Att) JPanel(javax.swing.JPanel) Ty(catdata.aql.exp.TyExpRaw.Ty) Fk(catdata.aql.exp.SchExpRaw.Fk) Ctx(catdata.Ctx) Sym(catdata.aql.exp.TyExpRaw.Sym) JButton(javax.swing.JButton) En(catdata.aql.exp.SchExpRaw.En) Term(catdata.aql.Term) RawTerm(catdata.aql.RawTerm) RawTerm(catdata.aql.RawTerm) Gen(catdata.aql.exp.InstExpRaw.Gen) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) CodeTextPanel(catdata.ide.CodeTextPanel) Sk(catdata.aql.exp.InstExpRaw.Sk) List(java.util.List) LinkedList(java.util.LinkedList) Split(catdata.ide.Split)

Example 30 with Ty

use of catdata.aql.exp.TyExpRaw.Ty in project fql by CategoricalData.

the class AqlViewer method visit.

@Override
public <Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> Unit visit(JTabbedPane ret, Query<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> Q) {
    try {
        Query<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> q = Q.unnest();
        JComponent comp = makeQueryPanel(q);
        ret.add("SQL", comp);
    } catch (Exception ex) {
        ex.printStackTrace();
        ret.add("SQL Exn", new CodeTextPanel("Exception", ex.getMessage()));
    }
    return new Unit();
}
Also used : Ty(catdata.aql.exp.TyExpRaw.Ty) Sym(catdata.aql.exp.TyExpRaw.Sym) JComponent(javax.swing.JComponent) Unit(catdata.Unit) CodeTextPanel(catdata.ide.CodeTextPanel)

Aggregations

Ty (catdata.aql.exp.TyExpRaw.Ty)43 En (catdata.aql.exp.SchExpRaw.En)36 Sym (catdata.aql.exp.TyExpRaw.Sym)35 Att (catdata.aql.exp.SchExpRaw.Att)33 Fk (catdata.aql.exp.SchExpRaw.Fk)33 Ctx (catdata.Ctx)29 Pair (catdata.Pair)27 HashSet (java.util.HashSet)21 Gen (catdata.aql.exp.InstExpRaw.Gen)20 Chc (catdata.Chc)19 List (java.util.List)19 Triple (catdata.Triple)18 AqlOptions (catdata.aql.AqlOptions)18 HashMap (java.util.HashMap)17 Term (catdata.aql.Term)15 Sk (catdata.aql.exp.InstExpRaw.Sk)15 LinkedList (java.util.LinkedList)15 Collage (catdata.aql.Collage)14 RawTerm (catdata.aql.RawTerm)14 Set (java.util.Set)12