]> matita.cs.unibo.it Git - helm.git/commitdiff
Experimental commit that implements the getalluris method, that gives back in
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 21 May 2002 08:52:37 +0000 (08:52 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 21 May 2002 08:52:37 +0000 (08:52 +0000)
XML all the known uris whose prefix is cic and whose suffix is not .types.
Useful to implement the locate query with galax.

helm/http_getter/http_getter.pl.in

index f3484d68845d38099360016ebb4e29aec508b74b..c9cac35f2904741994c5b3cc67bdbb34738c7324 100755 (executable)
@@ -313,7 +313,13 @@ while (my $c = $d->accept) {
            print " done\n";
            html_nice_answer($c,"Update done");
 
-                                 # "/ls" does not work with rdf uris
+                                 # "/getalluris" does not work with rdf uris
+        } elsif ($http_method eq 'GET' and $http_path eq "/getalluris") {
+            # send back all the keys in xml
+            print "BASEURI $baseuri, FORMAT $outype\n";
+            $cont = getalluris();
+            answer($c,$cont,"text/xml","");
+
         } elsif ($http_method eq 'GET' and $http_path eq "/ls") {
             # send back keys that begin with a given uri
            my ($uritype,$uripattern,$uriprefix);
@@ -443,6 +449,25 @@ sub resolve { # resolve an uri in a url, work both with standard cic: or theory:
  }
 }
 
+sub getalluris { # get all the keys whose prefix is cic
+ my $content = "";
+ my ($uri);
+ my $debug=1; # for debug
+
+  $content .= '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n";
+  $content .= "<!DOCTYPE alluris SYSTEM ";
+  $content .= "\"$myownurl/getdtd?uri=alluris.dtd\">" . "\n\n";
+  $content .= "<alluris>\n";
+  foreach $uri (sort (keys(%xml_map))) { # select matching uris
+   if ($uri =~ /^cic:/ && not $uri =~ /.types$/) {
+    print "GETALLURI: $uri\n" if defined($debug);
+    $content .= "\t<uri value=\"$uri\"/>\n";
+   }
+  }
+  $content .= "</alluris>\n";
+ return $content;
+}
+
 sub finduris { # find uris for cic and theory trees generation
  my ($uritype,$uripattern,$format) = @_;
  my $content = "";