line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Store::OAI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
523
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
144575
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
257
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
281
|
use Catmandu::Util qw(:is); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
382
|
|
9
|
1
|
|
|
1
|
|
388
|
use Catmandu::Importer::OAI; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Catmandu::Store::OAI::Bag; |
11
|
|
|
|
|
|
|
use namespace::clean; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Catmandu::Store'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has url => (is => 'ro', required => 1); |
16
|
|
|
|
|
|
|
has metadataPrefix => (is => 'ro', default => sub { "oai_dc" }); |
17
|
|
|
|
|
|
|
has handler => (is => 'ro', default => sub { "oai_dc" }); |
18
|
|
|
|
|
|
|
has oai => (is => 'lazy'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _build_oai { |
21
|
|
|
|
|
|
|
my ($self) = @_; |
22
|
|
|
|
|
|
|
Catmandu::Importer::OAI->new( |
23
|
|
|
|
|
|
|
url => $self->url , |
24
|
|
|
|
|
|
|
metadataPrefix => $self->metadataPrefix , |
25
|
|
|
|
|
|
|
handler => $self->handler , |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=pod |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Catmandu::Store::OAI - A Catmandu store backed by OAI-PMH |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# From the command line |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Export data from OAI |
44
|
|
|
|
|
|
|
$ catmandu export OAI --url http://somewhere.org/oai to JSON > data.json |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Export only one record |
47
|
|
|
|
|
|
|
$ catmandu export OAI --url http://somewhere.org/oai --id 1234 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Export from a set |
50
|
|
|
|
|
|
|
$ catmandu export OAI --url http://somewhere.org/oai --bag fulltext |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# From Perl |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use Catmandu; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $store = Catmandu->store('OAI', url => ' http://somewhere.org/oai '); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# All bags are iterators |
59
|
|
|
|
|
|
|
$store->bag->each(sub { ... }); |
60
|
|
|
|
|
|
|
$store->bag->take(10)->each(sub { ... }); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $rec = $store->bag->get('1234'); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 METHODS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 new(url => $url , metadataPrefix => $metadataPrefix , handler => $handler) |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Create a new Catmandu::Store::OAI store connected to baseURL $url. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 INHERITED METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This Catmandu::Store implements: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 3 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item L<Catmandu::Store> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=back |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Each Catmandu::Bag in this Catmandu::Store implements: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 3 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item L<Catmandu::Bag> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SEE ALSO |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L<Catmandu::Store> , |
91
|
|
|
|
|
|
|
L<Catmandu::Importer::OAI> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Patrick Hochstenbach, C<< patrick.hochstenbach at ugent.be >> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
100
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
101
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |