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