]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/func.ml
Initial revision
[helm.git] / helm / ocaml / mathql_interpreter / func.ml
index 7f80da7f492f5d499eed9bc199493e735c60c732..8bc0c8d10d273cc8eb6d2908758406b348cd2c74 100644 (file)
 
 open Dbconn;;
 open Utility;;
-open Mathql;;
-
-(*
- * implementazione della funzione NAME
- *)
-let func_name value =
- try (
-  let i = Str.search_forward (Str.regexp "[^/]*\.") value 0 in
-   let s = Str.matched_string value in 
-    let retVal = Str.string_before s ((String.length s) - 1) in
-     retVal
- ) with
-  Not_found -> ""
-;;
-
-(*
- *
- *)
-let func_theory value =
- ""
-;;
+open Intersect;;
 
 (*
  * implementazione delle funzioni dublin core
  *)
-let func_dc (value, name) =
- let c = pgc ()
- and p = helm_property_id name in
-  pgresult_to_string (c#exec ("select t" ^ p ^ ".att1 from t" ^ p ^ " where " ^ "t" ^ p ^ ".att0 = '" ^ value ^ "'"))
-;;
-
-(*
- *
- *)
-let apply_func f value =
- match f with
-    MQName         -> func_name value
- |  MQTheory       -> func_theory value
- |  MQTitle        -> func_dc (value, "title")
- |  MQContributor  -> func_dc (value, "contributor")
- |  MQCreator      -> func_dc (value, "creator")
- |  MQPublisher    -> func_dc (value, "publisher")
- |  MQSubject      -> func_dc (value, "subject")
- |  MQDescription  -> func_dc (value, "description")
- |  MQDate         -> func_dc (value, "date")
- |  MQType         -> func_dc (value, "type")
- |  MQFormat       -> func_dc (value, "format")
- |  MQIdentifier   -> func_dc (value, "identifier")
- |  MQLanguage     -> func_dc (value, "language")
- |  MQRelation     -> func_dc (value, "relation")
- |  MQSource       -> func_dc (value, "source")
- |  MQCoverage     -> func_dc (value, "coverage")
- |  MQRights       -> func_dc (value, "rights")
- |  MQInstitution  -> func_dc (value, "institution")
- |  MQContact      -> func_dc (value, "contact")
- |  MQFirstVersion -> func_dc (value, "firstversion")
- |  MQModified     -> func_dc (value, "modified")
+let rec fun_ex tab = function
+    [] -> []
+  | s::tl -> let res =
+             let c = pgc () in
+            let q = ("select " ^ tab ^ ".uri from " ^ tab ^ " where " ^ tab ^ ".value = '" ^ s ^ "'") in
+                    pgresult_to_string_list (c#exec q)
+             in
+             append (res,(fun_ex tab tl))
 ;;