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 $skip_results = 0; |
18 |
$q = 'TS=psychology AND AD=Croatia' if @ARGV; # FIXME debug |
my $cites_by_year = 0; |
19 |
|
|
20 |
my $max_cites = 5000; # ISI limit to get cites |
my $max_cites = 5000; # ISI limit to get cites |
|
our @ranges; |
|
21 |
|
|
22 |
use WWW::Mechanize; |
if ( 0 ) { |
23 |
use Data::Dump qw(dump); |
$q = 'TS=psychology AND AD=Croatia'; |
24 |
use File::Path; |
$range_size = 50; |
25 |
|
$overlap = 0; |
26 |
|
$max_cites = 50; |
27 |
|
} |
28 |
|
|
29 |
|
$q = unac_string( 'utf-8', join(' ', @ARGV) ) if @ARGV; |
30 |
|
|
31 |
our $mech = WWW::Mechanize->new( |
our $mech = WWW::Mechanize->new( |
32 |
autocheck => 1, |
autocheck => 1, |
34 |
); |
); |
35 |
|
|
36 |
our $step = 0; |
our $step = 0; |
37 |
|
our @ranges; |
38 |
|
|
39 |
my $dir = '/tmp/isi/'; |
my $dir = '/tmp/isi/'; |
40 |
rmtree $dir if -e $dir; |
#rmtree $dir if -e $dir; |
41 |
mkdir $dir; |
mkdir $dir unless -d $dir; |
42 |
|
|
43 |
sub save_mech { |
sub save_mech { |
44 |
my $path = shift; |
my $path = shift; |
174 |
|
|
175 |
my @y = sort keys %$years; |
my @y = sort keys %$years; |
176 |
|
|
177 |
|
@ranges = (); |
178 |
|
|
179 |
|
if ( $cites_by_year ) { |
180 |
|
push @ranges, [ $_ ] foreach @y; |
181 |
|
warn "# cites_by_year ranges ", dump @ranges; |
182 |
|
return; |
183 |
|
} |
184 |
|
|
185 |
my $y = shift @y; |
my $y = shift @y; |
186 |
my $size = $years->{$y}; |
my $size = $years->{$y}; |
187 |
|
|
|
@ranges = (); |
|
188 |
my $cites_range; |
my $cites_range; |
189 |
$cites_range = [$y] if $y; |
$cites_range = [$y] if $y; |
190 |
|
|
213 |
|
|
214 |
search; |
search; |
215 |
years; |
years; |
216 |
get_results; |
get_results unless $skip_results; |
217 |
|
|
218 |
|
|
219 |
citations; |
citations; |
223 |
if ( @ranges ) { |
if ( @ranges ) { |
224 |
$part .= $ranges[0]->[0] . '.'; |
$part .= $ranges[0]->[0] . '.'; |
225 |
search; |
search; |
226 |
|
citations; |
227 |
} |
} |
228 |
$part .= 'citing'; |
$part .= 'citing'; |
229 |
get_results $part; |
get_results $part; |