acdh-oeaw / arche-oaipmh
OAI-PMH service for the ACDH repo solution
Installs: 3 700
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 2
Type:project
pkg:composer/acdh-oeaw/arche-oaipmh
Requires
- acdh-oeaw/arche-lib: ^7
- zozlak/guzzle-proxy-client: ^1.0
- zozlak/logging: ^1
- zozlak/query-part: ^2.1
Requires (Dev)
- ext-pdo_sqlite: *
- phpstan/phpstan: *
- phpunit/phpunit: *
- dev-master
- 5.3.2
- 5.3.1
- 5.3.0
- 5.2.4
- 5.2.3
- 5.2.2
- 5.2.1
- 5.2.0
- 5.1.0
- 5.0.5
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- v4.x-dev
- 4.2.5
- 4.2.4
- 4.2.3
- 4.2.2
- 4.2.0
- 4.1.1
- 4.1.0
- 4.0.2
- 4.0.1
- 4.0.0
- 3.0.0
- 2.7.0
- 2.6.0
- 2.5.5
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.2
- 2.1.1
- 2.0.0
- 2.0.0-alpha
- v1.x-dev
- 1.4.1
- 1.4.0
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.1
- 1.2.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- dev-rdfInterface
This package is auto-updated.
Last update: 2025-09-30 09:34:26 UTC
README
The main aim was to keep it flexible:
- It doesn't enforce any metadata schema. RDF metadata to OAI-PMH facets (id, date, set) mappings are provided in a configuration file.
- It's shipped with classes implementing various OAI-PMH metadata generation scenarios, e.g.:
- Using Dublin Core and Dublin Core terms contained in the repository resource RDF metadata.
- Serializing whole repository resource RDF metadata to XML.
- Serving another linked repository resource as the OAI-PMH metadata.
- By filling an XML template with repository resource RDF metadata.
- It's easy to extend
- implement your own metadata sources
- implement your own search class
- implement your own sets
REST API Extensions
The service implements two extensions over the REST API defined by the OAI-PMH specification:
verb=GetRecordRawreturns just a record data without the OAI-PMH "envelope".verb=GetRecordRaw&format=RDFserializationMimeassumes the record is in the RDF-XML and serializes it in a given RDF serialization format (e.g.text/turtleorapplication/ld+json)
Installation
- Run in your webroot:
composer require acdh-oeaw/arche-oaipmh cp vendor/acdh-oeaw/arche-oaipmh/.htaccess vendor/acdh-oeaw/arche-oaipmh/index.php . cp vendor/acdh-oeaw/arche-oaipmh/config-sample.yaml config.yaml - Adjust
config.yamlaccording to comments in the file.
Required repository structure
Much attention was paid to make the service flexible.
To achieve that different implementations were provided for each of main components (set handling component, metadata source component).
These implementations provide various features and put various requirements on your repository structure.
Please read the documentation provided in the config-sample.yaml and, if needed, the documentation of particular classes to get more information.
Architecture
Source code documentation can be found at https://acdh-oeaw.github.io/arche-docs/devdocs/namespaces/acdhoeaw-arche-oaipmh.html
+------------------+
| DeletedInterface |
+------------------+
^ ^
| |
+-----+ +-----------+
| | | Search | +-----------+
| Oai |--->| Interface |--->| Metadata |
| | +-----------+ | Interface |
+-----+ | +-----------+
| |
v v
+--------------+
| SetInterface |
+--------------+
Oai
The main class is acdhOeaw\oai\Oai which works as a controller. It:
- checks OAI-PMH requests correctness,
- handles OAI-PMH
identifyandListMetadataFormatscommands- the
deletedRecordfield value of theidentifyrequest response is fetched using theDeletedInterface
- the
- delegates OAI-PMH
GetRecord,ListIdentifiersandListRecordscommands to a chosen class implementing theacdhOeaw\oai\search\SearchInterface - delegates OAI-PMH
ListSetscommand to a chosen class extending theacdhOeaw\oai\set\SetInterfaceclass. - generates OAI-PMH compliant output from results of above mentioned actions
- catches errors and generates OAI-PMH compliant error responses
Until you want to implement the resumption tokens there should be no need to alter this class.
SetInterface
The acdhOeaw\oai\set\SetInterface provides an API:
- for the
Oaiclass to handle theListSetsOAI-PMH requests - for the
SearchInterfaceimplementations to include set information in searches
Currenlty there are three implementations of the SetInterface:
acdhOeaw\oai\set\NoSetsimply throwing thenoSetHierarchyOAI-PMH erroracdhOeaw\oai\set\Simplewhere set membership is fetched from a given RDF metadata property. This property value is taken as both <setSpec> and <setName> values and no <setDescription> is provided.acdhOeaw\oai\set\Complexwhere a given RDF metadata property points to another repository resource describing the set.
If exsisting implementations don't fulfil your needs, you need to write your own
class extending the acdhOeaw\oai\set\SetInterface one and set the oaiSetClass
in the config.ini file to your class name.
DeletedInterface
The acdhOeaw\oai\deleted\DeletedInterface provides an API:
- for the
Oaiclass to get thedeletedRecordfield value to be reported in the OAI-PMHidentifyresponse - for the
SearchInterfaceimplementations to include information on resource deletion
Currently there are two implementations of the DeletedInterface:
acdhOeaw\oai\deleted\Noreporting no support for deleted resourcesacdhOeaw\oai\deleted\RdfProeprtywhere a resource having a given metadata property (no matter its value) is assumed to be deleted
If exsisting implementations don't fulfil your needs, you need to write your own
class extending the acdhOeaw\oai\deleted\DeletedInterface one and set the
oaiDeletedClass in the config.ini file to your class name.
SearchInterface
The acdhOeaw\oai\search\SearchInterface provides an API for the Oai class to:
- Perform search for resources.
- Get basic resource metadata required to serve the
ListIdentifiersOAI-PMH request.
Data for each resource are returned asacdhOeaw\oai\data\Headerdataobjects. - Get full resource metadata required to serve
ListResourcesandGetRecordOAI-PMH requests.
Data for each resource are returned asacdhOeaw\oai\metadata\MetadataInterfaceobjects.
The SearchInterface implementations depend on three other interfaces:
SetInterfacefor getting SPARQL search query extensions for including information and/or filters on sets.DeletedInterfacefor including information on resources deletion.MetadataInterfacefor getting the full resource metadata required to serveListResourcesandGetRecordOAI-PMH requests.
The current implementation (acdhOeaw\oai\search\BasicSearch) is quite flexible:
- takes OAI-PMH
identifieranddatestampmappings from the configuration file (oaiIdPropandoaiDateProp) - honors set, deleted and metadata format SPARQL search query extensions
provided by the
SetInterface,DeletedInterfaceandMetadataInterface
Until you don't need to alter the way identifier and datestamp are fetched
there should be no need to develop an alternative implementation (possibly with
additional filters).
MetadataInterface
The acdhOeaw\oai\metadata\MetadataInterface provides a common API for fetching
full OAI-PMH metadata from different sources, e.g. the repository resource
metadata (by applying different mappings) or other repository resource.
To make it as flexible as possible:
- It allows to extend SPARQL search queries performed by the
SearchInterfaceimplementations. - The
MetadataInterfaceobject constructor is provided with repository resource object, the metadata format description and full set of SPARQL search query data describing a given resource.
Existing implementations are:
acdhOeaw\oai\metadata\RdfXmlserializes all resource's RDF metadata into XML.acdhOeaw\oai\metadata\DcMetadatalike theRdfXmlbut returns only Dublin Core and Dublin Core Terms metadata properties.acdhOeaw\oai\metadata\ResMetadatauses another (linked trough metadata) resource's binary payload as the OAI-PMH metadata.acdhOeaw\oai\metadata\CmdiMetadataa specialization of theResMetadataadditionaly checking for the binary resource content schema.acdhOeaw\oai\metadata\TemplateMetadatacreates metadata based on flexible XML templates. More detailed description can be found here.
It's possible that you'll need to generate OAI-PMH metadata in (yet) another way.
In such a case you must develop your own class implementing the MetadataInterface.
Taking look at already existing implementations should be a good starting point.