wfexs_backend.pushers.dataverse_export#

Module Contents#

Classes#

DataversePublisher

Class to model exporting results to Dataverse

API#

class wfexs_backend.pushers.dataverse_export.DataversePublisher(refdir: pathlib.Path, setup_block: SecurityContextConfig | None = None, default_licences: Sequence[LicenceDescription] = [], default_orcids: Sequence[ResolvedORCID] = [], default_preferred_id: str | None = None)#

Bases: wfexs_backend.pushers.abstract_token_export.AbstractTokenExportPlugin

Class to model exporting results to Dataverse

Initialization

PLUGIN_NAME: ClassVar[SymbolicName] = 'cast(...)'#
ENABLED: ClassVar[bool] = True#
ATOM_CONTENT_TYPE: Final[str] = 'application/atom+xml'#
SWORD_APP_NAMESPACE: Final[str] = 'http://www.w3.org/2007/app'#
SWORD_APP_PREFIX: Final[str] = 'app'#
ATOM_NAMESPACE: Final[str] = 'http://www.w3.org/2005/Atom'#
ATOM_PREFIX: Final[str] = 'atom'#
PURL_NAMESPACE: Final[str] = 'http://purl.org/dc/terms/'#
PURL_PREFIX: Final[str] = 'dcterms'#
SWORD_TERMS_NAMESPACE: Final[str] = 'http://purl.org/net/sword/terms/'#
SWORD_TERMS_PREFIX: Final[str] = 'st'#
DATAVERSE_VALID_LICENCES: Final[Set[str]] = None#
VALID_LICENCES_MAPPING: Final[Mapping[str, str]] = None#
XML_NS: Final[Dict[str, str]] = None#
_gen_headers() MutableMapping[str, str]#
__get_sword_opener() wfexs_backend.pushers.dataverse_export.AuthenticatedURLOpener#
_sword_get_collections() Mapping[str, str]#
_get_dataverse_collection_url(dataverse_id: str) str | None#
static _genLicenceText(licences: Sequence[LicenceDescription]) str#
get_pid_metadata(pid: str) Mapping[str, Any] | None#
get_pid_draftentry(pid: str) DraftEntry | None#

This method is used to obtained the metadata associated to a PID, in case the destination allows it.

_sword_book_entry(title: str | None = None, description: str | None = None, licences: Sequence[LicenceDescription] = [], resolved_orcids: Sequence[ResolvedORCID] = []) str | None#
book_pid(preferred_id: str | None = None, initially_required_metadata: Mapping[str, Any] | None = None, initially_required_community_specific_metadata: Mapping[str, Any] | None = None, title: str | None = None, description: str | None = None, licences: Sequence[LicenceDescription] = [], resolved_orcids: Sequence[ResolvedORCID] = []) DraftEntry | None#

This method is used to book a new PID, in case the destination allows it.

We can even “suggest” either a new or existing PID.

It can return both the internal PID as the future, official one. It also returns the associated internal metadata.

When it returns None, it means either the destination does not allow booking pids, either temporary or permanently

property _customized_book_pid_error_string: str#

This method can be overridden to provide more context

discard_booked_pid(pid_or_draft: str | DraftEntry) bool#

This method is used to release a previously booked PID, which has not been published.

When it returns False, it means that the provided id did exist, but it was not a draft

get_file_bucket_prefix(draft_entry: wfexs_backend.pushers.DraftEntry) str#

This is an accessory method which is used to build upload paths

_direct_upload_file_to_draft(draft_entry: wfexs_backend.pushers.DraftEntry, filename: str | IO[bytes], remote_filename: str | None, content_size: int | None = None) Mapping[str, Any]#

It takes as input the draft record representation, a local filename and optionally the remote filename to use

_form_upload_file_to_draft(draft_entry: wfexs_backend.pushers.DraftEntry, filename: str | IO[bytes], remote_filename: str | None, content_size: int | None = None) Mapping[str, Any]#
upload_file_to_draft(draft_entry: wfexs_backend.pushers.DraftEntry, filename: str | IO[bytes], remote_filename: str | None, content_size: int | None = None) Mapping[str, Any]#
__gen_sword_dataset_url(draft_entry: wfexs_backend.pushers.DraftEntry) str#
EXPORT_FORMATS: Final[Set[str]] = None#
_export_metadata_raw(draft_entry: wfexs_backend.pushers.DraftEntry, format: str = 'dcterms') bytes#

Get the metadata in SWORD format

_sword_book_revision(draft_entry: wfexs_backend.pushers.DraftEntry) DraftEntry | None#
update_record_metadata(draft_entry: wfexs_backend.pushers.DraftEntry, metadata: Mapping[str, Any] | None = None, community_specific_metadata: Mapping[str, Any] | None = None, title: str | None = None, description: str | None = None, licences: Sequence[LicenceDescription] = [], resolved_orcids: Sequence[ResolvedORCID] = []) Mapping[str, Any]#

This method updates the draft record metadata, both the general one, and the specific of the community. This one could not make sense for some providers. For non draft entries, it fails

publish_draft_record(draft_entry: wfexs_backend.pushers.DraftEntry) Mapping[str, Any]#

This method publishes a draft record, so its public id is permanent