hermes.commands.process.base
Attributes
Type description for the iri of a JSON-LD property or object type (or None indicating a 'joker') |
|
Type description for mapping PropertyTypeIRIs to MergeActions |
|
Type description for mapping ObjectTypeIRIs to PropertyStrategies |
Classes
Base plugin that defines additional merge strategies. |
|
Generic deposition settings. |
|
Process the collected metadata into a common dataset. |
Module Contents
- type hermes.commands.process.base.TypeIRI = str | None
Type description for the iri of a JSON-LD property or object type (or None indicating a ‘joker’)
- type hermes.commands.process.base.PropertyStrategies = dict[TypeIRI, MergeAction]
Type description for mapping PropertyTypeIRIs to MergeActions
- type hermes.commands.process.base.ObjectStrategies = dict[TypeIRI, PropertyStrategies]
Type description for mapping ObjectTypeIRIs to PropertyStrategies
- class hermes.commands.process.base.HermesProcessPlugin
Bases:
hermes.commands.base.HermesPluginBase plugin that defines additional merge strategies.
- __call__(command: HermesProcessCommand) dict[str | None, dict[str | None, hermes.model.merge.action.MergeAction]]
Execute the hermes process plugin self.
- Parameters:
command (HermesProcessCommand) – The command being executed.
- Returns:
The merge strategies.
- Return type:
dict[str | None, dict[str | None, MergeAction]]
- class hermes.commands.process.base.ProcessSettings(/, **data: Any)
Bases:
pydantic.BaseModelGeneric deposition settings.
- class hermes.commands.process.base.HermesProcessCommand(parser: argparse.ArgumentParser)
Bases:
hermes.commands.base.HermesCommandProcess the collected metadata into a common dataset.
- args
The namespace that was returned by the command line parser when reading the arguments.
- Type:
Namespace
- __call__(args: argparse.Namespace) None
Execute the hermes command self.
- Parameters:
args (Namespace) – The namespace that was returned by the command line parser when reading the arguments.
- Return type:
None
- Raises:
MisconfigurationError – If it was explicitly configured that no process plugin should be run.
MisconfigurationError – If no harvesters have been configured to be used.
- add_strategies_to_merge_doc(merge_doc: hermes.model.merge.container.ld_merge_dict, prov_doc: hermes.model.provenance.ld_prov.ld_prov_list | None) tuple[hermes.model.types.ld_dict | None, hermes.model.types.ld_dict | None]
Adds strategies to the merge doc that are generated by the process plugins and add provenance information to the prov_doc.
- Parameters:
merge_doc (ld_merge_dict) – The merge_doc the strategies are to be added to.
prov_doc (ld_prov_list | None) – The provenance document where the information is to be recorded.
- Returns:
- The object of the last merge of strategies and the object of the
merged strategies.
- Return type:
- Raises:
HermesPluginRunError – If all plugin runs failed.
- merge_data_from_harvesters(merge_doc: hermes.model.merge.container.ld_merge_dict, harvester_names: list[str], prov_doc: hermes.model.provenance.ld_prov.ld_prov_list | None, strategy_action: hermes.model.types.ld_dict | None, merged_strategies: hermes.model.types.ld_dict | None) tuple[hermes.model.types.ld_dict | None, hermes.model.types.ld_dict | None]
Load data from the harvest plugins and merge it and then add provenance information to the prov_doc.
- Parameters:
merge_doc (ld_merge_dict) – The merge_doc the strategies are to be added to.
harvester_names (list[str]) – The harvesters whoose data is to be loaded and merged.
prov_doc (ld_prov_list | None) – The provenance document where the information is to be recorded.
strategy_action (ld_dict | None) – The last action merging strategies (prov object).
merged_strategies (ld_dict | None) – The result of the strategy merges (prov object).
- Returns:
The object of the last merge and the object of the merged data.
- Return type:
- Raises:
RuntimeError – If a merge failed.
RuntimeError – If data from all harvesters couldn’t be loaded.
- load_prov_doc() hermes.model.provenance.ld_prov.ld_prov_list | None
Loads the provenance document of the harvest step.
- Returns:
The loaded provenance document or None if the load failed.
- Return type:
ld_prov_list | None