X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql_interpreter%2Fuse.ml;h=654c3e69b16e046a4836f2630f18dfded67589d2;hb=61872e154b77378c203e4a9b179b4067cfe7f23b;hp=ecc12f01d7a6ab4d0384638ca30fa18b6cd72b53;hpb=7f510b2df638258669d6539861a3f06ed5fab773;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/use.ml b/helm/ocaml/mathql_interpreter/use.ml index ecc12f01d..654c3e69b 100644 --- a/helm/ocaml/mathql_interpreter/use.ml +++ b/helm/ocaml/mathql_interpreter/use.ml @@ -20,7 +20,7 @@ * MA 02111-1307, USA. * * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. + * http://www.cs.unibo.it/helm/. *) (* @@ -44,43 +44,42 @@ open Dbconn;; * output: string list list; lista su cui e' stato eseguito il * comando USE/USED BY *) -let use_ex alist asvar usek = -let module S = Mathql_semantics in -let _ = print_string ("USE ") +let get_prop_id prop = + if prop="refObj" then "F" + else if prop="backPointer" then "B" + else assert false + ;; + + +let relation_ex rop path rset attl = + let usek = get_prop_id (List.hd path) in + +let _ = print_string ("RELATION "^usek) and t = Unix.time () in let result = let c = pgc () in Sort.list - (fun {S.uri = uri1} {S.uri = uri2} -> uri1 < uri2) + (fun (uri1-> uri1 < uri2) (List.fold_left - (fun parziale {S.uri = uri ; S.attributes = attributes} -> + (fun parziale (uri,aset)-> print_string uri ; - (*let r1 = helm_property_id usek - and r2 = helm_property_id "position" - and r3 = helm_property_id "occurrence" - in - let qq = "select distinct t" ^ r3 ^ ".att1, t" ^ r2 ^ ".att1 " ^ - "from t" ^ r3 ^ ", t" ^ r2 ^ ", t" ^ r1 ^ " " ^ - "where " ^ "t" ^ r1 ^ ".att0 = '" ^ (List.hd xres) ^ "' and t" ^ r1 ^ - ".att1 = t" ^ r2 ^ ".att0 and t" ^ r1 ^ ".att1 = t" ^ r3 ^ - ".att0 order by t" ^ r3 ^ ".att1 asc"*) let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ uri ^ "'")) in let qq = - "select uri, context from t" ^ tv ^ " where back_for='" ^ usek ^ + "select uri, context from t" ^ tv ^ " where prop_id='" ^ usek ^ "' order by uri asc" in let res = c#exec qq in (List.map (function - [uri;context] -> {S.uri = uri ; S.attributes = [asvar, context]} + [uri;context] -> {S.uri = uri ; S.attributes = [asvar, context] ; S.extra = ""} | _ -> assert false ) res#get_list ) @ parziale - ) [] alist + ) [] rset ) in print_string (" = " ^ string_of_int (List.length result) ^ ": ") ;