]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/metadata/metadataConstraints.ml
1) the home button of CicBrowser now works also for NG
[helm.git] / helm / software / components / metadata / metadataConstraints.ml
index e35e35894978ac33651b9f7c3e17663b1ec8a72b..3e8ac2f7250c3aa29ec3bffa835589c0711fe365 100644 (file)
@@ -28,6 +28,9 @@
 open Printf
 open MetadataTypes 
 
+let debug = false
+let debug_print s = if debug then prerr_endline (Lazy.force s)
+
 let critical_value = 7
 let just_factor = 1
 
@@ -165,7 +168,7 @@ let exec dbtype ~(dbd:HSql.dbd) ?rating (n,from,where) =
             and table0.source = hits.source order by hits.no desc")
           from where 
   in
-  (* prerr_endline query; *) 
+  (* debug_print (lazy query); *) 
   let result = HSql.exec dbtype dbd query in
   HSql.map result
     ~f:(fun row -> 
@@ -382,7 +385,7 @@ and signature_concl =
           List.flatten
            (List.map 
             (fun uri ->
-              let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in
+              let o,_ = CicEnvironment.get_obj CicUniv.oblivion_ugraph uri in
               projections_of (CicUtil.projections_of_record o uri))
             uris)
         in
@@ -652,25 +655,25 @@ let sigmatch ~(dbd:HSql.dbd) ?(facts=false) ?(where = `Conclusion)
    | Some (main, types) -> Some main,types
  in
   let constants_no = UriManagerSet.cardinal constants in
-  (* prerr_endline (("constants_no: ")^(string_of_int constants_no)); *)
+  (* debug_print (lazy (("constants_no: ")^(string_of_int constants_no))); *)
   if (constants_no > critical_value) then 
     let subsets = 
       let subsets = power_upto just_factor constants in
-      (* let _ = prerr_endline (("subsets: ")^
-        (string_of_int (List.length subsets))) in *)
+      (* let _ = debug_print (lazy (("subsets: ")^
+        (string_of_int (List.length subsets)))) in *)
       let types_no = List.length types in 
        if types_no > 0 then  
           List.map (function (n,l) -> (n+types_no,types@l)) subsets
        else subsets
     in
-    prerr_endline ("critical_value exceded..." ^ string_of_int constants_no);
+    debug_print (lazy ("critical_value exceded..." ^ string_of_int constants_no));
     let all_constants = 
      let all = match main with None -> types | Some m -> m::types in
       List.fold_right UriManagerSet.add all constants
     in
      compute_with_only ~dbd ~where main subsets all_constants
   else
-    (prerr_endline ("all subsets..." ^ string_of_int constants_no);
+    (debug_print (lazy ("all subsets..." ^ string_of_int constants_no));
     let subsets = 
       let subsets = power constants in
       let types_no = List.length types in
@@ -678,7 +681,7 @@ let sigmatch ~(dbd:HSql.dbd) ?(facts=false) ?(where = `Conclusion)
         (0,[]) :: List.map (function (n,l) -> (n+types_no,types@l)) subsets
        else subsets
     in
-       prerr_endline "fine1";
+       debug_print (lazy "fine1");
        compute_exactly ~dbd ~facts ~where main subsets)
 
   (* match query wrappers *)