- let preamble = "
- digraph pippo {
- node [fontsize=9, width=.4, height=.4];
- edge [fontsize=10];
- \n"
- in
- let conclusion = " } \n" in
- let data = List.fold_left
- (fun acc (src,tgt,c) ->
- acc ^ CoercDb.name_of_carr src ^ " -> " ^
- CoercDb.name_of_carr tgt ^ "[label=\"" ^ UriManager.name_of_uri c ^
- "\"];\n") "" l
- in
- preamble ^ data ^ conclusion
-
+ let pp_description carr =
+ match CoercDb.uri_of_carr carr with
+ | None -> ()
+ | Some uri ->
+ Pp.node (CoercDb.name_of_carr carr)
+ ~attrs:["href", UriManager.string_of_uri uri] fmt in
+ List.iter
+ (fun (src, tgt, cl) ->
+ let src_name = CoercDb.name_of_carr src in
+ let tgt_name = CoercDb.name_of_carr tgt in
+ pp_description src;
+ pp_description tgt;
+ List.iter
+ (fun c ->
+ Pp.edge src_name tgt_name
+ ~attrs:[ "label", UriManager.name_of_uri c;
+ "href", UriManager.string_of_uri c ]
+ fmt)
+ cl)
+ l;
+ Pp.trailer fmt;
+ Buffer.contents buf
+