OAI-PMH Producer
Using to provide RIF-CS
Minimal providers for Dublin Core and RIF-CS are included in the app.
To enable the app, include tardis.apps.oaipmh in
settings.INSTALLED_APPS.
Your OAI-PMH query endpoint will be on: http://mytardis-example.com/apps/oaipmh/
Implementing your own providers
To allow multiple metadata formats (and types within them) the
tardis.apps.oaipmh.server.ProxyingServer handles all requests and
proxies them to the providers specified in
settings.OAIPMH_PROVIDERS.
You should extend tardis.apps.oaipmh.provider.base.BaseProvider
or one of the existing providers if you wish to extend the functionality in a
site-specific way.
- class tardis.apps.oaipmh.provider.base.BaseProvider(site)
A base provider which roughly implements the PyOAI interface for OAI-PMH servers.
Extend this if you’re writing your own provider for a new type or a different metadata format.
- getRecord(metadataPrefix, identifier)
Get a record for a metadataPrefix and identifier.
- Parameters:
metadataPrefix (string) – identifies metadata set to retrieve
identifier (string) –
repository-unique identifier of record
- Raises:
oaipmh.error.CannotDisseminateFormatError – if
metadataPrefixis unknown or not supported by identifier.oaipmh.error.IdDoesNotExistError – if identifier is unknown or illegal.
- Returns:
a
header,metadata,abouttuple describing the record.
- identify()
Retrieve information about the repository.
Returns an Identify object describing the repository.
- listIdentifiers(metadataPrefix, set=None, from_=None, until=None)
Get a list of header information on records.
- Parameters:
metadataPrefix (string) – identifies metadata set to retrieve
set (string) – set identifier; only return headers in set
from (datetime) – only retrieve headers from from_ date forward (in naive UTC)
until (datetime) – only retrieve headers with dates up to and including until date (in naive UTC)
- Raises:
error.CannotDisseminateFormatError – if metadataPrefix is not supported by the repository.
error.NoSetHierarchyError – if the repository does not support sets.
- Returns:
an iterable of headers.
- listMetadataFormats(identifier=None)
List metadata formats supported by repository or record.
- Parameters:
identifier (string) – identify record for which we want to know all supported metadata formats. If absent, list all metadata formats supported by repository.
- Raises:
error.IdDoesNotExistError – if record with identifier does not exist.
error.NoMetadataFormatsError – if no formats are available for the indicated record.
- Returns:
an iterable of
metadataPrefix,schema,metadataNamespacetuples (each entry in the tuple is a string).
- listRecords(metadataPrefix, set=None, from_=None, until=None)
Get a list of header, metadata and about information on records.
- Parameters:
metadataPrefix (string) – identifies metadata set to retrieve
set (string) – set identifier; only return records in set
from (datetime) – only retrieve records from
from_date forward (in naive UTC)until (datetime) – only retrieve records with dates up to and including until date (in naive UTC)
- Raises:
oaipmh.error.CannotDisseminateFormatError – if
metadataPrefixis not supported by the repository.oaipmh.error.NoSetHierarchyError – if the repository does not support sets.
- Returns:
an iterable of
header,metadata,abouttuples.
- listSets()
Get a list of sets in the repository.
- Raises:
error.NoSetHierarchyError – if the repository does not support sets.
- Returns:
an iterable of setSpec, setName tuples (strings).
- writeMetadata(element, metadata)
Create XML elements under the given element, using the provided metadata.
Should avoid doing any model-lookups, as they should be done when creating the metadata.
- Parameters:
element (lxml.etree.Element) – element to put all content under (as SubElements)
metadata (oaipmh.common.Metadata) – metadata to turn into XML
- Raises:
NotImplementedError – not implemented
- class tardis.apps.oaipmh.server.ProxyingServer(providers)
- getRecord(metadataPrefix, identifier)
Get a record for a metadataPrefix and identifier.
- Raises:
oaipmh.error.CannotDisseminateFormatError – if no provider returns a result, but at least one provider responds with
oaipmh.error.CannotDisseminateFormatError(meaning the identifier exists)oaipmh.error.IdDoesNotExistError – if all providers fail with
oaipmh.error.IdDoesNotExistError
- Returns:
first successful provider response
- Return type:
response
- identify()
Retrieve information about the repository.
- Returns:
an
oaipmh.common.Identifyobject describing the repository.- Return type:
oaipmh.common.Identify
- listIdentifiers(metadataPrefix, **kwargs)
Lists identifiers from all providers as a single set.
- Raises:
error.CannotDisseminateFormatError – if
metadataPrefixis not supported by the repository.error.NoSetHierarchyError – if a set is provided, as the repository does not support sets.
- Returns:
a
set.Setof headers.- Return type:
- listMetadataFormats(**kwargs)
List metadata formats from all providers in a single set.
- Raises:
error.IdDoesNotExistError – if record with identifier does not exist.
error.NoMetadataFormatsError – if no formats are available for the indicated record, but it does exist.
- Returns:
a frozenset of
metadataPrefix,schema,metadataNamespacetuples (each entry in the tuple is a string).- Return type:
- listRecords(metadataPrefix, **kwargs)
Lists records from all providers as a single set.
- Raises:
error.CannotDisseminateFormatError – if
metadataPrefixis not supported by the repository.error.NoSetHierarchyError – if a set is provided, as the repository does not support sets.
- Returns:
a
set.Setofheader,metadata,abouttuples.- Return type:
- listSets()
List sets.
- Raises:
oaipmh.error.NoSetHierarchyError – because set hierarchies are currrently not implemented