Commit ec0aeeb1 authored by Ryan Wisnesky's avatar Ryan Wisnesky
Browse files

tweak to quotients

parent 3db29760
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -510,6 +510,9 @@ as equations for performing the quotient.
\subsection{{\tt options}}
Allowed are {\tt timeout}, {\tt prover} and related options, {\tt always\_reload}, and {\tt require\_consistency}.  

By default uses a chase-based algorithm; to disabled, set {\tt quotient\_use\_chase = false}


\section{{\tt import\_jdbc\_all [jdbcclass] [jdbcuri]}}

Imports a SQL database onto an autogenerated AQL schema.  The AQL schema will have one attribute per column in the input DB, and one foreign key per foreign key in the input DB, and equations capturing the input DB's foreign key constraints.  The type side will have a single type, ``dom''.  When the [jdbcclass] and [jdbcuri] are the empty string, their values will be determined by the {\tt jdbc\_default\_class} and {\tt jdbc\_default\_string} options.  See also option {\tt import\_col\_seperator}.
@@ -1086,6 +1089,10 @@ Defines the SQL quasi-type to be used with CONVERT statements when emitting SQL

Either {\tt parallel} (faster, but uses more space) or {\tt leftkan} (slower, but uses less space).  Note that parallel will not be compatible with sigma operations such as sigma on transforms, the co-unit, etc.  Parallel is recommended only when data volume is too large for the other algorithms.

\subsection{{\tt quotient\_use\_chase}}

In doing instance quotients, determines whether or not to use chase-based algorithm.

\end{document}


+7 −0
Original line number Diff line number Diff line
@@ -24,3 +24,10 @@ instance I = literal : S {
instance J = quotient_query I {
	entity Element -> {from a:Element b:Element where a.num1 = b.num2}
}


instance J2 = quotient_query I {
	entity Element -> {from a:Element b:Element where a.num1 = b.num2}
	options
	quotient_use_chase = false
}
+5 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public final class AqlOptions {
	//TODO: aql each typeside/instance/etc should make sure only appropriate options are given to it

	public enum AqlOption {
		quotient_use_chase,
		chase_style,
		maedmax_allow_empty_sorts_unsafe,
		maedmax_path,
@@ -203,7 +204,8 @@ public final class AqlOptions {
	//@SuppressWarnings("static-method")
	private static Object getDefault(AqlOption option) {
		switch (option) {
		
		case quotient_use_chase:
			return true;
		case jdbc_no_distinct_unsafe:
			return false;
		case jdbc_export_truncate_after:
@@ -382,6 +384,8 @@ public final class AqlOptions {

	private static Object getFromMap(Map<String, String> map, Collage<Ty, En, Sym, Fk, Att, Gen, Sk> col, AqlOption op) {
		switch (op) {
		case quotient_use_chase:
			return op.getBoolean(map);
		case jdbc_query_export_convert_type:
			return op.getString(map);
		case jdbc_no_distinct_unsafe:
+25 −3
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiFunction;
@@ -339,10 +340,14 @@ public class Chase<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2, Gen, Sk, X, Y> {

	private Instance<Ty, En1, Sym, Fk1, Att1, Gen, Sk, X, Y> I;

	private Map<En1, Set<Pair<X,X>>> extra;
	
	public Chase(Mapping<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2> F,
			Instance<Ty, En1, Sym, Fk1, Att1, Gen, Sk, X, Y> I) {
			Instance<Ty, En1, Sym, Fk1, Att1, Gen, Sk, X, Y> I,
			Map<En1, Set<Pair<X,X>>> extra) {
		this.F = F;
		this.I = I;
		this.extra = extra;

		int i = 0;
		T = new Content(I);
@@ -385,6 +390,8 @@ public class Chase<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2, Gen, Sk, X, Y> {

		doEqs(toAdd, ufs, ufs2, changed);
		
		doExtra(toAdd, ufs, changed);

		T.addAll(toAdd);
		// System.out.println("E " + changed[0]);

@@ -573,6 +580,21 @@ public class Chase<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2, Gen, Sk, X, Y> {
		return Util.anomaly();
	}

	public void doExtra(Content toAdd, Ctx<En2, UnionFind<Lineage<Void, En2, Void, Fk2, Void, Gen, Void>>> ufs,
			Boolean[] changed) {
		for (En1 en1 : extra.keySet()) {
			for (Pair<X, X> x : extra.get(en1)) {
				Lineage<Void, En2, Void, Fk2, Void, Gen, Void> a = T.us.get(en1).get(x.first);
				Lineage<Void, En2, Void, Fk2, Void, Gen, Void> b = T.us.get(en1).get(x.second);
				En2 en2 = F.ens.get(en1);
				if (!a.equals(b)) {
					changed[0] = true;
					ufs.get(en2).union(a, b);
				}
			}
		}
		
	}
	public void targetEqs(Content toAdd, Ctx<En2, UnionFind<Lineage<Void, En2, Void, Fk2, Void, Gen, Void>>> ufs,
			Boolean[] changed) {
		for (Triple<Pair<Var, En2>, Term<Ty, En2, Sym, Fk2, Att2, Void, Void>, Term<Ty, En2, Sym, Fk2, Att2, Void, Void>> eq : F.dst.eqs) {
@@ -722,7 +744,7 @@ public class Chase<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2, Gen, Sk, X, Y> {

	public void moveObjects(Content toAdd, Boolean[] changed) {
		// a : a -> F(a)
		System.out.println("started");
		//System.out.println("started");
		for (En1 a : F.src.ens) {
			// T_v(x) -> Ey. T_a(x,y)
			// this is the 'loading' step in the Content constructor
@@ -739,7 +761,7 @@ public class Chase<Ty, En1, Sym, Fk1, Att1, En2, Fk2, Att2, Gen, Sk, X, Y> {
				}
			}
		}
		System.out.println("started2");
		//System.out.println("started2");

		for (Ty a : F.src.typeSide.tys) {
			// T_v(x) -> Ey. T_a(x,y) // this is the 'loading' step in the Content
+2 −2
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ import catdata.graph.DAG;

public final class Schema<Ty, En, Sym, Fk, Att> implements Semantics {

	public Schema<Ty, En, Sym, Void, Void> discretize() {
		Schema<Ty, En, Sym, Fk, Att> x = new Schema<Ty, En, Sym, Fk, Att>(typeSide, ens, new HashMap<>(), new HashMap<>(), new HashSet<>(), dp, false);
	public Schema<Ty, En, Sym, Void, Void> discretize(Set<En> ensX) {
		Schema<Ty, En, Sym, Fk, Att> x = new Schema<Ty, En, Sym, Fk, Att>(typeSide, ensX, new HashMap<>(), new HashMap<>(), new HashSet<>(), dp, false);
		return (Schema<Ty, En, Sym, Void, Void>) x;
	}
	
Loading