Bibcode Link Server

Sample PERL SOAP server script for "dumping" the list of known bibcode-urls (plus associated metadata) so they can be harvested by ADS. Each datacenter wishing to provide ADS with links to its data holdings should maintain a similar script so that these links can be harvested and automatically incorporated in the link creation procedures used by ADS.

The perl SOAP server below reads the input table biblinks.tab and sends back a data structure containing the links. You should use this script as a template to adapt to your own needs in order to read and format the data links from your own archive backend.

#!/usr/bin/perl
#
# Sample PERL SOAP script to format bibliographic metadata according
# to the ITWG draft of oct 2002:
#
#
#   bibcode   => Standard bibcode string
#   sdesc     => Short identifier as above
#   desc      => Longer identifier as above
#   url       => Link to data associated with bibcode.
#   type      => Type of link (e.g. 'data', 'pdf', 'simbad')
#

use SOAP::Transport::HTTP;

SOAP::Transport::HTTP::CGI
    -> dispatch_to('BibLinks')
    -> handle;


package BibLinks;

# simply return all links in the bibtable file
sub harvest {
    my $self = shift;
    my @results = ();

    # bibtable_file is a tab-separated table containing:
    #    bibcode, URL, description
    my $bibtable = "biblinks.tab";
    # all links that we output are of type 'data'; 
    # for a full list of ADS link types, see:
    # http://adsdoc.harvard.edu/abs_doc/help_pages/results.html#available_items
    my $linktype = 'data';
    my $sdesc = '[ADS]';   # this is a short description for each link

    open(my $bf, $bibtable) or die "error opening file $bibtable: $!";

    while (my $r = <$bf>) {
	chop($r);
	my ($bibcode,$url,$desc) = split(/\t/,$r);

	push(@results,{ 
	    bibcode => $bibcode, 
	    url     => $url,
	    desc    => $desc,
	    sdesc   => $sdesc,
	    type    => $linktype,
	});
    }
    return [ @results ];
}

We provide a sample client script that harvests the links from the server script above. The synopsis for the client script is:
     biblinks-client.pl [options] [soap cgi proxy server]
The available options are:
     --debug     turns on debugging, printing out all low-level SOAP
                 client-server interaction to STDERR
     --xml       output data in XML format using the XML::Simple PERL
                 module (default)
     --table     output data as a three-column table: bibcode, url,
                 description
     --html      output data in HTML itemized format
The default CGI proxy server used by the client script is set to be http://ads.harvard.edu/ws/biblinks (which is just the CGI test script biblinks-server.pl described above). An alternative server can be specified on the command line instead. The ones currently (11/25/02) available are: Example of client usage:
adsfore-6: ./biblinks-client.pl biblinks-client.pl: connecting to SOAP proxy http://ads.harvard.edu/ws/biblinks... <opt> <anon> <sdesc>[ADS]</sdesc> <bibcode>2002AJ....123..279V</bibcode> <desc>VI Photometry and Variables in NGC 3201 (von Braun+, 2002)</desc> <url>http://adc.gsfc.nasa.gov/adc-cgi/cat.pl?/journal_tables/AJ/123/279/</url> <type>data</type> </anon> <anon> <sdesc>[ADS]</sdesc> <bibcode>2002AJ....123..290S</bibcode> <desc>UBVI CCD photometry of NGC 2516 (Sung+, 2002)</desc> <url>http://adc.gsfc.nasa.gov/adc-cgi/cat.pl?/journal_tables/AJ/123/290/</url> <type>data</type> </anon> [...] </opt>