Datahub::Factory::Importer::OAI - Import data from an OAI-PMH endpoint
use Datahub::Factory; use Data::Dumper qw(Dumper); my $oai = Datahub::Factory->importer('OAI')->new( url => 'https://biblio.ugent.be/oai', metadataPrefix => 'oai_dc', set => '2011' ); $oai->importer->each(sub { my $item = shift; print Dumper($item); });
Datahub::Factory::Importer::OAI imports data from an OAI-PMH endpoint. By default it uses the ListRecords verb to return all records using the oai_lido format. It is possible to only return records from a single Set or those created, modified or deleted between two dates (from and until).
ListRecords
It automatically deals with resumptionTokens, so client code does not have to implement paging.
Only the endpoint parameter is required.
endpoint
URL of the OAI endpoint.
Handlers can be provided as function reference, an instance of a Perl package that implements 'parse', or by a package NAME. Package names should be prepended by + or prefixed with Catmandu::Importer::OAI::Parser. E.g foobar will create a Catmandu::Importer::OAI::Parser::foobar instance. By default the handler Catmandu::Importer::OAI::Parser::oai_dc is used for metadataPrefix oai_dc, Catmandu::Importer::OAI::Parser::marcxml for marcxml, Catmandu::Importer::OAI::Parser::mods for mods, Catmandu::Importer::OAI::Parser::Lido for Lido and Catmandu::Importer::OAI::Parser::struct for other formats. In addition there is Catmandu::Importer::OAI::Parser::raw to return the XML as it is.
+
Catmandu::Importer::OAI::Parser
foobar
Catmandu::Importer::OAI::Parser::foobar
oai_dc
marcxml
mods
Lido
metadata_prefix
Any metadata prefix the endpoint supports. Defaults to oai_lido.
oai_lido
set
Optionally, a set to get records from.
from
Optionally, a must_be_older_than date.
until
Optionally, a must_be_younger_than date.
username
An optional username.
password
An optional password.
importer
A Importer that can be used in your script.
Pieter De Praetere <pieter at packed.be >
Copyright 2017- PACKED vzw
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Datahub::Factory Catmandu
To install Datahub::Factory, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Datahub::Factory
CPAN shell
perl -MCPAN -e shell install Datahub::Factory
For more information on module installation, please visit the detailed CPAN module installation guide.