X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmetadata%2FmetadataPp.ml;fp=helm%2Focaml%2Fmetadata%2FmetadataPp.ml;h=2ce9f22267d05548d00160e203de347eb65de3ea;hb=9cd69dd86ed337478461241d497265ccc59f819a;hp=5b8ae4e7a55c2ca88c6ef2102b0437344f2e1756;hpb=063cfc60b3ac7790b2080aa5ca7471c9e49a3b60;p=helm.git diff --git a/helm/ocaml/metadata/metadataPp.ml b/helm/ocaml/metadata/metadataPp.ml index 5b8ae4e7a..2ce9f2226 100644 --- a/helm/ocaml/metadata/metadataPp.ml +++ b/helm/ocaml/metadata/metadataPp.ml @@ -26,14 +26,34 @@ open Printf let pp_position = function - | `MainConclusion -> "MainConclusion" - | `MainHypothesis -> "MainHypothesis" + | `MainConclusion (Some d) -> sprintf "MainConclusion(%d)" d + | `MainConclusion None -> sprintf "MainConclusion" + | `MainHypothesis (Some d) -> sprintf "MainHypothesis(%d)" d + | `MainHypothesis None -> "MainHypothesis" | `InConclusion -> "InConclusion" | `InHypothesis -> "InHypothesis" | `InBody -> "InBody" +let pp_position_tag = function + | `MainConclusion _ -> "MainConclusion" + | `MainHypothesis _ -> "MainHypothesis" + | `InConclusion -> "InConclusion" + | `InHypothesis -> "InHypothesis" + | `InBody -> "InBody" + +let columns_of_position = function + | `MainConclusion (Some d) -> `String "MainConclusion", `Int d + | `MainConclusion None -> `String "MainConclusion", `Null + | `MainHypothesis (Some d) -> `String "MainHypothesis", `Int d + | `MainHypothesis None -> `String "MainHypothesis", `Null + | `InConclusion -> `String "InConclusion", `Null + | `InHypothesis -> `String "InHypothesis", `Null + | `InBody -> `String "InBody", `Null + +(* let metadata_ns = "http://www.cs.unibo.it/helm/schemas/schema-helm" let uri_of_pos pos = String.concat "#" [metadata_ns; pp_position pos] +*) let pp_sort = function | Cic.Prop -> "Prop" @@ -44,22 +64,22 @@ let pp_sort = function type t = [ `Int of int | `String of string | `Null ] let columns_of_metadata ~about metadatas = - let position p = `String (pp_position p) in let sort s = `String (pp_sort s) in let source = `String about in - let depth d = `Int d in - let depth_opt = function None -> `Null | Some d -> `Int d in let occurrence u = `String u in List.fold_left (fun (sort_cols, rel_cols, obj_cols) metadata -> match metadata with - | `Sort (s, p, d) -> - [source; position p; depth d; sort s] :: sort_cols, rel_cols, obj_cols - | `Rel (p, d) -> - sort_cols, [source; position p; depth d] :: rel_cols, obj_cols - | `Obj (o, p, d) -> + | `Sort (s, p) -> + let (p, d) = columns_of_position p in + [source; p; d; sort s] :: sort_cols, rel_cols, obj_cols + | `Rel p -> + let (p, d) = columns_of_position p in + sort_cols, [source; p; d] :: rel_cols, obj_cols + | `Obj (o, p) -> + let (p, d) = columns_of_position p in sort_cols, rel_cols, - [source; occurrence o; position p; depth_opt d] :: obj_cols) + [source; occurrence o; p; d] :: obj_cols) ([], [], []) metadatas let columns_of_ind_metadata ind_metadata =