Commit 3db29760 authored by Ryan Wisnesky's avatar Ryan Wisnesky
Browse files

add record linkage finder

parent bff8c851
Loading
Loading
Loading
Loading
+22 −10
Original line number Diff line number Diff line
@@ -280,8 +280,6 @@ All schemas are ``on'' a typeside, and contain entities, foreign keys, attribute
\section{{\tt empty : <typeside>}}
The empty {\tt schema} with no entities, foreign keys, or attributes, on a particular {\tt typeside}.

\section{{\tt id <schema>}}
The identity mapping on a schema.

\section{{\tt schemaOf <instance>}}
The {\tt schema} of an {\tt instance}.
@@ -327,7 +325,7 @@ Gets the schema associated with a colimit of schemas.

A schema mapping $F : S \to T$ takes entities in $S$ to entities in $T$, foreign keys in $S$ to paths in $T$, and attributes in $S$ to terms in $T$, in a way that is functorial: if $f : s \to s'$ is a symbol in $S$, then it must be that $F(f) : F(s) \to F(s')$.  In addition, if $\forall \Gamma . e = e'$ is provable in $S$, then $\forall F(\Gamma). F(e) = F(e')$ must be provable in $T$.

\section{{\tt id <schema>}}
\section{{\tt identity <schema>}}
The identity schema mapping on a particular schema.

\section{{\tt [<mapping> ; <mapping>]}}
@@ -351,7 +349,7 @@ Allowable options are {\tt timeout} and {\tt dont\_validate\_unsafe}, which disa
\chapter{Kind  {\tt query}}
A query $S \to T$ assigns to each entity $en$ in $S$ a (``frozen'') instance on $T$, which we will write as $[en]$, and to each foreign key $fk : e \to e'$ a transform $[fk] : [e'] \to [e]$ (note the reversal), and to each attribute $att : e \to \tau$ a term of type $\tau$ in context $[e]$.  

\section{{\tt id <schema>}}
\section{{\tt identity <schema>}}
The identity query on a schema.

\section{{\tt toQuery <mapping>}}
@@ -453,7 +451,7 @@ If $F : S \to T$ is a mapping and $I$ is an $S$-instance, then $\Sigma_F I$ is a
If $F : S \to T$ is a mapping and $I$ is an $S$-instance, then $\Pi_F I$ is a $T$-instance. 

\section{{\tt sigma\_chase <mapping> <instance>}}
Like {\tt sigma}, but uses an alternative chase/left-kan extension based algorithm.  See {\tt chase\_style} option.
Like {\tt sigma}, but uses an alternative chase/left-kan extension based algorithm.  See {\tt chase\_style} option.  Require the input instance to have a free type algebra.  Option {\tt timeout} is also supported.

\section{{\tt frozen <query> <target entity>}}
If $Q : S \to T$ is a query and $t$ is a $T$-entity, then $frozen \ Q \ t$ is the ``frozen'' or ``canonical'' $S$-instance for $t$ in $Q$. 
@@ -498,6 +496,20 @@ Expects a list of (single) SQL commands inside a section. Each SQL query should
\section{{\tt quotient\_csv <instance>}}
Expects a list of filenames inside a section.  Each file should have 2 columns, where each column has a generator from the input instance.  The union of these files defines an equivalence relation and this expression quotients the input instance by this relation. 

\section{{\tt quotient\_query <instance>}}

Expects a list of queries, on per entity, e.g.,
\begin{verbatim}
entity E -> {from x:X y:Y where x.a = y.b}
entity F -> {from x:X y:Y}
\end{verbatim}
each query should have no attributes and no foreign keys.  The resulting matched pairs $(x,y)$ are treated
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}.  

