]> matita.cs.unibo.it Git - helm.git/blob - helm/metadata/postgresql_V7_mowgli/inserisci.pl
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / metadata / postgresql_V7_mowgli / inserisci.pl
1 #!/usr/bin/perl
2
3 $max = 0;
4 open (OUT, "| psql -U helm helm_mowgli_new_schema");
5 while (<STDIN>) {
6  open (IN,$_);
7  $uri1 = <IN>;
8  chomp($uri1);
9  print "$uri1:\n";
10  $uri1 =~ s/'/\\'/g;
11  $max++;
12  print OUT "create table t$max (prop_id varchar, position varchar, uri varchar, depth int);";
13  print OUT "insert into registry values ('$uri1', $max);";
14  while (<IN>) {
15   chomp;
16   ($dir,$context,$uri2,$depth) = split(/\|/);
17   print "   Inserisco $dir#$context#$uri2#$depth\n";
18   $uri2 =~ s/'/\\'/g;
19   print OUT "insert into t$max values ('$dir', '$context', '$uri2', $depth);";
20  }
21   print "\n";
22   close IN;
23 }
24 close OUT;