Skip to content

Version 0.9.6

Choose a tag to compare

@zipproth zipproth released this 02 Jul 23:44

zelph 0.9.6

This release delivers the three pillars of the second Wikimedia Rapid Fund grant — transitive reasoning, qualifier support, and SPARQL-subset integration — plus a major contributed feature: sharding and partial loading of .bin networks.

SPARQL Query Support

zelph networks can now be queried with a substantial subset of standard SPARQL, implemented entirely in the embedded Janet scripting layer (sample_scripts/sparql.zph) on top of zelph's public API — the C++ core remains SPARQL-agnostic.

  • SELECT [DISTINCT], basic graph patterns (incl. ; / , lists and variable predicates)
  • Property paths: +, *, and / sequences (e.g. wdt:P31/wdt:P279*)
  • OPTIONAL, MINUS, UNION, FILTER comparisons (incl. str()), subqueries
  • GROUP BY + COUNT [DISTINCT], ORDER BY, LIMIT, PREFIX
  • Wikidata prefixes (wd:, wdt:, p:, ps:, pq:, wikibase:) resolve in the wikidata language independent of the current .lang setting
  • Optional per-phase profiling via %(set sparql-profile true)

📖 Documentation: https://acrion.github.io/zelph/sparql/

Native Transitive Closure Support

The core engine now computes transitive closures natively (Zelph::transitive_targets / transitive_sources, exposed to Janet as zelph/closure / zelph/closure-sources). On first use per predicate, a persistent adjacency index is built and cached next to the .bin file (.pidx.<id>); subsequent queries reuse it. The SPARQL evaluator additionally applies closure-intersection optimization for queries where multiple transitive steps constrain the same variable — the typical shape of disjointness-culprit queries.

Wikidata Qualifier Import

New command .wikidata-qualifiers <dump.json[.bz2]> [P-id ...] imports Wikidata's statement/qualifier layer into an already loaded network as reified statements built from ordinary nodes and facts:

<subject> p:<P> <statement>, <statement> ps:<P> <value>,
<statement> pq:<Pq> <value>, <statement> wikibase:rank wikibase:...Rank

Imports are idempotent and incremental; selective imports (listing specific qualifier properties) keep memory usage low. With the P11260 variant, the disjointness-violation queries from Doğan & Patel-Schneider (2024) run verbatim in zelph's SPARQL interface.

📖 Documentation: https://acrion.github.io/zelph/qualifiers/

Sharding and Partial Loading

.bin networks can now be loaded partially — by chunk selectors, via seek-based or sharded JSON manifests, with on-demand fetching and caching of remote shards (hf://, https://), and route selectors that resolve node IDs or names to the chunks containing them. New commands: .load-partial, .stat-file, .index-file; new helper: tools/emit_zelph_hf_v2.py.

Contributed by @chboishabba — many thanks for this substantial contribution!

📖 Documentation: https://acrion.github.io/zelph/sharding/

Prebuilt Databases

Prebuilt .bin files based on the 2026-03-09 Wikidata dump — full, pruned, and qualifier-extended (wikidata-20260309-all-P11260.bin) — are published on Hugging Face, along with sharded variants for partial remote loading (upload in progress).

Acknowledgments

The SPARQL subset, transitive reasoning, and qualifier support were funded by a Wikimedia Rapid Fund grant. Thanks to the Wikidata Ontology Cleaning Task Force and the Mereology Task Force for the discussions that shaped these features.