\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}.
@@ -550,9 +562,9 @@ Allowable options are {\tt timeout}, {\tt prover} and related options, {\tt requ
\subsection{{\tt equations}}
A list of ground (non quantified) equations to quotient by.  Allowable options are {\tt timeout}, {\tt prover} and related options, and {\tt require\_consistency}.

\section{{\tt chase <constraints> <instance> [number]}}
\section{{\tt chase <constraints> <instance>}}

Chases the input instance with the input constraints up to the given maximum number of iterations.  If the chase succeeds, the result instance will satisfy the constraints.  The options will be used for the construction of the intermediate instances during the chase process.
If the chase succeeds, the result instance will satisfy the constraints.  The options will be used for the construction of the intermediate instances during the chase process.

\subsection{{\tt options}}
Allowable options are the same as for an instance.
@@ -569,7 +581,7 @@ A {\tt ctx(<generator> | <labelled null> -> integer)}.
Allowable options are the same for literal instances, and {\tt random\_seed}.

\chapter{Kind {\tt transform}}
\section{{\tt id <instance>}}
\section{{\tt identity <instance>}}
%todo
The identity transform on an instance.
\section{{\tt [<transform> ; <transform>]}}
@@ -681,7 +693,7 @@ Conservatively checks that an instance is consistent (e.g., does not prove $1=2$

\section{{\tt export\_csv\_instance <instance> [directory]}} 

Exports an instance as CSV.  The directory name will contain one file named $en.csv$ per entity $en$.  The file for $en$ will be a CSV file with a header; the fields of the header will be an ID column name (specified using options), as well as any attributes and foreign keys whose domain is $en$.   AQL rows that are not constants will be exported as nulls.  
Exports an instance as CSV.  The directory name will contain one file named $en.csv$ per entity $en$.  The file for $en$ will be a CSV file with a header; the fields of the header will be an ID column name (specified using options), as well as any attributes and foreign keys whose domain is $en$.   AQL values that are not constants will be exported as nulls.  

\subsection{{\tt options}}
Allowed are {\tt timeout}, {\tt always\_reload}, {\tt csv} related options, and {\tt id\_column\_name}, and {\it start\_ids\_at}.
@@ -790,7 +802,7 @@ Used with {\tt import\_jdbc\_all} to import no data (only schema).
When disabled, relaxes AQL's nominal typing discipline for colimit instances.

\section{{\tt allow\_java\_eqs\_unsafe = boolean}}
When enabled, allows arbitrary equations involving java typeside symbols.
When enabled, allows arbitrary equations involving java typeside symbols.  Induces undefined behavior.

\section{{\tt dont\_validate\_unsafe = boolean}}
When enabled, mappings and transforms and queries are not checked to be equality-preserving.  For a query, when true it also disables decision procedure construction for sub-queries.
+1 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ instance i17 = pi (identity s2) (empty : s2) { options prover = completion }
//quotient_jdbc -- see JDBC example
//quotient_csv -- see JDBC example (yes, JDBC example)
//import_csv -- See FinanceColim1 example
//quotient_query - see Link example

instance i13 = literal : s3 {
	generators 
+26 −0
Original line number Diff line number Diff line
//Record Linkage

schema S = literal : sql {
	entities
		Element
	attributes
		name1 name2 : Element -> String	
		num1 num2 : Element -> String
}

instance I = literal : S {
	generators
		e1 e2 e3 x y z d : Element
	equations
		e1.name1 = "H"   e1.num1 = "1"
		e2.name1 = "He"  e2.num1 = "2"
		e3.name1 = "Li"  e3.num1 = "3"
		x.name2 = "Hydrogen"  x.num2 = "1"
		y.name2 = "Helium"    y.num2 = "2"
		z.name2 = "Lithium"   z.num2 = "3"
		d.name2 = "Beryllium" d.num2 = "4"	
}

instance J = quotient_query I {
	entity Element -> {from a:Element b:Element where a.num1 = b.num2}
}
+5 −5
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public final class AqlOptions {
		query_compose_use_incomplete,
		import_as_theory,
		import_null_on_err_unsafe,
		import_joined,
		//import_joined,
		map_nulls_arbitrarily_unsafe,
		jdbc_default_class,
		jdbc_default_string,
@@ -234,8 +234,8 @@ public final class AqlOptions {
			return false;
		case map_nulls_arbitrarily_unsafe:
			return false;
		case import_joined:
			return true;
		//case import_joined:
		//	return true;
		case coproduct_allow_type_collisions_unsafe:
			return false;
		case coproduct_allow_entity_collisions_unsafe:
@@ -412,8 +412,8 @@ public final class AqlOptions {
			return op.getBoolean(map);
		case map_nulls_arbitrarily_unsafe:
			return op.getBoolean(map);
		case import_joined:
			return op.getBoolean(map);
		//case import_joined:
			//return op.getBoolean(map);
		case coproduct_allow_type_collisions_unsafe:
			return op.getBoolean(map);
		case coproduct_allow_entity_collisions_unsafe:
+5 −0
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@ 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);
		return (Schema<Ty, En, Sym, Void, Void>) x;
	}
	
	@Override
	public int size() {
		return ens.size() + atts.size() + fks.size() + eqs.size();
Loading