OAI-PMH Objective-C harvester is an Objective C library/wrapper over the OAI-PMH protocol
Objective-C Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
OAIHarvester.xcodeproj
OAIHarvester
.gitignore
OAIHarvester.podspec
Podfile
README.md
licence.txt

README.md

OAI-PMH-Harvester-for-ObjC

Introduction

OAI-PMH Objective-C harvester is an Objective C library/wrapper over the OAI-PMH protocol. The Open Archives Initiative Protocol for Metadata Harvesting (OAI-PMH) is a low-barrier mechanism for repository interoperability. Data Providers are repositories that expose structured metadata via OAI-PMH. Service Providers or metadata harvesters (like this one) then make OAI-PMH service requests to harvest that metadata. OAI-PMH is a set of six verbs or services that are invoked within HTTP.

Installation

  1. Download or clone this project on your machine

  2. Copy & Paste the folder OAIHarvester in your project, drag the folder in your XCode project as usual

  3. In your projects precompiled header file (.pch extension) add the following lines

    #import "TouchXML.h" #define BASE_NAMESPACE @"http://www.openarchives.org/OAI/2.0/"

  4. Enable libxml2 library

  • In XCode, within Build Settings, search for Header search paths setting and add /usr/include/libxml2 value to it
  • In the same place, search for Other linker flags setting and add -lxml2 value
  1. You are ready to use the library

Usage

Instantiate a new harvester
OAIHarvester *harvester = [[OAIHarvester alloc] initWithBaseURL:@"PLACE THE OAI BASE URL OF YOUR REPOSITORY HERE"];

Identify instance is ready for you:<br>

NSLog(@"repo name = %@", harvester.identify.repositoryName);
NSLog(@"baseURL = %@", harvester.identify.baseURL);
NSLog(@"granularity = %@", harvester.identify.granularity);
for (NSString *email in harvester.identify.adminEmails){
	NSLog(@"admin email = %@", email);
}
for (NSString *compression in harvester.identify.compressions){
	NSLog(@"compression = %@", compression);
}


Metadata formats are also ready for you:

for (MetadataFormat *format in harvester.metadataFormats){
    NSLog(@"%@: %@", format.prefix, format.namespce);
}


Sets are also ready for you:

for (Set *set in harvester.sets){
    NSLog(@"%@: %@", set.fullSpec, set.name);
}


Define metadata prefix and set for your harvester (the latter is optional):

harvester.metadataPrefix = @"oai_dc";
harvester.setSpec = ((Set *)[harvester.sets objectAtIndex:0]).fullSpec;


List records (1st way - using resumption tokens):

NSArray *records = [harvester listRecordsWithResumptionToken:nil error:&error];
if (error){
    NSLog(@"error = %@", [error localizedDescription]);
}
else {
    if ([harvester hasNextRecords]){
        NSArray *records2 = [harvester getNextRecordsWithError:&error];
        
        Record *record = [records2 objectAtIndex:0];
        NSLog(@"identifier = %@", record.recordHeader.identifier);
        NSLog(@"status = %i", record.recordHeader.status);
        NSLog(@"datestamp = %@", record.recordHeader.datestamp);
        for (NSString *set in record.recordHeader.setSpecs){
            NSLog(@"set = %@", set);
        }
        NSLog(@"namespace: %@", record.recordMetadata.namespce);
        NSLog(@"schemaLoacation: %@", record.recordMetadata.schemaLocation);
        for (MetadataElement *metadata in record.recordMetadata.metadataElements){
            NSLog(@"%@: %@", metadata.name, metadata.value);
        }
    }
}


List records (2nd way - get all items at once):

NSArray *records = [harvester listAllRecords error:&error];

Example

A fully detailed example can be found here. It is an open-source iOS example of how to use this library in a real OAI-PMH enabled repository, the one of Serres Public Library.

Limitations

  • No validation of the incoming xml
  • No support for resumption tokens in the following verbs: ListSets
  • No support for date selective harvesting for the verbs: ListIdentifiers and ListRecords
  • No support for the "description" element in Identify verb
  • No support for the "about" element in ListRecords verb

Dependencies

The only dependency of this project is the TouchXML library that can be found here.

Author

Kostas Stamatis
National Documentation Center / NHRF

Licence

Creative Commons License
OAI-PMH ObjC Harvester by Konstantinos Stamatis is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.