svar
svar runs the queries people already write as they are. With each result it returns what the result means: whether it was answered, empty or never reached, where it came from, and how much was left unread. The name is "answer" in Swedish, Norwegian and Danish; expanded, it reads Staged Verdicts, Answers and Residue.
svar hosts existing query languages instead of replacing them. It composes queries into plans across many sources and checks, before any request, whether each source can do what it is asked. Every step returns a verdict beside its rows.
Status
Milestones M1 to M4 are built. Plans in the HFQ (Hegel Federated Query) core grammar are parsed, checked against a source registry, and run. A plan is refused before contact when a source cannot do what a step asks. A plan that passes runs step by step through adapters, and each step returns a verdict beside its rows. The adapters reach local Resource Description Framework (RDF) files, endpoints of the SPARQL Protocol and RDF Query Language (SPARQL), REST (Representational State Transfer) interfaces, triple pattern fragments and identifier maps.
-
M2: hosted SPARQL leaves are sent as written, and their needs are read from their algebra. A differential harness verifies declared capabilities against a local reference engine.
-
M3: stages make absence claimable. Aggregates report a bound and the residue, filters get controls that can fail, and two routes measure their divergence. The budget is allocated by water-filling, and two runs are compared only under equal stage keys.
-
M4: values are decided by margin against a threshold set from an error budget, over candidates frozen before anything is read. Witnesses read passages for observations, copies of one text count once, and a language model may propose candidates, cues and claims. What it writes is recorded and never counts as evidence; its claims are checked against sources, and prose written from the answer records is checked sentence by sentence.
Types and projection let a graph source witness an expectation beside text sources (decision 0010). A catalogue of tested registry entries for ten public services (Rhea, UniProt, UniProtKB, KEGG, ChEBI, the Ontology Lookup Service (OLS4), PubChem, MetaNetX, Reactome, Europe PMC) lets another project start without writing its own.
Resolution and computation (M5) are next. The full design and the milestones are in the blueprint.
Install
pip install "svar-query[notebook]" # imports as `svar`; Python 3.11 or later; with pandas and spectacular-charts
The distribution is called svar-query because the name svar on the Python Package Index belongs to an
unrelated project.
In a notebook
import svar
svar.sources() # ready-made entries for public services
registry = svar.catalogue("kegg", "metanetx") # a registry, with no file
report = svar.run("""
plan first {
budget 20 requests
let chebi = from METANETX ask chebi_of_kegg("cpd:C00031") within 2
emit chebi with provenance
}
""", registry)
report # one row per step, with its verdict
report.frame() # as a pandas DataFrame
%load_ext svar adds the %%svar cell magic: the cell holds a plan, and --sources kegg,metanetx
names the catalogue entries it asks. Charts are drawn with
spectacular-charts: report.edges() is the plan's
dataflow for a layers chart, and report.frame("a", "b") stacks the rows of several steps.
jupyter/00-quickstart.ipynb runs a full example against the live services.
In a project
cargo install --git https://git.uni-greifswald.de/sachikonyk/svar svar-cli
svar sources # the catalogue
svar init . --sources kegg,metanetx,rhea # writes svar/registry.toml, svar/plans/first.svar
svar run svar/plans/first.svar --registry svar/registry.toml --out svar/runs/first
svar.init(".", ["kegg", "metanetx"]) does the same from Python. The usage guide
covers plans, verdicts, a project's own records as a source, adding sources, and decisions from
evidence. The extensions page pairs each extension of the Data
Catalog Vocabulary application profiles (DCAT-AP-PLUS) with the catalogue entries that serve its open
values.
Layout
crates/: the Rust workspace, where all computing happens (svar-core,svar-lang,svar-engine,svar-exec,svar-adapters,svar-cli, andsvar-pyfor the Python bindings).src/svar/: the Python package, a thin layer over the extension module for prototyping and notebooks.src/svar/examples/: example plans, a registry of declarations, and infixtures/small sources that run offline.jupyter/: demonstration notebooks.
Build
Requires a Rust toolchain and uv.
cargo test # the Rust core
uv sync # builds the Python extension with maturin
uv run pytest # the Python layer
cargo run -p svar-cli -- check src/svar/examples/hfq-enzymes.svar --registry src/svar/examples/registry.toml
cargo run -p svar-cli -- run src/svar/examples/hfq-enzymes.svar --registry src/svar/examples/fixtures/registry.toml --out runs/hfq
cargo run -p svar-cli -- run src/svar/examples/staged.svar --registry src/svar/examples/fixtures/registry.toml --out runs/staged
cargo run -p svar-cli -- replay runs/staged
cargo run -p svar-cli -- verify src/svar/examples/verify.toml --registry src/svar/examples/fixtures/registry.toml
cargo run -p svar-cli -- run src/svar/examples/midazolam.svar --registry src/svar/examples/fixtures/midazolam-registry.toml --out runs/midazolam
Example
$ svar check src/svar/examples/refused.svar --registry src/svar/examples/registry.toml
plan pathway_counts sha256:f5907c41…
outcome: refused-statically (0 requests issued)
refused S1 counts: `counts` needs {agg, link} from `KEGG`, which declares {lookup, link}
$ svar run src/svar/examples/baseline.svar --registry src/svar/examples/fixtures/registry.toml --out runs/baseline
plan baseline sha256:1ba483da…
outcome: completed (8 requests issued)
verdict: answered
acids answered 4 rows
rxns answered 5 rows
ecs answered 5 rows
kids answered 5 rows
paths answered 5 rows
record: runs/baseline/record.jsonl (28 acts)
From Python:
import svar
report = svar.check(open("src/svar/examples/hfq-enzymes.svar").read(), "src/svar/examples/registry.toml")
report["outcome"], report["requests_issued"] # ('well-capable', 0)
run = svar.run(open("src/svar/examples/baseline.svar").read(), "src/svar/examples/fixtures/registry.toml", "runs/py")
run["verdict"]["verdict"], run["requests_issued"] # ('answered', 8)
License
MIT; the full text is in the license file at the repository root.
Metadata
Release files for svar-query 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| svar_query-0.1.0.tar.gz | 194.7 kB | Without provenance | Details for svar_query-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| svar_query-0.1.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for svar_query-0.1.0-cp311-abi3-win_amd64.whl |
| svar_query-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for svar_query-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| svar_query-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for svar_query-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| svar_query-0.1.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for svar_query-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
| svar_query-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for svar_query-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 27.2 MB
Release files / svar_query-0.1.0.tar.gz
| Download URL | svar_query-0.1.0.tar.gz |
|---|---|
| Size | 194.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
639d7e615a8a8c4c89dd8cb08854314368fd96cb8606afd386e5c145a373e616
|
|
BLAKE2b-256 checksum How to use checksums |
a349ab4c28a83ae88a3e3d3125685439b7d864053a17ff60177388a6a33431d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / svar_query-0.1.0-cp311-abi3-win_amd64.whl
| Download URL | svar_query-0.1.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
205bed8c6e24595e3fba99039013eee9553d4afc7fab634b8cd54bdd1472656e
|
|
BLAKE2b-256 checksum How to use checksums |
633f60a4f8942984c09cfaeca1c83226e36492008269c382ae11a3d55bac6878
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / svar_query-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | svar_query-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
35d8c7ea0f5b164cd77bdba49dedca29ed0227ef07b04878db8f604892cf3069
|
|
BLAKE2b-256 checksum How to use checksums |
f15dc7d217644cfd8b26c19e2cf3642e40b6c7783f4d61400a1f6855b476668a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / svar_query-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | svar_query-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
114ba6d450a126b04bc386f44512156c4a2956982fbfb668352b18e293910c98
|
|
BLAKE2b-256 checksum How to use checksums |
351865bb133984f021480de32f5be019b7ad140841d9848cd872d093dc597c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / svar_query-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | svar_query-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.5 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
298dc80b0575aa7bff81433e37c6d381a8113a0759121fa5dff5b0abec840a43
|
|
BLAKE2b-256 checksum How to use checksums |
cc29c9e85a12db53479f1b496a9d1a9d898b23681ce78510b30c22f23d319901
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / svar_query-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | svar_query-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.7 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
bd750106eefde97079e9bb6324a62d444dd68b67644272e2ab1e6b091102b459
|
|
BLAKE2b-256 checksum How to use checksums |
2ff50fda94dfc6a5b2d7a54ecc87ecf16b357288a9a436a478d7ec76df0c3518
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for svar-query 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.