hermes.model.api
================

.. py:module:: hermes.model.api


Classes
-------

.. autoapisummary::

   hermes.model.api.SoftwareMetadata


Module Contents
---------------

.. py:class:: SoftwareMetadata(data: Union[dict[str, hermes.model.types.ld_container.NATIVE_LD_CONTAINER], None] = None, extra_vocabs: Union[dict[str, str], None] = None)

   Bases: :py:obj:`hermes.model.types.ld_dict`


   An :class:`ld_dict` wrapper that has the standard context used by HERMES (:const:`ld_context.ALL_CONTEXTS`)
   and supports loading data from the HERMES cache.


   .. py:method:: load_from_cache(ctx: hermes.model.hermes_cache.HermesCacheManager, source: str) -> SoftwareMetadata
      :classmethod:


      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.

      :param ctx: The HERMES cache the data is loaded from.
      :type ctx: HermesCacheManager
      :param source: The directory the inside the cache the data is loaded from.
      :type source: str

      :returns: The SoftwareMetadata loaded from the cache.
      :rtype: SoftwareMetadata

      :raises HermesCacheError: If neither of the listed files contains valid data for a SoftwareMetadata object.



   .. py:method:: 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).

      :param ctx: The HERMES cache the data is written to.
      :type ctx: HermesCacheManager
      :param target_dir: The directory the inside the cache the data is written to.
      :type target_dir: str

      :rtype: None



