| 1 | package Catmandu::Importer::WoSCitedReferences; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Catmandu::Sane; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | our $VERSION = '0.0303'; | |||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Catmandu::Util qw(is_string xml_escape); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | with 'Catmandu::WoS::SearchBase'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | has uid => (is => 'ro', required => 1); | |||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub _search_content { | ||||||||
|
Subroutine
_search_content: not called CC=1 SCAR=6.9
| |||||||||||
| 16 | 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 | 0 | ▶ | sub _retrieve_content { | ||||||||
|
Subroutine
_retrieve_content: not called CC=1 SCAR=6.9
| |||||||||||
| 44 | 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 | 0 | ▶ | sub _search_response_type { | ||||||||
|
Subroutine
_search_response_type: not called CC=1 SCAR=6.9
| |||||||||||
| 65 | 0 | 'citedReferencesResponse'; | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 0 | ▶ | sub _retrieve_response_type { | ||||||||
|
Subroutine
_retrieve_response_type: not called CC=1 SCAR=6.9
| |||||||||||
| 69 | 0 | 'citedReferencesRetrieveResponse'; | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 0 | ▶ | sub _find_records { | ||||||||
|
Subroutine
_find_records: not called CC=3 SCAR=24.8
| |||||||||||
| 73 | 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 = $_; | |||||||||
| 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 | ▶ | $ref->{$key} = $val if is_string($val); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 86 | } | ||||||||||
| 87 | 0 | $ref; | |||||||||
| 88 | } @nodes | ||||||||||
| 89 | ]; | ||||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | 1 | 1; | |||||||||
| 93 | |||||||||||
| 94 | 1 | 1; | |||||||||
| 95 | |||||||||||
| 96 | __END__ | ||||||||||