(* DEBUGGING *)
-let debug_print =
- let debug = true in
- fun s -> prerr_endline (sprintf "DEBUG: %s" s)
-;;
+module MQICallbacks =
+ struct
+ let log s = prerr_string s
+ end
+
+module MQI = MQueryInterpreter.Make(MQICallbacks)
(* GLOBAL CONSTANTS *)
+let mqi_options = "" (* default MathQL interpreter options *)
+
let xlinkns = Gdome.domString "http://www.w3.org/1999/xlink";;
let htmlheader =
Not_found -> "/public/currentprooftype"
;;
-let postgresqlconnectionstring =
- try
- Sys.getenv "POSTGRESQL_CONNECTION_STRING"
- with
- Not_found -> "host=mowgli.cs.unibo.it dbname=helm_mowgli_new_schema user=helm"
-;;
-
(* GLOBAL REFERENCES (USED BY CALLBACKS) *)
let htmlheader_and_content = ref htmlheader;;
None -> ()
| Some q ->
let results =
- Mqint.execute (MQueryUtil.query_of_text (Lexing.from_string q))
+ MQI.execute mqi_options (MQueryUtil.query_of_text (Lexing.from_string q))
in
show_query_results results
with
;;
let main () =
- if !usedb then
- begin
- Mqint.set_database Mqint.postgres_db ;
- Mqint.init postgresqlconnectionstring ;
- end ;
+ if !usedb then ignore (MQI.init mqi_options) ;
ignore (GtkMain.Main.init ()) ;
initialize_everything () ;
- if !usedb then Mqint.close ();
- prerr_endline "FOO";
+ if !usedb then MQI.close mqi_options;
Hbugs.quit ()
;;
MODULES = xml urimanager getter pxp cic cic_annotations cic_annotations_cache \
cic_cache cic_proof_checking cic_textual_parser \
tex_cic_textual_parser cic_unification mathql mathql_interpreter \
- mquery_generator tactics
+ mquery_generator mathql_test tactics
OCAMLFIND_DEST_DIR = @OCAMLFIND_DEST_DIR@
OCAMLFIND_META_DIR = @OCAMLFIND_META_DIR@
(* *)
(******************************************************************************)
-(* Query issuing functions **************************************************)
+module MQICallbacks =
+ struct
+ let log s = prerr_string s
+ end
+module MQI = MQueryInterpreter.Make(MQICallbacks)
+(* Query issuing functions **************************************************)
type uri = string
type position = string
flush och
in
let execute q =
- let r = Mqint.execute q in
+ let r = MQI.execute "" q in
if ! log_file <> "" then log q r;
info := string_of_int ! query_num :: ! info;
incr query_num;
(** accepted HTTP servers for ask_uwobo method forwarding *)
let valid_servers = [ "mowgli.cs.unibo.it:58080" ; "mowgli.cs.unibo.it" ; "localhost:58080" ] ;;
-open Printf;;
+module MQICallbacks =
+ struct
+ let log s = debug_print s
+ end
-let postgresConnectionString =
- try
- Sys.getenv "POSTGRESQL_CONNECTION_STRING"
- with
- Not_found -> "host=mowgli.cs.unibo.it dbname=helm_mowgli_new_schema user=helm"
-;;
+module MQI = MQueryInterpreter.Make(MQICallbacks)
+
+let mqi_options = "" (* default MathQL interpreter options *)
+
+open Printf;;
let daemon_name = "Search Engine";;
let default_port = 58085;;
try
debug_print (sprintf "Received request: %s" req#path);
if req#path <> "/getpage" then
- Mqint.init postgresConnectionString;
+ ignore (MQI.init mqi_options);
(match req#path with
| "/execute" ->
let query_string = req#param "query" in
| invalid_request ->
Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan);
if req#path <> "/getpage" then
- Mqint.close ();
+ MQI.close mqi_options;
debug_print (sprintf "%s done!" req#path)
with
| Chat_unfinished -> prerr_endline "Chat unfinished, Try again!"
printf "HTML directory is %s\n" pages_dir;
flush stdout;
Unix.putenv "http_proxy" "";
-Mqint.set_database Mqint.postgres_db;
Http_daemon.start' ~port callback;
printf "%s is terminating, bye!\n" daemon_name