]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/metadata/metadataPp.ml
ocaml 3.09 transition
[helm.git] / helm / ocaml / metadata / metadataPp.ml
index 63a1a0955a55b8ee1f5189aaa3b58f3672c1e06d..acf425ce130df9f5af422cbc30ff6ea9788b23b6 100644 (file)
@@ -27,10 +27,18 @@ open Printf
 
 open MetadataTypes
 
+let pp_relation r = 
+  match r with
+  | Eq i -> sprintf "= %d" i
+  | Ge i -> sprintf ">= %d" i
+  | Gt i -> sprintf "> %d" i
+  | Le i -> sprintf "<= %d" i
+  | Lt i -> sprintf "< %d" i
+
 let pp_position = function
-  | `MainConclusion (Some d) -> sprintf "MainConclusion(%d)" d
+  | `MainConclusion (Some d) -> sprintf "MainConclusion(%s)" (pp_relation d)
   | `MainConclusion None -> sprintf "MainConclusion"
-  | `MainHypothesis (Some d) -> sprintf "MainHypothesis(%d)" d
+  | `MainHypothesis (Some d) -> sprintf "MainHypothesis(%s)" (pp_relation d)
   | `MainHypothesis None -> "MainHypothesis"
   | `InConclusion -> "InConclusion"
   | `InHypothesis -> "InHypothesis"
@@ -43,14 +51,16 @@ let pp_position_tag = function
   | `InHypothesis -> inhyp_pos
   | `InBody -> inbody_pos
 
-let columns_of_position = function
-  | `MainConclusion (Some d) -> `String mainconcl_pos, `Int d
+let columns_of_position pos =
+  match pos with
+  | `MainConclusion (Some (Eq d)) -> `String mainconcl_pos, `Int d
   | `MainConclusion None -> `String mainconcl_pos, `Null
-  | `MainHypothesis (Some d) -> `String mainhyp_pos, `Int d
+  | `MainHypothesis (Some (Eq d)) -> `String mainhyp_pos, `Int d
   | `MainHypothesis None -> `String mainhyp_pos, `Null
   | `InConclusion -> `String inconcl_pos, `Null
   | `InHypothesis -> `String inhyp_pos, `Null
   | `InBody -> `String inbody_pos, `Null
+  | _ -> assert false 
 
 (*
 let metadata_ns = "http://www.cs.unibo.it/helm/schemas/schema-helm"
@@ -61,16 +71,16 @@ type t = [ `Int of int | `String of string | `Null ]
 
 let columns_of_metadata_aux ~about metadata =
   let sort s = `String (CicPp.ppsort s) in
-  let source = `String about in
-  let occurrence u = `String u in
+  let source = `String (UriManager.string_of_uri about) in
+  let occurrence u = `String (UriManager.string_of_uri u) in
   List.fold_left
     (fun (sort_cols, rel_cols, obj_cols) metadata ->
       match metadata with
       | `Sort (s, p) ->
-          let (p, d) = columns_of_position p in
+          let (p, d) = columns_of_position (p :> position) in
           [source; p; d; sort s] :: sort_cols, rel_cols, obj_cols
       | `Rel p ->
-          let (p, d) = columns_of_position p in
+          let (p, d) = columns_of_position (p :> position) in
           sort_cols, [source; p; d] :: rel_cols, obj_cols
       | `Obj (o, p) ->
           let (p, d) = columns_of_position p in
@@ -92,7 +102,7 @@ let pp_constr =
          (CicPp.ppsort sort) (String.concat ";" (List.map pp_position p))
     | `Rel p -> sprintf "Rel [%s]" (String.concat ";" (List.map pp_position p))
     | `Obj (uri, p) -> sprintf "Obj %s; [%s]" 
-       uri (String.concat ";" (List.map pp_position p))
+       (UriManager.string_of_uri uri) (String.concat ";" (List.map pp_position p))
  
 (*
 let pp_columns ?(sep = "\n") (sort_cols, rel_cols, obj_cols) =
@@ -102,3 +112,4 @@ let pp_columns ?(sep = "\n") (sort_cols, rel_cols, obj_cols) =
     [ "Obj" ] @ List.map Dbi.sdebug (obj_cols :> Dbi.sql_t list list))
 *)
 
+