/rete-graph:rete-publishfrom rete — cloud-native RDF graphs
Publishes a built .rete dataset to the rete playground: generates Parquet/DuckDB/SQLite companions, uploads to Cloudflare R2, registers in the catalog, and verifies the public Range/CORS contract.
Ships in rete — cloud-native RDF graphs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
.rete dataset to the playgroundAfter rete-from-graph produces and verifies data/foo/foo.rete (the .rete
lives WITH its dataset, not in web/), this workflow makes it available in the
browser playground:
build companions -> upload to R2 -> register catalog -> rebuild -> verify -> back up
data/foo/foo.rete. The browser fetches only the ranges each
query touches. The file never needs to enter web/.docs/playground.html with scripts/build_playground.py. This is the ONLY case
that needs the file in web/ — copy it there as a staging step
(cp data/foo/foo.rete web/foo.rete) just before the playground rebuild.Both modes are mirrored in R2 so users can cache or lazy-load the graph.
Publish six-permutation files. rete build --permutations 3 produces a valid
0x05 file that every current reader answers identically — but a reader older
than the permutation mask refuses it outright (malformed container: expected 6 permutation sections, exit 1) on every path that returns rows. The playground,
the single-file explorers, the clients and every third-party copy of the engine
are exactly such a fleet. Six is the build default; keep it for anything that
gets a public URL, and treat --permutations 3 as a per-dataset choice for
consumers you control. rete info <file> reports the set before you upload.
The Explore tab can compare rete with DuckDB and SQLite over the same data:
python skills/rete-publish/scripts/make_companions.py data/foo/foo.nt -o data/foo/foo \
--parquet --duckdb --sqlite
For class-partitioned Wikidata-style layouts, model
scripts/rdf_to_entity_tables.py or scripts/rdf_to_property_tables.py.
Companions are optional.
# Defaults to foo/foo.rete.
skills/rete-publish/scripts/upload_bucket.sh data/foo/foo.rete
# Explicit object key and recursive companion prefix.
skills/rete-publish/scripts/upload_bucket.sh data/foo/foo.rete foo/foo.rete
skills/rete-publish/scripts/upload_bucket.sh data/foo/foo-tables/ foo
It runs the upload in a container (like everything else here); the host needs
only Docker. The uploader reads ACCESS_KEY_ID, SECRET_ACCESS_KEY, and
S3_API_ENDPOINT from the environment or the repository's gitignored .env.
Objects are public at https://data.graphplaza.com/<key> without a redirect or
token. The bucket defaults to rete; override it with RETE_BUCKET.
Edit web/playground-src/catalog.js. The full field reference and copy-paste
templates are in reference/catalog.md. Add:
datasets: {key, kind:"remote-lazy", url, label, description}. Omit url
for embedded data; remote URLs derive from
remoteBase/<key>/<key>.rete. Add textIndex: true if the file was built
with --text-index, and say so in the description — the gate compares the
flag to the prose, and the weekly catalog probe compares it to the header.datasetMeta: {triples, size, license, source, provenance}.datasetExtra: {icon, tags}.examples with family, label, view, columns, a useful tip, and
the SPARQL query. Add SHACL shapes where relevant.pmtiles metadata for a geographic dataset.companions metadata for DuckDB, Parquet, or SQLite.uv run python scripts/build_playground.py
This regenerates docs/playground.html. If an embedded dataset disappears,
check that its gitignored source file is staged under web/ before rebuilding.
rete card-url <url> and rete sparql-url <url> "<query>" for CLI-level
range-read checks.uv run python scripts/check_dataset_catalog.py --all. It checks exact
URLs (no redirects), 206, Range/CORS response headers, stable format byte,
file size, content hash, and web/datasets.lock.json.Content-Range in
Access-Control-Expose-Headers (it saves the open's footer read); curl alone
cannot prove that contract.A published file lives on exactly two disks, or it does not exist. This step
is not optional and it is not "later": the day it was first measured, 44 of 273
local .rete files (177.55 GB) existed on one disk — the whole OpenAlex
corpus among them, five ~30 GB works shards plus the 15.67 GB
openalex-authors.rete, the largest .rete ever built — on a volume with
195 GB free. R2 is a serving surface, not a safe: a bucket-level mistake, an
expired card or a bad aws s3 rm --recursive takes the only copy with it.
# After publishing one dataset — the normal case.
scripts/backup_to_hf.sh data/foo/foo.rete
# Plan first, upload nothing (also a pre-flight: non-zero if a source is unsound).
scripts/backup_to_hf.sh --source both --dry-run
# Whole-corpus sweep: every data/**/*.rete plus every .rete object on R2.
scripts/backup_to_hf.sh --source both
The two are not interchangeable, and the difference is the reason there must be two of them:
https://data.graphplaza.com/<key> answers an HTTP Range
request directly — 206 with Content-Range, no redirect — which is the
only thing the playground's default synchronous-XHR worker reader can consume,
and it benchmarks ~3.5× faster than the HF Space. The CORS policy puts
Content-Range in ExposeHeaders so the open probe can confirm the length
the file's header derives without a second request; without it the reader
still opens the file (one 4-byte footer read more), as it does on Zenodo.huggingface.co/buckets/<ns>/<bucket>/resolve/<file> (no revision segment)
does work, but it 302-redirects to a per-range-signed Xet-bridge CDN — and
a synchronous XHR cannot follow a 302. The CLI is fine; the browser is not.So HF is the durable backup, never a second origin. Never put a
huggingface.co/buckets/... URL in catalog.js.
One prefix, mirroring the R2 key layout exactly, so an object's identity is the same in both stores:
local data/<dataset>/<file>.rete
R2 <dataset>/<file>.rete -> https://data.graphplaza.com/<dataset>/<file>.rete
HF rete/<dataset>/<file>.rete -> hf://buckets/katospiegel/rete-public/rete/<dataset>/<file>.rete
The R2 key is the local path minus data/; the HF key is the R2 key under one
rete/ prefix (the bucket also holds non-.rete material, which is why the
prefix exists). Override the bucket with RETE_HF_BUCKET.
hf buckets cp returning 0 is not
evidence that the object landed whole; the size is read back out of the bucket
per object, and the run ends by re-listing and confirming every object in the
work list — the number worth quoting is of the form 297 objects present at
matching byte counts.mkdir lock. Two concurrent sweeps each passed
their own free-space check and then jointly exhausted the disk: two 56 GB pulls
took 68 GB. A free-space decision is only sound while one process is making it..rete must carry the 4-byte RETE magic at both ends — 8 bytes that
prove the file is whole end to end.# Whole corpus, read-only. Ends with
# verified N/N object(s) present at matching byte counts
# DRY RUN: planned=0 skipped=N unsound=0 ...
# planned=0 with N/N verified IS the all-clear; it exits non-zero if any local
# source is unsound, so it also works as a pre-flight before a real run.
scripts/backup_to_hf.sh --source both --dry-run
# One object.
hf buckets ls katospiegel/rete-public/rete/foo/foo.rete --recursive --json
Anything short of N/N is listed by key in dev/backup-hf/missing.txt; the logs
and the resume state live beside it in dev/backup-hf/.
.rete is a derived artifactStep 6 protects the graph. It does not protect the thing the graph was made
from, and those are not the same asset. The repo has withdrawn its pre-1.0
backwards-compatibility promise, so every published graph will be rebuilt at
least once — and a rebuild needs the source, not the output. getty-tgn was
lost exactly this way during the 0x02 → v5 migration: the .rete could no
longer be read and there was nothing left to rebuild it from.
Do this in the same sitting as step 6, for the same dataset:
# After publishing one dataset — the normal case.
scripts/backup_sources_to_hf.sh <dataset-dir> # e.g. davidrumsey-maps
# Plan only; prints file counts and GiB, uploads nothing.
scripts/backup_sources_to_hf.sh --all --dry-run
# Whole-corpus sweep.
scripts/backup_sources_to_hf.sh --all
A second prefix beside rete/, in the shape the hand-mirrored datasets already
use — do not invent a third:
local data/<dataset>/raw/<path> -> hf sources/<dataset>/<path> ("raw/" strips)
local data/<dataset>/<path> -> hf sources/<dataset>/<path>
raw/ disappears from the key because the datasets mirrored before the script
existed (cordis, dblp, ror, zenodo, graphontology, …) keep their source
archive at the top of the dataset directory and have no raw/ at all. A handful
of dataset directories map to a different bucket prefix — davidrumsey-maps →
davidrumsey, epfl-graph → graphontology, openalex →
semopenalex/2025-02-10 — because the bytes were uploaded by hand under those
names; the mapping exists so a sweep recognises them instead of writing a
second copy. scripts/backup_sources_to_hf.sh --all --list prints it.
raw/ is source, unfiltered. A .nt or .ttl in there
is a downloaded ontology, not something we generated.raw/, exclusion is by LANE, never by data-file extension — a
directory we generate into (nt/, nq/, ttl/, parquet*/, duckdb/,
sqlite/, tables/, companions/, turntables/, preview/, spill/,
logs/), plus *.rete, *.pmtiles and build scratch.Do not "improve" this back into an extension filter. That was the first cut
and it silently ate real sources: bne's three official .nt.bz2 dumps, jonas's
heurist.duckdb export, the WDQS harvest .nt behind wd-events /
wikidata-themes / dbpedia-themes, wd-tables' Q*.parquet, and
biblissima's shards/*.nt.gz. An extension says nothing about whether we
produced a file; only where it sits does.
Three directories break the default and the script encodes why:
data/_extras/ and data/playground/ are mirrored raw-like (the whole tree
is harvest output, with no raw/ lane to separate it from ours), and so is
data/datacite/, whose parquet-*/ is the canonical copy of 994M rows because
its 24-hour source links expired and the archives were never kept. Loose files
at the top of data/ — which find -maxdepth 1 -type d never sees, and which
include the entire source of causenet — go to sources/_root/ via the
_root pseudo-dataset.
The rules live in two rsync-style filter files the script writes into
dev/backup-sources/. They have to be files. hf buckets sync --exclude '*.rete' silently matches nothing — only directory-prefix patterns
like raw/** work as a command-line flag — while the identical pattern inside
--filter-from works. Every file-level rule therefore goes in the filter file.
hf buckets sync --ignore-times compares by byte
size only, so an object already in the bucket at the identical length is
skipped. --delete is never passed: the script only ever adds.mkdir lock in dev/backup-sources/.lock, for
the same reason as step 6.hf buckets sync, not per-file
hf buckets cp: davidrumsey alone is 449,247 files, which as individual
cp invocations would take days.openaire, orcid and crossref are on the skip list: their source tars are
already in the bucket under a hand-made snapshot-dated layout
(sources/openaire/2021-v3.0/, sources/orcid/2025/,
sources/crossref/public-data-file-2026-03/) and the local copies were deleted
afterwards to free disk. The bucket is the only copy — which is exactly the
outcome this step exists to produce.
If a dataset's source is neither on disk nor in the bucket, try the URL before calling it lost, and record the HTTP status you actually observed. Every "unrecoverable" claim checked during the first full sweep turned out to be false:
| claimed lost | reality |
|---|---|
databnf — "expiring transfert.bnf.fr links" | all 22 answer 200; 6.16 GiB re-fetched and mirrored, byte counts matched Content-Length |
getty-tgn — "lost in the 0x02 → v5 migration" | data/_extras/getty-tgn.ttl was on disk the whole time |
crossref | already in the bucket at sources/crossref/public-data-file-2026-03/ |
chemotion | GitHub LFS, 206, sha256 matched the pointer exactly |
ontoneurolog | the legacy unice.fr zip still answers 200 |
Two real gotchas when re-fetching: transfert.bnf.fr ignores Range (a
curl -r 0-1023 returns the whole file, so there is no resumable partial
fetch), and the filename lives only in Content-Disposition — capture it
rather than numbering the downloads. Keep the URL list next to the bytes in the
bucket: sources/databnf/urls.txt is what made that dataset recoverable at all.
Commit catalog.js, web/datasets.lock.json, the rebuilt
docs/playground.html, and any converter or companion scripts. Dataset files
and raw data/ remain gitignored; R2 holds the published bytes while the repo
holds their recipes. Commit without a co-author trailer.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/dataset-downloadAcquire and organize a NEW raw dataset under ./data/<name>/ before it becomes a .rete — investigate a source (download page, API, S3/Tigris bucket) to find ALL of its data, scaffold the standard folder layout (raw/ + scripts/ + README + checksums), download robustly (reproducible + resumable + parallel), follow manifest→asset links (nested-JSON URLs, .cif/.png/etc.), and document the schema. Use whenever the task is "download this dataset", "grab all the data from <site>", or "get <source> into ./data" — the step that feeds the rete-from-graph skill./rete-catalogFind, inspect, and open the published .rete datasets from the rete catalog — 60+ public knowledge graphs on range-readable hosting. Use when a task needs an existing dataset (query it, download it, federate it, wire it into an app) rather than building a new one./npx claudepluginhub caviri/rete --plugin rete-graphOther plugins' skills for the same job