]> matita.cs.unibo.it Git - helm.git/commitdiff
Relation ok!
authornatile <??>
Tue, 8 Oct 2002 10:07:45 +0000 (10:07 +0000)
committernatile <??>
Tue, 8 Oct 2002 10:07:45 +0000 (10:07 +0000)
helm/ocaml/mathql_interpreter/.depend
helm/ocaml/mathql_interpreter/relation.ml

index 2a532e6dd7f6d87352009d255bfb71984dcfb3a3..8106a0f5e6d53359a3ecdeef6ad89af05929093a 100644 (file)
@@ -4,8 +4,8 @@ utility.cmo: dbconn.cmi utility.cmi
 utility.cmx: dbconn.cmx utility.cmi 
 union.cmo: union.cmi 
 union.cmx: union.cmi 
-relation.cmo: dbconn.cmi utility.cmi relation.cmi 
-relation.cmx: dbconn.cmx utility.cmx relation.cmi 
+relation.cmo: dbconn.cmi union.cmi utility.cmi relation.cmi 
+relation.cmx: dbconn.cmx union.cmx utility.cmx relation.cmi 
 diff.cmo: diff.cmi 
 diff.cmx: diff.cmi 
 meet.cmo: meet.cmi 
index 7e35aad7583eb77420898be280fbae6fd9d1d965..2fbb24bf80f421b4ba1bf8f83f635816da2efef4 100644 (file)
@@ -23,7 +23,7 @@
  * http://www.cs.unibo.it/helm/.
  *)
 
-
+open Union;;
 open Dbconn;;
 open Utility;;
 (*
@@ -53,23 +53,29 @@ let _ = print_string ("RELATION "^usek)
 and t = Unix.time () in
 let result =
  let c = pgc () in
- List.sort
-compare      
+
+let rset_list =  (* lista di singoletti:resource_set di un elemento *)
 (List.fold_left (fun acc (uri,l) ->
                          let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ uri ^ "'"))
                          in
                           let qq = "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] -> (uri,[[(vvar,[context])]])
+                             (function [uri;context] -> [(uri,[[(vvar,[context])]])]
                                        | _ -> assert false ) 
                              res#get_list) @ acc
-           )                 
+                                   )                 
             [] rset                          
 )
-(*Come faccio a togliere i duplicati????*)       
-
+in                    
+                            let rec edup = function
+                               [] -> []
+                             | rs1::tl -> union_ex rs1 (edup tl) 
+                             in 
+                             edup rset_list 
+                              
 
 in
 print_string (" = " ^ string_of_int (List.length result) ^ ": ") ;