Query and export tooling for Things-derived data models (https://concepts.datalad.org)
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Michael Hanke 16ab373255
Some checks failed
Codespell / Check for spelling errors (push) Successful in 39s
Ruff / Code linting (push) Failing after 44s
Conventional commits / check-messages (push) Successful in 51s
Type annotation (project) / check (push) Successful in 1m26s
Unit tests (Linux) / check (push) Successful in 1m38s
fix: missing top-level import to match __all__
2026-09-01 12:30:36 +02:00
.forgejo/workflows ci: add type checking workflow 2026-08-26 15:28:29 +02:00
query_things fix: missing top-level import to match __all__ 2026-09-01 12:30:36 +02:00
.changelog.md.j2 fix: correct URL for changelog commit links 2026-08-26 14:53:54 +02:00
.gitignore chore: ignore coverage output 2026-08-26 14:53:47 +02:00
conftest.py test: more coherent test implementations 2026-08-27 14:38:05 +02:00
LICENSE doc: add license declaration, consistent with existing labels 2026-08-26 14:53:54 +02:00
pyproject.toml ci: enable commit testing for reals 2026-08-26 14:57:00 +02:00
README.md doc: record previous breaking change in user-facing location 2026-08-27 13:43:26 +02:00

query-things

Query, reshape, and export metadata represented using the Things data model.

query-things provides a small Python-based extraction layer for Things-compatible metadata backends. It selects records and properties, resolves linked objects, and converts graph-oriented metadata into structures that can be consumed by templates, websites, reports, catalogs, and other automated workflows. Its main purpose is therefore controlled denormalization: preserving the semantics of a linked metadata graph while making selected portions convenient to use in structured data workflows.

Supported operations

The following operations are supported via individual query-things subcommands:

Subcommand Synopsis
cache Read JSON lines from standard input, cache records by their pid, and pass the original input unchanged to standard output.
filter-linked-pid Keep input records whose pid appears in a specified property of one reference record fetched from a Things API.
filter-links-pid Keep input records that link to one or more specified PIDs through specified properties, optionally following links recursively.
inject-links-pid Find records that link to the current input record and inject those linker records into a named property.
inline-things Resolve PID references at one or more nested paths and replace them with fetched Things records.
render-record Render each input metadata record through a Jinja template and write the result to a filename derived from one or more filename templates.
list List records currently held in the record cache, optionally restricted by PID or schema class.

Upgrades from previous versions

inline-records

Early versions had this command. It has been replaced by inline-things. In all but one case, inline-things is a drop-in replacement for inline-records. Example where a -p options points to an association class records (e.g., an Attribution via attributed_to) with the object of interested is located under an object key. The former inline-records appended this automatically to, but inline-things does not. This makes the new command more flexible and also enables the support for inlining at arbitrary depth.

License

MIT