- let insert_obj =
- dbh#prepare (sprintf "INSERT INTO %s VALUES (\"?\",\"?\",\"?\",?)" obj_tbl)
- in
- (insert_owner, insert_sort, insert_rel, insert_obj)
+ if sort_tuples <> [] then
+ begin
+ let query_sort =
+ sprintf "INSERT %s VALUES %s;" (sort_tbl ()) (String.concat "," sort_tuples)
+ in
+ ignore (HMysql.exec dbd query_sort)
+ end;
+ if rel_tuples <> [] then
+ begin
+ let query_rel =
+ sprintf "INSERT %s VALUES %s;" (rel_tbl ()) (String.concat "," rel_tuples)
+ in
+ ignore (HMysql.exec dbd query_rel)
+ end;
+ if obj_tuples <> [] then
+ begin
+ let query_obj =
+ sprintf "INSERT %s VALUES %s;" (obj_tbl ()) (String.concat "," obj_tuples)
+ in
+ ignore (HMysql.exec dbd query_obj)
+ end
+
+
+let count_distinct position l =
+ MetadataConstraints.UriManagerSet.cardinal
+ (List.fold_left (fun acc d ->
+ match position with
+ | `Conclusion ->
+ (match d with
+ | `Obj (name,`InConclusion)
+ | `Obj (name,`MainConclusion _ ) ->
+ MetadataConstraints.UriManagerSet.add name acc
+ | _ -> acc)
+ | `Hypothesis ->
+ (match d with
+ | `Obj (name,`InHypothesis)
+ | `Obj (name,`MainHypothesis _) ->
+ MetadataConstraints.UriManagerSet.add name acc
+ | _ -> acc)
+ | `Statement ->
+ (match d with
+ | `Obj (name,`InBody) -> acc
+ | `Obj (name,_) -> MetadataConstraints.UriManagerSet.add name acc
+ | _ -> acc)
+ ) MetadataConstraints.UriManagerSet.empty l)