Knowledge base population

Command line interface for populating the HuCit knowledge base.

Usage:

hucitlib/populate.py –work=<cts_urn> –log-file=<path> –kb-config-file=<path> [–verbose]

Options:
--work=<cts_urn>

CTS URN of the work whose citation structure should be populated

–kb-config-file=<path> Path to the configuration file (overwrites default configuration). –log-file=<path> Path to the log file –verbose Turn on verbose logging

Example:
python hucitlib/populate.py –work=urn:cts:greekLit:tlg0011.tlg004

–log-file=hucitlib/data/tests/populate-tlg0011.tlg004.log –kb-config-file=hucitlib/config/virtuoso_local.ini

hucitlib.populate.download_text_structure(urn: str, basedir: str = '/home/docs/checkouts/readthedocs.org/user_builds/hucitlib/checkouts/latest/hucitlib/data/text_structures/', sample_size: Optional[int] = None) None

Example:

>>> download_text_structure('urn:cts:greekLit:tlg0012.tlg001')
hucitlib.populate.fetch_text_structure(urn: str, endpoint: str = 'http://cts.perseids.org/api/cts', stop_at: int = - 1) Dict[str, object]

Fetches the text structure of a given work from a CTS endpoint.

Parameters
  • urn (string) – the work’s CTS URN (at the work-level!, e.g.”urn:cts:greekLit:tlg0012.tlg001”)

  • endpoint (string) – the URL of the CTS endpoint to use (defaults to Perseids’)

Returns

a dict with keys “urn”, “provenance”, “valid_reffs”, “levels”

Return type

dict

hucitlib.populate.populate_text_structure(kb: hucitlib.kb.KnowledgeBase, work: surf.resource.Resource, ts: Dict) None

Short summary.

Parameters
  • kb (KnowledgeBase) – Description of parameter kb.

  • work (Resource) – Description of parameter work.

  • ts (Dict) – Description of parameter ts.

Returns

Description of returned object.

Return type

None