Search in sources :

Example 1 with XSOED

use of catdata.fpql.XExp.XSOED in project fql by CategoricalData.

the class XParser method fromSoed.

/*
J = soed {
	exists f:A->B, g:C->D;
	forall a:A, a.f = p.q, a.g = p.f;
	forall b:B, p = q; 
} : X -> Y on I
	 */
private static XSOED fromSoed(Object ooo) {
    org.jparsec.functors.Pair ooo1 = (org.jparsec.functors.Pair) ooo;
    Tuple4 a = (Tuple4) ooo1.a;
    List<Triple<String, String, String>> es = new LinkedList<>();
    List<FOED> as = new LinkedList<>();
    List<Tuple5> es0 = (List<Tuple5>) a.b;
    for (Tuple5 t : es0) {
        es.add(new Triple(t.a, t.c, t.e));
    }
    List<Tuple4> as0 = (List<Tuple4>) a.d;
    for (Tuple4 t : as0) {
        List<Tuple3> eqs = (List<Tuple3>) t.d;
        List<Pair<List<String>, List<String>>> eqs0 = new LinkedList<>();
        for (Tuple3 x : eqs) {
            eqs0.add(new Pair(x.a, x.c));
        }
        as.add(new FOED((String) t.b, (String) t.c, eqs0));
    }
    Tuple4 b = (Tuple4) ooo1.b;
    String src = (String) b.b;
    String dst = (String) b.c;
    String i = (String) b.d;
    XSOED ret = new XSOED(es, as, src, dst, i);
    return ret;
}
Also used : FOED(catdata.fpql.XExp.XSOED.FOED) SuperFOED(catdata.fpql.XExp.XSuperED.SuperFOED) XSOED(catdata.fpql.XExp.XSOED) LinkedList(java.util.LinkedList) Tuple4(org.jparsec.functors.Tuple4) Triple(catdata.Triple) Tuple5(org.jparsec.functors.Tuple5) Tuple3(org.jparsec.functors.Tuple3) List(java.util.List) LinkedList(java.util.LinkedList) Pair(catdata.Pair) XPair(catdata.fpql.XExp.XPair)

Aggregations

Pair (catdata.Pair)1 Triple (catdata.Triple)1 XPair (catdata.fpql.XExp.XPair)1 XSOED (catdata.fpql.XExp.XSOED)1 FOED (catdata.fpql.XExp.XSOED.FOED)1 SuperFOED (catdata.fpql.XExp.XSuperED.SuperFOED)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Tuple3 (org.jparsec.functors.Tuple3)1 Tuple4 (org.jparsec.functors.Tuple4)1 Tuple5 (org.jparsec.functors.Tuple5)1