-
Notifications
You must be signed in to change notification settings - Fork 1
OAI‐PMH Implementation
Nikita Voronov edited this page Jan 6, 2025
·
2 revisions
- Introduction
- Getting Started
- Testing the Implementation
- Sample Data Insertion
- Debugging and Validation
- Additional Notes
This documentation provides a comprehensive guide for implementing, testing, and validating the OAI-PMH (Open Archives Initiative Protocol for Metadata Harvesting) protocol in a Laravel application.
-
Start The Application Run the Laravel development server:
php artisan serve
The application will be accessible at
http://127.0.0.1:8000
. -
Ensure Your Database is Seeded Use the Sample Data Insertion steps if required.
-
Expected Output:
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"> <responseDate>2025-01-06T12:00:00Z</responseDate> <Identify> <repositoryName>HIKO Repository</repositoryName> <baseURL>http://127.0.0.1:8000/oai-pmh</baseURL> <protocolVersion>2.0</protocolVersion> <adminEmail>[email protected]</adminEmail> <earliestDatestamp>2000-01-01T00:00:00Z</earliestDatestamp> <deletedRecord>no</deletedRecord> <granularity>YYYY-MM-DDThh:mm:ssZ</granularity> </Identify> </OAI-PMH>
-
Expected Output:
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"> <responseDate>2025-01-06T12:00:00Z</responseDate> <ListMetadataFormats> <metadataFormat> <metadataPrefix>oai_dc</metadataPrefix> <schema>http://www.openarchives.org/OAI/2.0/oai_dc.xsd</schema> <metadataNamespace>http://www.openarchives.org/OAI/2.0/oai_dc/</metadataNamespace> </metadataFormat> </ListMetadataFormats> </OAI-PMH>
- URL: http://127.0.0.1:8000/oai-pmh?verb=ListRecords&metadataPrefix=oai_dc&from=2025-01-01T00:00:00Z
-
Expected Output:
- If records exist: A list of
<record>
elements with metadata. - If no records exist: An empty response or an error indicating no matching records.
- If records exist: A list of
-
URL:
Replace
UUID_HERE
with a validuuid
from yourletters
table: http://127.0.0.1:8000/oai-pmh?verb=GetRecord&identifier=UUID_HERE&metadataPrefix=oai_dc -
Expected Output:
Metadata of the requested record in
<metadata>
tags.
Run php artisan tinker
and execute:
use App\Models\Letter;
Letter::create([
'uuid' => \Illuminate\Support\Str::uuid(),
'abstract' => 'Sample Abstract',
'content' => 'Sample Content',
'date_computed' => now(),
'languages' => 'en',
'updated_at' => now(),
]);
Create a seeder:
php artisan make:seeder LetterSeeder
Add the following to database/seeders/LetterSeeder.php
:
use Illuminate\Database\Seeder;
use App\Models\Letter;
class LetterSeeder extends Seeder
{
public function run()
{
Letter::create([
'uuid' => \Illuminate\Support\Str::uuid(),
'abstract' => 'Sample Abstract',
'content' => 'Sample Content',
'date_computed' => now(),
'languages' => 'en',
'updated_at' => now(),
]);
}
}
Run the seeder:
php artisan db:seed --class=LetterSeeder
Check the logs for any errors:
tail -f storage/logs/laravel.log
Ensure that relevant tables (letters
, keywords
, places
, etc.) contain valid data.
Validate your implementation using an online OAI-PMH validator:
- URL: http://www.openarchives.org/Register/ValidateSite
-
Steps:
- Enter the
/oai-pmh
URL. - Validate.
- Enter the