-let rec exec_query (conn:Mysql.dbd) uris k =
+let rec exec_query (conn:Mysql.dbd) (uris,main) k =
let add_must (n,from,where) uri =
let refObjn = "refObj" ^ (string_of_int n) in
let new_must =
let (_,from,where) =
List.fold_left add_must (0,[],[]) uris in
let from,where =
- "no_concl_hyp"::from,
- ("no=" ^ (string_of_int k))::
- ("no_concl_hyp.source = refObj0.source")::where
+ ["no_concl_hyp";"refObj as main"]@from,
+ ["no=" ^ (string_of_int k);
+ "no_concl_hyp.source = refObj0.source";
+ "main.source = refObj0.source";
+ "main.h_occurrence = '" ^ main ^ "'";
+ "main.h_position = " ^ main_conclusion]@where
in
let from = String.concat "," from in
let where = String.concat " and " where in
let query = "select distinct(refObj0.source) from " ^ from ^ " where " ^ where in
- (* prerr_endline query;*)
+ (*prerr_endline query;*)
Mysql.exec conn query
;;
;;
-let filter_uris (conn:Mysql.dbd) const uris =
+let filter_uris (conn:Mysql.dbd) const uris main =
let subsets_of_consts =
setset_to_listlist (powerset const) in
+ let ex u =
+ if u = main then true
+ else false
+ in
+ let subsets_of_consts =
+ List.filter
+ (fun (_,b) -> (List.exists ex b))
+ subsets_of_consts in
let uris_of_const =
List.concat
(List.map
(fun (m,s) ->
(let res =
- exec_query conn s m in
+ exec_query conn (s,main) m in
let f a =
match (Array.to_list a) with
[Some uri] -> uri
*)
(* concl_cost are the costants in the conclusion of the proof
while hyp_const are the constants in the hypothesis *)
- let concl_const = NewConstraints.constants_concl ty in
+ let (main_concl,concl_const) = NewConstraints.mainandcons ty in
prerr_endline ("Ne sono rimasti 1 " ^ string_of_int (List.length uris));
let hyp t set =
match t with
if (List.length uris < (Filter_auto.power 2 (List.length (NewConstraints.StringSet.elements all_const))))
then
(prerr_endline("metodo vecchio");List.filter (Filter_auto.filter_new_constants conn all_const) uris)
- else Filter_auto.filter_uris conn all_const uris in
+ else Filter_auto.filter_uris conn all_const uris main_concl in
(*
let uris =
(* ristretto all cache *)