]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/metadata/test.ml
added helm-metadata module
[helm.git] / helm / ocaml / metadata / test.ml
diff --git a/helm/ocaml/metadata/test.ml b/helm/ocaml/metadata/test.ml
new file mode 100644 (file)
index 0000000..27be47c
--- /dev/null
@@ -0,0 +1,23 @@
+
+module DB = Dbi_mysql
+
+let _ = Helm_registry.set "getter.mode" "remote";
+let _ = Helm_registry.set "getter.url" "http://mowgli.cs.unibo.it:58081/" in
+let dbh = new DB.connection ~host:"mowgli.cs.unibo.it" ~user:"helm" "matita" in
+let owner =
+  try
+    Sys.argv.(2)
+  with Invalid_argument _ -> "matita_test"
+in
+if Sys.argv.(1) = "clean" then
+  MetadataDb.clean ~dbh ~owner
+else
+  let uri_str = Sys.argv.(1) in
+  let uri = UriManager.uri_of_string uri_str in
+  match CicEnvironment.get_obj uri with
+  | Cic.Constant (_, body, ty, _) ->
+      MetadataDb.index_constant ~body ~ty ~uri ~owner ~dbh
+  | Cic.InductiveDefinition (types, _, _) ->
+      MetadataDb.index_inductive_def ~dbh ~owner ~uri ~types
+  | _ -> assert false
+