Permalink
Browse files

Clean code

  • Loading branch information...
1 parent 26ef491 commit aa499a60d7f2cbd398db12f2366aed64324810cb @ckroxigor ckroxigor committed Dec 7, 2012
Showing with 7 additions and 6 deletions.
  1. +5 −5 eval.ml
  2. +2 −1 examples.lang
View
10 eval.ml
@@ -423,17 +423,17 @@ let rec get_subquery e name col_names =
| _ -> false ) (get_rel predicate)) predicates)
else predicates in
- Printf.printf "Is recursive: %b\n" is_recursive;
+ (*Printf.printf "Is recursive: %b\n" is_recursive;*)
let sub_selects = List.map (fun predicate ->
let head_cols = get_head_attibutes predicate in
- Printf.printf "Head columns(%i): %s\n" (List.length head_cols) (String.concat "," (List.map(fun x -> param_to_string x) head_cols));
+ (*Printf.printf "Head columns(%i): %s\n" (List.length head_cols) (String.concat "," (List.map(fun x -> param_to_string x) head_cols));*)
let lrel = get_rel predicate in
- Printf.printf "Number of relations: %i\n" (List.length lrel);
+ (*Printf.printf "Number of relations: %i\n" (List.length lrel);*)
if num_queried_columns > (List.length head_cols) then
raise (QueryError ("Relation '"^name^"' has "^(string_of_int (List.length head_cols))^" columns but you queried "^(string_of_int num_queried_columns)^"."))
else
let col_names2 = (if is_recursive then prepare_variables_selection_rec_queries name col_names else col_names) in
- Printf.printf "col_names2(%i): %s\n" (List.length head_cols) (String.concat "," (List.map(fun x -> param_to_string x) col_names2));
+ (*Printf.printf "col_names2(%i): %s\n" (List.length head_cols) (String.concat "," (List.map(fun x -> param_to_string x) col_names2));*)
let sel = (prepare_variables_selection head_cols col_names2) in
(String.concat " " [
"SELECT";
@@ -446,7 +446,7 @@ let rec get_subquery e name col_names =
else let head_cols = prepare_variables_selection_rec_queries name col_names in
let where_clauses = (generate_select_restrictions head_cols col_names) in
let where_str = if List.length where_clauses > 0 then " WHERE "^(String.concat " AND " where_clauses) else "" in
- Printf.printf "Clauses over the recursive query(%i): %s\n" (List.length where_clauses) where_str;
+ (*Printf.printf "Clauses over the recursive query(%i): %s\n" (List.length where_clauses) where_str;*)
let vars_rec = (String.concat ", " (List.map(fun x -> param_to_string x) head_cols)) in
let vars = (prepare_variables_selection head_cols col_names) in
if not(List.exists(fun x-> (String.compare x name) == 0)with_keys.contents) then
View
3 examples.lang
@@ -392,6 +392,7 @@ Reach(a,b):-Connections(a,b).
Reach(a,c):-Reach(a,b) and Reach(b,c).
?-Reach(a, b).
/
+Error ==> Error: Predicate Reach appears 2 times in its recursive defition.
Connections(a,b):- Links(l,a,b).
Connections(b,a):- Links(l,a,b).
@@ -400,7 +401,7 @@ Reach(a,c):-Reach(a,b) and Connections(b,c).
Reach(a,c):-Reach(a,b) and Connections(b,c).
?-Reach(a, b).
/
-
+Error ==> Error: There are too many(2) recursive defintions for Reach.
Q(x,y,z):-Marks(x,y,z).
Q(x,y,101):-Q(x,y,75).

0 comments on commit aa499a6

Please sign in to comment.