let _ =
let configuration_file = "/projects/helm/etc/searchEngine.conf.xml" in
Helm_registry.load_from configuration_file
+let max_results_no =
+ Helm_registry.get_opt_default Helm_registry.get_int 10
+ "search_engine.max_results_no"
let port = Helm_registry.get_int "search_engine.port"
(** pretty print a MathQL query result to an HELM theory file *)
let theory_of_result req result =
let results_no = List.length result in
+ let query_kind = query_of_req req in
+ let template query_kind summary results =
+ sprintf
+ "<div class='resultsbar'>
+ <table width='100%%'>
+ <tr>
+ <td class='left'><b class='query_kind'>%s</b></td>
+ <td class='right'>%s</td>
+ </tr>
+ </table>
+ </div>
+ <br />
+ <div>
+ %s
+ </div>"
+ query_kind summary results
+ in
if results_no > 0 then
- let mode = if results_no > 10 then "linkonly" else "typeonly" in
+ let mode = if results_no > max_results_no then "linkonly" else "typeonly" in
let results =
let idx = ref (results_no + 1) in
List.fold_right
!idx uri mode i)
result ""
in
- sprintf
- "<div class='resultsbar'>
- <table width='100%%'>
- <tr>
- <td class='left'><b class='query_kind'>%s</b></td>
- <td class='right'><b>%d</b> result%s found</td>
- </tr>
- </table>
- </div>
- <br />
- <div>
- <table xmlns:ht=\"http://www.cs.unibo.it/helm/namespaces/helm-theory\">%s</table>
- </div>"
- (query_of_req req)
- results_no (if results_no > 1 then "s" else "") results
+ template query_kind
+ (sprintf "<b>%d</b> result%s found"
+ results_no (if results_no > 1 then "s" else ""))
+ (sprintf
+ "<table xmlns:ht=\"http://www.cs.unibo.it/helm/namespaces/helm-theory\">
+ %s
+ </table>"
+ results)
else
- "<div class='resultsbar'>no results found</div>"
+ template query_kind "no results found" ""
let pp_result req result =
sprintf
let key' = (Pcre.extract ~pat:"param\\.(.*)" key).(1) in
Pcre.regexp ("@" ^ key' ^ "@"), value)
(List.filter
- (fun (key,_) as p-> Pcre.pmatch ~pat:"^param\\." key)
+ (fun ((key,_) as p) -> Pcre.pmatch ~pat:"^param\\." key)
req#params)) @
(if req#param "advanced" = "no" then
[ simple_checked_RE, "checked='true'";
| MQIConn.MySQL_C conn -> conn
| _ -> assert false
in
+(*
+ (* ZACK: constraints sulla conclusione, no apply *)
let results = List.map snd (Match_concl.cmatch dbd term') in
+*)
+ (* ZACK: constraints sulle costanti + apply *)
+ let status = ProofEngineTypes.initial_status term' [] in
+ let intros = PrimitiveTactics.intros_tac () in
+ let subgoals = ProofEngineTypes.apply_tactic intros status in
+ let results =
+ match subgoals with
+ | proof, [goal] ->
+ let (uri,metasenv,bo,ty) = proof in
+ TacticChaser.searchTheorems_for_hint mqi_handle (proof, goal)
+ | _ -> assert false
+ in
send_results (`Results results) ~id_to_uris:id_to_uris' req outchan
else
let must'', only' =
Pcre.regexp ("@" ^ key' ^ "@"), value
)
(List.filter
- (fun (key,_) as p-> Pcre.pmatch ~pat:"^param\\." key)
+ (fun ((key,_) as p) -> Pcre.pmatch ~pat:"^param\\." key)
req#params)
))
line) ^