line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Importer::WoSCitedReferences; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
569
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.0302'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
243
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
350
|
use Catmandu::Util qw(is_string xml_escape); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
9
|
1
|
|
|
1
|
|
5
|
use namespace::clean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::WoS::SearchBase'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has uid => (is => 'ro', required => 1); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _search_content { |
16
|
0
|
|
|
0
|
|
|
my ($self, $start, $limit) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $uid = xml_escape($self->uid); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
<<EOF; |
21
|
|
|
|
|
|
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" |
22
|
|
|
|
|
|
|
xmlns:woksearch="http://woksearch.v3.wokmws.thomsonreuters.com"> |
23
|
|
|
|
|
|
|
<soapenv:Header/> |
24
|
|
|
|
|
|
|
<soapenv:Body> |
25
|
|
|
|
|
|
|
<woksearch:citedReferences> |
26
|
|
|
|
|
|
|
<databaseId>WOS</databaseId> |
27
|
|
|
|
|
|
|
<uid>$uid</uid> |
28
|
|
|
|
|
|
|
<queryLanguage>en</queryLanguage> |
29
|
|
|
|
|
|
|
<retrieveParameters> |
30
|
|
|
|
|
|
|
<firstRecord>$start</firstRecord> |
31
|
|
|
|
|
|
|
<count>$limit</count> |
32
|
|
|
|
|
|
|
<option> |
33
|
|
|
|
|
|
|
<key>Hot</key> |
34
|
|
|
|
|
|
|
<value>On</value> |
35
|
|
|
|
|
|
|
</option> |
36
|
|
|
|
|
|
|
</retrieveParameters> |
37
|
|
|
|
|
|
|
</woksearch:citedReferences> |
38
|
|
|
|
|
|
|
</soapenv:Body> |
39
|
|
|
|
|
|
|
</soapenv:Envelope> |
40
|
|
|
|
|
|
|
EOF |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _retrieve_content { |
44
|
0
|
|
|
0
|
|
|
my ($self, $query_id, $start, $limit) = @_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$query_id = xml_escape($query_id); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
<<EOF; |
49
|
|
|
|
|
|
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> |
50
|
|
|
|
|
|
|
<soap:Header/> |
51
|
|
|
|
|
|
|
<soap:Body> |
52
|
|
|
|
|
|
|
<woksearch:citedReferencesRetrieve xmlns:woksearch="http://woksearch.v3.wokmws.thomsonreuters.com"> |
53
|
|
|
|
|
|
|
<queryId>$query_id</queryId> |
54
|
|
|
|
|
|
|
<retrieveParameters> |
55
|
|
|
|
|
|
|
<firstRecord>$start</firstRecord> |
56
|
|
|
|
|
|
|
<count>$limit</count> |
57
|
|
|
|
|
|
|
</retrieveParameters> |
58
|
|
|
|
|
|
|
</woksearch:citedReferencesRetrieve> |
59
|
|
|
|
|
|
|
</soap:Body> |
60
|
|
|
|
|
|
|
</soap:Envelope> |
61
|
|
|
|
|
|
|
EOF |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _search_response_type { |
65
|
0
|
|
|
0
|
|
|
'citedReferencesResponse'; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _retrieve_response_type { |
69
|
0
|
|
|
0
|
|
|
'citedReferencesRetrieveResponse'; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _find_records { |
73
|
0
|
|
|
0
|
|
|
my ($self, $xpc, $response_type) = @_; |
74
|
0
|
|
|
|
|
|
my @nodes = $xpc->findnodes( |
75
|
|
|
|
|
|
|
"/soap:Envelope/soap:Body/ns2:$response_type/return/references"); |
76
|
|
|
|
|
|
|
[ |
77
|
|
|
|
|
|
|
map { |
78
|
0
|
|
|
|
|
|
my $node = $_; |
|
0
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $ref = {}; |
80
|
0
|
|
|
|
|
|
for my $key ( |
81
|
|
|
|
|
|
|
qw(uid docid articleId citedAuthor timesCited year page volume citedTitle citedWork hot) |
82
|
|
|
|
|
|
|
) |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
|
my $val = $node->findvalue($key); |
85
|
0
|
0
|
|
|
|
|
$ref->{$key} = $val if is_string($val); |
86
|
|
|
|
|
|
|
} |
87
|
0
|
|
|
|
|
|
$ref; |
88
|
|
|
|
|
|
|
} @nodes |
89
|
|
|
|
|
|
|
]; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=encoding utf-8 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 NAME |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Catmandu::Importer::WoSCitedReferences - Import Web of Science cited references for a given record |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SYNOPSIS |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# On the command line |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
$ catmandu convert WoSCitedReferences --username XXX --password XXX --uid 'WOS:000413520000001' to YAML |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# In perl |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
use Catmandu::Importer::WoS; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $wos = Catmandu::Importer::WoSCitedReferences->new(username => 'XXX', password => 'XXX', uid => 'WOS:000413520000001'); |
115
|
|
|
|
|
|
|
$wos->each(sub { |
116
|
|
|
|
|
|
|
my $cite = shift; |
117
|
|
|
|
|
|
|
# ... |
118
|
|
|
|
|
|
|
}); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHOR |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Nicolas Steenlant E<lt>nicolas.steenlant@ugent.beE<gt> |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 COPYRIGHT |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Copyright 2017- Nicolas Steenlant |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 LICENSE |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
131
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 SEE ALSO |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |