ADS/Paper.pm

filter: Statementstmt 87.5% 28 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 80.9% 34 / 42 CC 2 SCAR 8.1
CC
2
Cov
82%
summary
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« ADS/Result.pm ↑ Summary ADS/Metrics.pm »
1 package Astro::ADS::Paper;
2 4 $Astro::ADS::Paper::VERSION = '1.92';
3 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Data::Dumper::Concise;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Mojo::Base -strict; # do we want -signatures
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use PerlX::Maybe;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Types::Standard qw( Int Str StrMatch ArrayRef HashRef Any ); # InstanceOf ConsumerOf
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 #declare "Bibcode",
12 # was StrMatch[ qr{^\d{4} [\w.&]{5} [\d.]{4} [ELP-Z\d.] [\d.]{4} [A-Z]$}x ];
13 # now StrMatch[ qr{^\d{4} [\w.&]{5} [\d.]{4} [AELP-Z\d.] [\d.]{3}[B\d] [A-Z]$}x ];
14 # YYYY JJJJJ VVVV M PPPP A (year journal volume type page author)
15 # 2006 nucl. ex.. . 1042 S
16 # 2005 astro .ph. 1 0346 T
17  
18 4 has [qw/id score/] => (
19 is => 'rw',
20 isa => Int->where( '$_ >= 0' ),
21 );
22 4 has bibcode => (
23 is => 'rw',
24 isa => StrMatch[ qr{^\d{4} # year
25 (?: [\w.&]{5} # ( journal
26 [\d.]{4} # volume )
27 | [a-z.]{9} ) # ( arxiv )
28 [AELP-Z\d.] # type
29 [\d.]{3}[B\d] # page
30 [A-Z] # author initial
31 $}x
32 ],
33 );
34 # astro-ph hep-ex|th|lat cond-mat gr-qc math-ph nlin physics quant-ph stat
35 # ph ex th lat mat qc ph
36 4 has title => (
37 is => 'rw',
38 isa => ArrayRef[],
39 );
40 4 has [qw/journal origin object/] => (
41 is => 'rw',
42 isa => Str,
43 );
44 4 has url => (
45 is => 'rw',
46 isa => Str, # Mojo::URL ?
47 );
48 4 has published => (
49 is => 'rw',
50 isa => Str, # qr/Month-Year/
51 );
52 4 has [qw/author aff keyword links_data/] => (
53 is => 'rw',
54 isa => ArrayRef[],
55 );
56 4 has abstract => (
57 is => 'rw',
58 isa => Any, # no idea what this is now
59 );
60  
61 0 ▶sub summary {
Subroutine summary: not called CC=2 SCAR=17.9
Pod undocumented
62 # should this be a one line join or 3 line heredoc?
63 0 my $self = shift;
64  
65 0 ▶ return grep { defined }
Branch: 1 branch
BranchTrueFalseTotal
$self->authors ? : 0 0 0
66 $self->bibcode,
67 $self->score,
68 $self->title,
69 0 ($self->authors ? join('; ', @{$self->authors}) : undef),
70 $self->published;
71 }
72  
73 4 1;
74  
75 =pod
76  
77 =encoding UTF-8
78  
79 =head1 NAME
80  
81 Astro::ADS::Paper - A class for holding the document attributes for the results of a Search
82  
83 =head1 VERSION
84  
85 version 1.92
86  
87 =head1 SYNOPSIS
88  
89 my $result = $search->query();
90 say $_->title grep { $_->year > 2010 } for $result->get_papers();
91  
92 =head1 DESCRIPTION
93  
94 This class is used to contain the individual results from your searches.
95 Please note that it only contains the attributes fetched from the search,
96 not the whole ADS record for the paper.
97  
98 =head2 Notes
99  
100 In searches, the "=" sign turns off the synonym expansion feature
101 available with the author and title fields.
102  
103 =head2 Bibcodes
104  
105 This class has a regex for bibcodes!
106  
107 Coding that regex has shown that bibcodes fields are overloaded in ways not
108 documented. I did not know that 'A' is an acceptable bibcode field for publication
109 type, which maybe short for Abstract.
110  
111 arXiv papers don't have a Volume, so they overflow into that section
112  
113 =head2 Follow up queries
114  
115 Methods available in Astro::ADS v1 for fetching references and citations are
116 now accessed via the Links service (which will be on the development Roadmap).
117  
118 =head2 Allowed fields
119  
120 Allowed: abstract ┃ ack ┃ aff ┃ aff_id ┃ alternate_bibcode ┃ alternate_title ┃ arxiv_class ┃ author ┃ author_count ┃ author_norm ┃ bibcode ┃ bibgroup ┃ bibstem ┃ citation ┃ citation_count ┃ cite_read_boost ┃ classic_factor ┃ comment ┃ copyright ┃ data ┃ database ┃ date ┃ doctype ┃ doi ┃ eid ┃ entdate ┃ entry_date ┃ esources ┃ facility ┃ first_author ┃ first_author_norm ┃ grant ┃ grant_agencies ┃ grant_id ┃ id ┃ identifier ┃ indexstamp ┃ inst ┃ isbn ┃ issn ┃ issue ┃ keyword ┃ keyword_norm ┃ keyword_schema ┃ lang ┃ links_data ┃ nedid ┃ nedtype ┃ orcid_pub ┃ orcid_other ┃ orcid_user ┃ page ┃ page_count ┃ page_range ┃ property ┃ pub ┃ pub_raw ┃ pubdate ┃ pubnote ┃ read_count ┃ reference ┃ simbid ┃ title ┃ vizier ┃ volume ┃ year
121  
122 Given this list is 81 fields, it doesn't make sense to create that many empty attributes.
123  
124 The full list is at https://ui.adsabs.harvard.edu/help/search/comprehensive-solr-term-list
125  
126 =head1 TODO
127  
128 v1 had the following methods
129 * references
130 * citations
131 * alsoread
132 * tableofcontents
133  
134 all of which grepped $self->links for either REFERENCES, CITATIONS, AR or TOC
135  
136 These are returned in the links_data field, but we should be using the Links service to get this data
137  
138 =head1 COPYRIGHT AND LICENSE
139  
140 This software is Copyright (c) 2025 by Boyd Duffee.
141  
142 This is free software, licensed under:
143  
144 The MIT (X11) License
145  
146 =cut
« ADS/Result.pm ↑ Summary ADS/Metrics.pm »