Created
January 16, 2014 00:04
-
-
Save egrguric/8447275 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## create a harvester for the BCIT Repository | |
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use Net::OAI::Harvester; | |
my $harvester = Net::OAI::Harvester->new( | |
baseURL => 'http://contentpro.lib.bcit.ca/iii/oairep/OAIRepository' | |
); | |
# find out the name for a repository | |
my $identity = $harvester->identify(); | |
print "name: ",$identity->repositoryName(),"\n"; | |
print "protocol vesion: ",$identity->protocolVersion(),"\n"; | |
print "earliest date stamp: ",$identity->earliestDatestamp(),"\n"; | |
my $list = $harvester->listMetadataFormats(); | |
print "archive supports metadata prefixes: ", | |
join( ',', $list->prefixes() ), "\n"; | |
# get a list of identifiers | |
my $identifiers = $harvester->listIdentifiers( | |
'metadataPrefix' => 'oai_dc', | |
'metadataPrefix'=> 'qdc'); | |
while ( my $header = $identifiers->next() ) { | |
print "identifier: ",$header->identifier(), "\n"; | |
} | |
# list all the records in a repository | |
my $records = $harvester->listAllRecords( | |
'metadataPrefix' => 'oai_dc'); | |
while ( my $record = $records->next() ) { | |
my $header = $record->header(); | |
my $metadata = $record->metadata(); | |
print "identifier: ", $header->identifier(), "\n"; | |
print "title: ", $metadata->title(), "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment