]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/metadata/postgresql_V7_mowgli/inserisci.pl
First version of the stuff to create the DB.
[helm.git] / helm / metadata / postgresql_V7_mowgli / inserisci.pl
diff --git a/helm/metadata/postgresql_V7_mowgli/inserisci.pl b/helm/metadata/postgresql_V7_mowgli/inserisci.pl
new file mode 100755 (executable)
index 0000000..17c8824
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+$max = 0;
+open (OUT, "| psql -U helm helm_mowgli_new_schema");
+while (<STDIN>) {
+ open (IN,$_);
+ $uri1 = <IN>;
+ chomp($uri1);
+ print "$uri1:\n";
+ $uri1 =~ s/'/\\'/g;
+ $max++;
+ print OUT "create table t$max (prop_id varchar, position varchar, uri varchar, depth int);";
+ print OUT "insert into registry values ('$uri1', $max);";
+ while (<IN>) {
+  chomp;
+  ($dir,$context,$uri2,$depth) = split(/\|/);
+  print "   Inserisco $dir#$context#$uri2#$depth\n";
+  $uri2 =~ s/'/\\'/g;
+  print OUT "insert into t$max values ('$dir', '$context', '$uri2', $depth);";
+ }
+  print "\n";
+  close IN;
+}
+close OUT;