hermes.model.provenance.ld_prov
Classes
ld_list with special features for internal provenance collection. |
Module Contents
- class hermes.model.provenance.ld_prov.ld_prov_list(data: hermes.model.types.ld_container.EXPANDED_JSON_LD_VALUE = [{'@graph': []}], *, parent: hermes.model.types.ld_dict | hermes.model.types.ld_list | None = None, key: str | None = PROV_DOC_IRI, index: int | None = None, context: list[str | hermes.model.types.ld_container.JSON_LD_CONTEXT_DICT] | None = ALL_CONTEXTS)
Bases:
hermes.model.types.ld_listld_list with special features for internal provenance collection.
- classmethod load_ld_prov_list(data: hermes.model.types.ld_container.EXPANDED_JSON_LD_VALUE) ld_prov_list
Create a new instance of an ld_merge_dict. See also
ld_dict.__init__().- Parameters:
data (EXPANDED_JSON_LD_VALUE) – The expanded json-ld data from which an ld_prov_list is restored.
- Returns:
The ld_prov_list loaded from the provided data.
- Return type:
- Raises:
RuntimeError – If an ld_prov_list has/ had been loaded before.
- next_node_iri(type: str) str
Create an iri for a new node of the given type.
- Parameters:
type (str) – The type of the new node
- Returns:
The generated iri.
- Return type:
str
- add_activity(*, data: hermes.model.types.ld_container.JSON_LD_VALUE = {}) hermes.model.types.ld_dict
Add a new provenance activity to the ld_prov_list using the provided additional data.
Hint: If no id was specified, one will be generated. Additionaly the types ‘prov:Activity’ and ‘schema:Action’ will be added.
- Parameters:
data (JSON_LD_VALUE) – The additional data for the activity.
- Returns:
The provenance activity as an ld_dict (can be used to update the data in the ld_prov_list).
- Return type:
- add_agent(*, data: hermes.model.types.ld_container.JSON_LD_VALUE = {}) hermes.model.types.ld_dict
Add a new provenance agent to the ld_prov_list using the provided additional data.
Hint: If no id was specified, one will be generated. Additionaly the types ‘prov:Agent’ and ‘schema:SoftwareApplication’ will be added.
- Parameters:
data (JSON_LD_VALUE) – The additional data for the agent.
- Returns:
The provenance agent as an ld_dict (can be used to update the data in the ld_prov_list).
- Return type:
- add_entity(*, data: hermes.model.types.ld_container.JSON_LD_VALUE = {}) hermes.model.types.ld_dict
Add a new provenance entity to the ld_prov_list using the provided additional data.
Hint: If no id was specified, one will be generated. Additionaly the types ‘prov:Entity’ and ‘schema:Thing’ will be added.
- Parameters:
data (JSON_LD_VALUE) – The additional data for the entity.
- Returns:
The provenance entity as an ld_dict (can be used to update the data in the ld_prov_list).
- Return type:
- add_hermes_settings(command: hermes.commands.base.HermesCommand) None
Add general settings of a hermes command run from the command object.
- Parameters:
command (HermesCommand) – The command object containing information on the run.
- Return type:
None
- add_settings_to_command(step: str, command: hermes.commands.base.HermesCommand) None
Add settings specific to the ran command from the command object.
ld_prov_list.add_hermes_settings()must be run before this function.- Parameters:
step (str) – The step of the settings should be recorded for.
command (HermesCommand) – The command object containing information on the run.
- Return type:
None
- add_hermes_plugin(step: str, name: str, plugin: hermes.commands.base.HermesPlugin, command: hermes.commands.base.HermesCommand) hermes.model.types.ld_dict
Add a new hermes plugin to the ld_prov_list using the provided additional data.
- Parameters:
step (str) – The step of the plugin.
name (str) – The name of the plugin.
plugin (HermesPlugin) – The object of the plugin that will be executed.
command (HermesCommand) – The command object containing information on the run.
- Returns:
The provenance entity of the plugin (can be used to update the data in the ld_prov_list).
- Return type:
- shallow_search(query: Callable[[hermes.model.types.ld_dict], Any]) list[hermes.model.types.ld_dict]
Search the objects in the ld_prov_list for objects for which the query evaluates to True.
- get_hermes() hermes.model.types.ld_dict
Returns the hermes agent in the ld_prov_list.
- Returns:
The object representing the hermes agent.
- Return type:
- get_hermes_cache() hermes.model.types.ld_dict
Returns the hermes cache agent in the ld_prov_list.
- Returns:
The object representing the hermes cache agent.
- Return type:
- get_hermes_base_plugin(step: str) hermes.model.types.ld_dict
Returns the base plugin agent in the ld_prov_list of the given step.
- Parameters:
step (str) – The step of which the base plugin agent should be returned.
- Returns:
The object representing the base plugin agent of the given step.
- Return type:
- get_hermes_plugin(step: str, name: str) hermes.model.types.ld_dict | None
Returns the plugin agent in the ld_prov_list of the given step with the given name.
- Parameters:
step (str) – The step of which the plugin agent should be returned.
name (str) – The name of the plugin agent that should be returned.
- Returns:
The object representing the plugin agent of the given step with the given name.
- Return type:
ld_dict | None
- get_hermes_command(step) hermes.model.types.ld_dict
Returns the hermes command agent in the ld_prov_list of the given step.
- Parameters:
step (str) – The step of which the hermes command agent should be returned.
- Returns:
The object representing the hermes command agent of the given step.
- Return type: