hermes.model.api
Classes
An |
Module Contents
- class hermes.model.api.SoftwareMetadata(data: dict[str, hermes.model.types.ld_container.NATIVE_LD_CONTAINER] | None = None, extra_vocabs: dict[str, str] | None = None)
Bases:
hermes.model.types.ld_dictAn
ld_dictwrapper that has the standard context used by HERMES (ld_context.ALL_CONTEXTS) and supports loading data from the HERMES cache.- classmethod load_from_cache(ctx: hermes.model.hermes_cache.HermesCacheManager, source: str) SoftwareMetadata
Loads the JSON_LD data from the given HermesCacheManager object at the given source.
Note that only data from “codemeta.json” or (“context.json” and “expanded.json”) is loaded where “codemeta.json” is preferred.
- Parameters:
ctx (HermesCacheManager) – The HERMES cache the data is loaded from.
source (str) – The directory the inside the cache the data is loaded from.
- Returns:
The SoftwareMetadata loaded from the cache.
- Return type:
- Raises:
HermesCacheError – If neither of the listed files contains valid data for a SoftwareMetadata object.
- write_to_cache(ctx: hermes.model.hermes_cache.HermesCacheManager, target_dir: str) None
Writes the JSON_LD data of self to the given HermesCacheManager object at the given target.
Note that data is written into “codemeta.json” (compacted value), “context.json” (context value) and “expanded.json” (expanded value).
- Parameters:
ctx (HermesCacheManager) – The HERMES cache the data is written to.
target_dir (str) – The directory the inside the cache the data is written to.
- Return type:
None