/[webpac2]/trunk/bin/isi-download-results.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/isi-download-results.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1292 by dpavlin, Sat Sep 19 20:35:43 2009 UTC revision 1334 by dpavlin, Fri Jun 4 17:43:29 2010 UTC
# Line 3  Line 3 
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6    use WWW::Mechanize;
7    use Data::Dump qw(dump);
8    use File::Path;
9    use Text::Unaccent;
10    
11  # Advanced search syntax:  # Advanced search syntax:
12  # http://images.isiknowledge.com/WOK46/help/WOS/h_advanced_examples.html  # http://images.isiknowledge.com/WOK46/help/WOS/h_advanced_examples.html
13    
14  our $q = 'AD=Croatia';  our $q = 'AD=Croatia';
15  my $range_size = 500;  my $range_size = 500;
16  my $overlap    = 10; # between previous and this range  my $overlap    = 3; # between previous and this range
17    my $results = 0;
18  $q = 'TS=psychology AND AD=Croatia' if @ARGV; # FIXME debug  my $citations = 0;
19    my $cites_by_year = 0;
20    
21  my $max_cites = 5000; # ISI limit to get cites  my $max_cites = 5000; # ISI limit to get cites
 our @ranges;  
22    
23  use WWW::Mechanize;  if ( 0 ) {
24  use Data::Dump qw(dump);          $q = 'TS=psychology AND AD=Croatia';
25  use File::Path;          $range_size = 50;
26            $overlap    = 0;
27            $max_cites  = 50;
28    }
29    
30    $q = unac_string( 'utf-8', join(' ', @ARGV) ) if @ARGV;
31    
32  our $mech = WWW::Mechanize->new(  our $mech = WWW::Mechanize->new(
33          autocheck => 1,          autocheck => 0, # it dies in reference download with it!
34          cookie_jar => undef,          cookie_jar => undef,
35  );  );
36    
37  our $step = 0;  our $step = 0;
38    our @ranges;
39    
40  my $dir = '/tmp/isi/';  my $dir = '/tmp/isi/';
41  rmtree $dir if -e $dir;  #rmtree $dir if -e $dir;
42  mkdir $dir;  mkdir $dir unless -d $dir;
43    
44  sub save_mech {  sub save_mech {
45          my $path = shift;          my $path = shift;
# Line 164  sub years { Line 175  sub years {
175    
176          my @y = sort keys %$years;          my @y = sort keys %$years;
177    
178            @ranges = ();
179    
180            if ( $cites_by_year ) {
181                    push @ranges, [ $_ ] foreach @y;
182                    warn "# cites_by_year ranges ", dump @ranges;
183                    return;
184            }
185    
186          my $y = shift @y;          my $y = shift @y;
187          my $size = $years->{$y};          my $size = $years->{$y};
188    
         @ranges = ();  
189          my $cites_range;          my $cites_range;
190          $cites_range = [$y] if $y;          $cites_range = [$y] if $y;
191    
# Line 196  sub years { Line 214  sub years {
214    
215  search;  search;
216  years;  years;
217  get_results;  get_results 'results' if $results;
218    
219    if ( $citations ) {
220    
221  citations;          citations;
222    
223  do {          do {
224          my $part;                  my $part;
225          if ( @ranges ) {                  if ( @ranges ) {
226                  $part .= $ranges[0]->[0] . '.';                          $part .= $ranges[0]->[0] . '.';
227                  search;                          search;
228          }                          citations;
229          $part .= 'citing';                  }
230          get_results $part;                  $part .= 'citing';
231  } while ( @ranges );                  get_results $part;
232            } while ( @ranges );
233    
234    }

Legend:
Removed from v.1292  
changed lines
  Added in v.1334

  ViewVC Help
Powered by ViewVC 1.1.26