provit package¶
Subpackages¶
Submodules¶
provit.agent module¶
Everything agent profile related
- Classes
- Person
- SoftwareAgent
- Organization
Each class contains :to_json(): and :graph(): functions, returning the data of the classes either as json-dict or rdflib Graph.
- Helper functions
- load_agent_profile(slug) loads the yaml file of agent :slug: and initiates the respective agent class (depending on type)
- load_agent_profiles() loads all agent yaml files and returns a list of agent classes
- agent_factory(slug, type_) initializes an agent class of type :type_: with id/uri :slug:
-
class
provit.agent.
PersonAgent
(slug, name=[], institution=[], homepage=[], email=[], uri='')[source]¶ Bases:
object
-
class
provit.agent.
SoftwareAgent
(slug, name=[], version=[], homepage=[], uri='')[source]¶ Bases:
object
-
provit.agent.
agent_factory
(slug, type_)[source]¶ return “empty” agent class instance of the specified type
provit.cli module¶
provit.config module¶
provit configuration module
provides the Config-class as well as its factory method get_config.
By default, $HOME/.provit is assumed to be provits default config directory. This can be customized.
-
class
provit.config.
Config
(provit_dir: pathlib.Path, person: str = 'Person', software: str = 'SoftwareAgent', organization: str = 'Organization', base_uri: str = 'http://vocab.ub.uni-leipzig.de/provit/{}')[source]¶ Bases:
object
-
agents_dir
¶
-
base_uri
= 'http://vocab.ub.uni-leipzig.de/provit/{}'¶
-
directories_file
¶
-
organization
= 'Organization'¶
-
person
= 'Person'¶
-
software
= 'SoftwareAgent'¶
-
provit.home module¶
Helper functions for accessing data in the provit home directory
-
provit.home.
add_directory
(directory, directories_file=None)[source]¶ Add directory to project directories list
provit.namespaces module¶
provit.prov module¶
Provenance class handles provenance metadata information.
Use:
from pit.prov import Provenance
#load prov data for a file, or create new prov for file prov = Provenance(<filepath>)
#add provenance metadata prov.add(agent=”agent”, activity=”activity”, description=”…”) prov.add_primary_source(“primary_source”, url=”http://…”, comment=”…”) prov.add_sources([“filepath1”, “filepath2”])
#return provenance as json tree prov_dict = prov.tree()
#save provenance metadata into “<filename>.prov” file prov.save()
-
class
provit.prov.
Provenance
(filepath, namespace=None, overwrite=False)[source]¶ Bases:
object
Provenance class handles the provenance metadata graph
-
add
(agents, activity, description, started_at='', ended_at='')[source]¶ Add new basic provenance information (agent, activity) to file
-
add_primary_source
(primary_source, url=None, comment=None)[source]¶ Adds primary source (+ url and comment) to provenance information
-
add_sources
(filepaths, add_prov_to_source=True)[source]¶ Add provenance information from source file (wasDerivedFrom) to provenance graph If source file does not have valid provenance data, a prov graph for the source file is initialized
-
get_primary_sources
(root_entity=None)[source]¶ Returns the URIs of all primary sources in prov graph
-