+let add_coercion (src,tgt,u) =
+ let f s t = eq_carr s src && eq_carr t tgt in
+ let where = List.filter (fun (s,t,_) -> f s t) !db in
+ let rest = List.filter (fun (s,t,_) -> not (f s t)) !db in
+ match where with
+ | [] -> db := (src,tgt,[u,1]) :: !db
+ | (src,tgt,l)::tl ->
+ assert (tl = []); (* not sure, this may be a feature *)
+ if List.exists (fun (x,_) -> UriManager.eq u x) l then
+ let l' = List.map
+ (fun (x,n) -> if UriManager.eq u x then (x,n+1) else (x,n))
+ l
+ in
+ db := (src,tgt,l')::tl @ rest
+ else
+ db := (src,tgt,(u,1)::l)::tl @ rest
+
+;;
+