| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catmandu::Importer::WoS; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
704
|
use Catmandu::Sane; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.0303'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
336
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
8
|
1
|
|
|
1
|
|
412
|
use Catmandu::Util qw(xml_escape); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
64
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use namespace::clean; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::WoS::SearchRecords'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has query => (is => 'ro', required => 1); |
|
14
|
|
|
|
|
|
|
has edition => (is => 'ro'); |
|
15
|
|
|
|
|
|
|
has symbolic_timespan => (is => 'ro'); |
|
16
|
|
|
|
|
|
|
has timespan_begin => (is => 'ro'); |
|
17
|
|
|
|
|
|
|
has timespan_end => (is => 'ro'); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _search_content { |
|
20
|
0
|
|
|
0
|
|
|
my ($self, $start, $limit) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $query = xml_escape($self->query); |
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $edition_xml = ''; |
|
25
|
0
|
|
|
|
|
|
my $symbolic_timespan_xml = ''; |
|
26
|
0
|
|
|
|
|
|
my $timespan_xml = ''; |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if (my $edition = $self->edition) { |
|
29
|
0
|
|
|
|
|
|
$edition_xml |
|
30
|
|
|
|
|
|
|
= "<editions><collection>WOS</collection><edition>$edition</edition></editions>"; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
0
|
|
|
|
if (my $ts = $self->symbolic_timespan) { |
|
|
|
0
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$symbolic_timespan_xml = "<symbolicTimeSpan>$ts</symbolicTimeSpan>"; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
elsif ($self->timespan_begin && $self->timespan_end) { |
|
37
|
0
|
|
|
|
|
|
my $tsb = $self->timespan_begin; |
|
38
|
0
|
|
|
|
|
|
my $tse = $self->timespan_end; |
|
39
|
0
|
|
|
|
|
|
$timespan_xml |
|
40
|
|
|
|
|
|
|
= "<timeSpan><begin>$tsb</begin><end>$tse</end></timeSpan>"; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
<<EOF; |
|
44
|
|
|
|
|
|
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" |
|
45
|
|
|
|
|
|
|
xmlns:woksearch="http://woksearch.v3.wokmws.thomsonreuters.com"> |
|
46
|
|
|
|
|
|
|
<soapenv:Header/> |
|
47
|
|
|
|
|
|
|
<soapenv:Body> |
|
48
|
|
|
|
|
|
|
<woksearch:search> |
|
49
|
|
|
|
|
|
|
<queryParameters> |
|
50
|
|
|
|
|
|
|
<databaseId>WOS</databaseId> |
|
51
|
|
|
|
|
|
|
<userQuery>$query</userQuery> |
|
52
|
|
|
|
|
|
|
$edition_xml |
|
53
|
|
|
|
|
|
|
$symbolic_timespan_xml |
|
54
|
|
|
|
|
|
|
$timespan_xml |
|
55
|
|
|
|
|
|
|
<queryLanguage>en</queryLanguage> |
|
56
|
|
|
|
|
|
|
</queryParameters> |
|
57
|
|
|
|
|
|
|
<retrieveParameters> |
|
58
|
|
|
|
|
|
|
<firstRecord>$start</firstRecord> |
|
59
|
|
|
|
|
|
|
<count>$limit</count> |
|
60
|
|
|
|
|
|
|
<option> |
|
61
|
|
|
|
|
|
|
<key>RecordIDs</key> |
|
62
|
|
|
|
|
|
|
<value>On</value> |
|
63
|
|
|
|
|
|
|
</option> |
|
64
|
|
|
|
|
|
|
<option> |
|
65
|
|
|
|
|
|
|
<key>targetNamespace</key> |
|
66
|
|
|
|
|
|
|
<value>http://scientific.thomsonreuters.com/schema/wok5.4/public/FullRecord</value> |
|
67
|
|
|
|
|
|
|
</option> |
|
68
|
|
|
|
|
|
|
</retrieveParameters> |
|
69
|
|
|
|
|
|
|
</woksearch:search> |
|
70
|
|
|
|
|
|
|
</soapenv:Body> |
|
71
|
|
|
|
|
|
|
</soapenv:Envelope> |
|
72
|
|
|
|
|
|
|
EOF |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _search_response_type { |
|
76
|
0
|
|
|
0
|
|
|
'searchResponse'; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=encoding utf-8 |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Catmandu::Importer::WoS - Import Web of Science records |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# On the command line |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$ catmandu convert WoS --username XXX --password XXX --query 'TS=(lead OR cadmium)' to YAML |
|
94
|
|
|
|
|
|
|
$ catmandu convert WoS --username XXX --password XXX --query 'TS=(lead OR cadmium)' --edition SCI to YAML |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# In perl |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
use Catmandu::Importer::WoS; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $wos = Catmandu::Importer::WoS->new(username => 'XXX', password => 'XXX', query => 'TS=(lead OR cadmium)'); |
|
101
|
|
|
|
|
|
|
$wos->each(sub { |
|
102
|
|
|
|
|
|
|
my $record = shift; |
|
103
|
|
|
|
|
|
|
# ... |
|
104
|
|
|
|
|
|
|
}); |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Nicolas Steenlant E<lt>nicolas.steenlant@ugent.beE<gt> |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Copyright 2017- Nicolas Steenlant |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 LICENSE |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
117
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |