This project is not covered by Drupal’s security advisory policy.

The Migrate OAI-PMH module provides a migrate source class you can use when importing
data from a OAI-PMH provider.

Usage

You can use the source class 'MigrateSourceOaiPmh' just the same as MigrateSourceXML.
There is a lot of documentation about this at http://drupal.org/migrate. To get started,
enable the migrate_example module and browse to admin/content/migrate to see its dashboard.
Mimic the beer.inc or wine.inc example file in order to specify your own migrations.

When using the 'MigrateSourceOaiPmh' source class, make sure to extend your migration from
the 'XMLMigration' class. The 'MigrateSourceOaiPmh' class returns rows as SimpleXMLElement
objects and the 'XMLMigration' class handles the xpath field mappings.

Dependencies

The module is based on the PHPOAIPMH library found at https://github.com/caseyamcl/phpoaipmh.
We use the composer_manager module to fetch the dependencies and autoload required classes.

Example class

<?php

/**
 * @file
 * We will use the Migrate API to import a OAI-PMH source.
 */

/**
 * Example migration class.
 *
 * We extend the XMLMigration class since it already handles XPath field
 * mapping for us. The migrate_oaipmh module returns SimpleXML elements,
 * so this is the easiest thing to do.
 */
class ExampleMigration extends XMLMigration {

  /**
   * Migration constructor.
   */
  public function __construct($arguments) {
    parent::__construct($arguments);

    // The source ID here is the one retrieved from the XML listing file, and
    // used to identify the specific item's file.
    $this->map = new MigrateSQLMap($this->machineName,
      array(
        'sourceid' => array(
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
        ),
      ),
      MigrateDestinationNode::getKeySchema()
    );

    // Set migration source and destination.
    $this->source = new MigrateSourceOaiPmh('http://www.example.com/oaipmh', 'rdf');
    $this->destination = new MigrateDestinationNode('[node type]');

    // Map source OAI-PMH fields to collection item fields throught XPath.
    $this->addFieldMapping('title', 'title_field')->xpath('title_field');
    $this->addFieldMapping('body', 'body_field')->xpath('body_field');
    $this->addFieldMapping('body:format')->defaultValue('filtered_html');
  }

}
Supporting organizations: 

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • Module categories: Content Editing Experience, Import and Export
  • Created by seanB on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases