datalad_tabby.io

Input/output and conversion routines for tabby-format metadata records

datalad_tabby.io.load_tabby(src: Path, *, single: bool = True, jsonld: bool = True, recursive: bool = True, cpaths: List | None = None) Dict | List[source]

Load a tabby (TSV) record as structured (JSON(-LD)) data

The record is identified by the table/sheet file path src. This need not be the root 'dataset' sheet, but can be any component of the full record.

The single flag determines whether the record is interpreted as a single entity (i.e., JSON object), or many entities (i.e., JSON array of (homogeneous) objects). Depending on the single flag, either a dict or a list is returned.

Other tabby tables/sheets are loaded when @tabby-single|many- import statements are discovered. The corresponding data structures then replace the import statement at its location. Setting the recursive flag to False disables table import, which will result in only the record available at the src path being loaded.

With the jsonld flag, a declared or default JSON-LD context is loaded and inserted into the record.