Phase 2 Notes
-------------
Note: Added "parent" pointer to DRCNode in Phase 2.
Phase 1 code does not use this pointer (needed in Demorgan and
double not methods; possibly others).
compressTree
removeDoubleNots
applyDeMorgan
Vector freeVariables;
HashMap freeVariableType;
HashMap isFreeVariableLimited
predicate node
each variable argument is a FREE variable (is LIMITED as well)
and its DATA TYPE is determined by the database schema
comparison node
each variable argument is a FREE variable;
DATA TYPE of the variable is "UNKNOWN" if both arguments are variables;
otherwise the constant argument will dictate the datatype of the other variable
argument; we will disallow both arguments being constants.
if comparison is "=" and one of the arguments is a constant (num or str)
then the other argument is limited; otherwise all variable arguments are
not limited.
not node
each free variable in the child node is a free variable, none of which
are limited. data types are the same as in the child node.
exists node
each free variable in the child node which is not in the exists varList
is a free variable; data types are the same as in the child node;
the limitedness is the same as in the child node.
and node
free variables are the union of the free variables from the children.
for multiple occurrences of free variables across children, types
must match - otherwise report error.
limitedness is true if at least one occurrence is limited.
or node
free variables are the union of the free variables from the children.
for multiple occurrences of free variables across children, types
must match - otherwise report error.
limitedness is true if at ALL occurrences are limited.
query node
each free variable in the child node
is a free variable; data types are the same as in the child node;
the limitedness is the same as in the child node.
Semantic Checks
Make sure all predicate names used in query correspond to database tables.
Also make sure that arities of predicate names match number of columns in
database table.
Type check all variables at each node (types are obtained from constants in
query as well as data types in database.
Safety Check
query variables on lhs of | must match free variables on rhs.
free variables in all disjuncts of or-nodes must match.
All free variables in and-nodes must be limited.
parent of not-node MUST be and-node
parent of comparison node MUST be and-node.
Misc
Transform not-comparison sequence
Disallow constant COMPARISON constant