Commit 83529b35 authored by Ryan Wisnesky's avatar Ryan Wisnesky
Browse files

minor fixes from Mexico

parent 29bdef17
Loading
Loading
Loading
Loading
+1 −1
Changes for resources/examples/aql/JDBC SQL.aql: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ command view2 = exec_jdbc "" "" {
//to import all the data in a SQL DB at once onto an auto-generated schema, use the following:
instance import_all_inst = import_jdbc_all "" "" 
//the schema can be obtained as
schema import_all_schema = schemaOf import_all
schema import_all_schema = schemaOf import_all_inst
//or
schema import_all_schema_2 = schemaOf (import_jdbc_all "" "" {
	options
+12 −1
Changes for src/catdata/aql/Query.java: 12 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -117,14 +117,18 @@ public final class Query<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> implements Sem
	private static <Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> Blob<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> unfoldNestedApplications(
			Blob<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> b) {

		int i = 0;
		for (;;) {
			Quad<Var, En2, Term<Ty, En1, Sym, Fk1, Att1, Var, Var>, Head<Ty, En1, Sym, Fk1, Att1, Var, Var>> p = findNested(
					Var.it, b);
		//	System.out.println("p " + p + " and b " + b); 
			if (p == null) {
				return b;
			} else {
				b = elimNested(p.first, p.second, b, p.third, p.fourth);
			}
			i++;
			if (i==128) throw new RuntimeException("No convergence after 128 iterations.  Note: this SQL generation algorithm is incomplete.");
		}

	}
@@ -166,6 +170,11 @@ public final class Query<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> implements Sem
			}
		}

		//a from v where v.f.g
		//b from u 
		//f : b->a  
		//from v v' where v' = v.f v' = g
		//
		for (Fk2 fk2 : b.fks.keySet()) {
			En2 src = b.dst.fks.get(fk2).first;
			En2 dst = b.dst.fks.get(fk2).second;
@@ -180,8 +189,10 @@ public final class Query<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> implements Sem
				g = g.map(t -> t.replace(third.convert(), Term.Gen(v)));
			}
			
			

			xfks.put(fk2,
					new Pair<Ctx<Var, Term<Void, En1, Void, Fk1, Void, Var, Void>>, Boolean>(g, b.fks.get(fk2).second));
					new Pair<>(g, b.fks.get(fk2).second));
		}

		for (En2 en : b.ens.keySet()) {