/rete-graph:rete-from-graphfrom rete — cloud-native RDF graphs
Converts graph-based data sources (RDF dumps, SPARQL endpoints, GeoJSON, CSV, OWL ontologies, Wikibase, GBIF, TEI, JSON APIs) into queryable .rete files. Covers source-to-N-Triples conversion, rete build flags, Docker-only build, and verification.
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 from any graph-based source.rete is a cloud-native, range-queryable RDF file format. The job is always the
same shape: get RDF out of the source, then rete build it. Most graph sources
are already RDF (or trivially become RDF), so the work is mostly getting clean
N-Triples and choosing the right build flags.
source ──▶ N-Triples/N-Quads ──▶ rete validate ──▶ rete build ──▶ rete verify/stats
(§1) (§2) (§3) (§4) (§5)
The golden rule:
rete buildingests RDF directly —.nt,.nq,.ttl, and.rdf/.owl/.rdfxml(RDF/XML — how most OWL ontologies ship), plus-for stdin. If the source is already one of those, skip conversion and build it as-is. You only write a converter for non-RDF sources (GeoJSON, CSV, JSON APIs, Darwin-Core, …).
Match the source to a recipe in reference/sources.md —
it has a concrete recipe + an existing pipeline to model on for each of (data/scripts/...
paths are rete's dataset pipelines, in the private caviri/rete-datasets repo):
| Source kind | Path to N-Triples |
|---|---|
RDF dump (.nt/.nq/.ttl/.rdf/.owl) | none — build it directly |
| OWL/XML (not RDF/XML) | scripts/owl_to_nt.py (owlready2) |
| SPARQL endpoint | scripts/sparql_to_nt.py (paginated CONSTRUCT/SELECT) |
| Wikibase / Wikidata slice | SPARQL or the truthy dump → NT |
| GeoJSON / shapefiles | hand-written WKT emitter → GeoSPARQL (see data/scripts/standalone/geoboundaries_to_nt.py) |
| Tabular / CSV / Parquet | a per-row triple emitter (see data/scripts/standalone/*_to_nt.py) |
| GBIF Darwin-Core archive | DwC-A → NT (see data/scripts/standalone/bioexplora_to_nt.py) |
| TEI / TEITOK corpus | XML → NT (see data/scripts/standalone/postscriptum_to_nt.py) |
| JSON API | per-entity harvest → NT |
Write converters as streaming N-Triples emitters (one <s> <p> <o> . line at a
time). Reuse the term/escape helpers from any scripts/*_to_nt.py. Model a clean,
small ontology (classes + a handful of object/datatype properties) so the schema
pyramid and the playground's schema view are meaningful.
Real-world dumps have malformed lines (stray >, trailing spaces in IRIs,
bad escapes). Run them through the validator before building:
python skills/rete-from-graph/scripts/nt_clean.py data/foo/raw.nt > data/foo/foo.nt
# then a parse-only check with the engine (no build):
skills/rete-from-graph/scripts/rete validate /work/data/foo/foo.nt
rete validate reports counts or fails with the exact parse error — always green
it before building. (See reference/verify.md.)
.reteThe build runs in the project's Docker image (rete-dev), against the compiled
binary. Use the wrapper so you don't memorize the incantation:
# the wrapper finds `rete` on PATH, else runs it in rete-dev against target/release/rete
# The .rete lives WITH its dataset, in data/<name>/ (NOT web/) — it's published
# to R2, and web/ is only a staging step for the few small EMBEDDED datasets.
skills/rete-from-graph/scripts/rete build /work/data/foo/foo.nt \
-o /work/data/foo/foo.rete --pyramid-algo types --label-index --card
Flag che-sheet (full detail + memory/large-build guidance in reference/build.md):
--pyramid-algo types — default choice for typed graphs: deterministic,
parallelizable, self-naming communities. Falls back to louvain when untyped.--label-index — the label index for entity search (rete search <prefix>, the
playground's "Find a term"): every labelled subject, people as "family, given".
Pass it for a publishable dataset: without it the file has no label index at all
(labels are no longer inside the pyramid). Works with --no-pyramid and
--memory-budget-mb. The SCHEMA section (classes, planner stats) is written by
default; --no-schema omits it.--card — embed the Dataset Card (counts, top predicates/classes, vocabularies,
--title/--license/--source/--description). Always pass it for a
publishable dataset.--text-index — full-text word index (rete search --contains). Add for
text-heavy graphs where content search matters; it grows the file.--type-predicate <FULL-IRI> — when the typing predicate isn't rdf:type
(e.g. Wikidata http://www.wikidata.org/prop/direct/P31). Pass the full IRI,
not a prefix — a prefixed form silently yields "0 typed classes".--no-pyramid — drop the pyramid (smaller, still fully queryable) for shards or
huge graphs where the single-threaded pyramid is the bottleneck.rete build a.nt b.nt ontology.ttl -o out.rete.A monolithic build holds the dictionary + index in RAM. If it OOMs:
--pyramid-algo types + --no-pyramid first (pyramid is the biggest section).--memory-budget-mb <N> --tmp-dir <spill> — the external build: chunks
the input to disk and merges in bounded RAM, producing ONE byte-identical
.rete of any size (proven: ORCID 1.3B triples → one 17.5 GB file @ 16 GiB).
For billion-scale runs follow the external-build playbook in
reference/build.md: emit NT to disk then build in a
DETACHED container, size the spill at about the output plus 2–4 B per
statement (it is compressed), resume a build killed in the permutations, and
verify/query the output with sparql-url (lazy), never plain sparql.--no-pyramid, and ship a folder +
manifest (federation). See data/scripts/standalone/build_databnf_shards.sh and
reference/build.md.skills/rete-from-graph/scripts/verify_rete.sh /work/data/foo/foo.rete
Runs rete info / rete stats / rete verify (content-hash) and a sample
rete sparql. For engine-level correctness on the codebase itself, the project's
differential oracle vs Oxigraph is the gold standard —
cargo test -p bench --test differential (see reference/verify.md).
Once built + verified, hand off to the rete-publish skill: generate Parquet/DuckDB/SQLite companions, upload to the bucket, and register the dataset (catalog entry, metadata, examples) so it shows up in the playground.
print() on Windows writes \r\n. Strip \r or open
output in binary; a stray \r in an IRI breaks the NT parser.rete-dev — it's at /work/target/release/rete
(the wrapper handles this). The image must have the repo built (cargo build --release)..rete in its dataset folder, data/<name>/<name>.rete — NOT
in web/. All of data/ is gitignored, so the file stays out of git; the
converter script lives in the repo and R2 holds the published bytes. web/ is
only a staging area for the handful of small EMBEDDED datasets that get base64
inlined into docs/playground.html (see rete-publish); everything remote-lazy
is served straight from R2 and never touches web/.reference/build.md (opens in a new tab)reference/sources.md (opens in a new tab)reference/verify.md (opens in a new tab)scripts/nt_clean.py (opens in a new tab)scripts/owl_to_nt.py (opens in a new tab)scripts/rete (opens in a new tab)scripts/sparql_to_nt.py (opens in a new tab)scripts/verify_rete.sh (opens in a new tab)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./rete-clientsSet up a rete client in a NEW project — Python, Pyodide/JupyterLite, JavaScript/Node, browser script-tag, your own wasm build, or Rust. Use when wiring .rete querying into an application, notebook, or script; covers install, a verified first query, and the per-runtime gotchas./rete-local-queryQuery a LOCAL .rete file efficiently — the lazy range-read path that opens a multi-GB file without loading it whole, which CLI commands are lazy vs read-whole, the tuning knobs (RETE_BLOCK_KB, RETE_LOCAL_LAZY_ABOVE_MB, the 256 MiB block-cache cap), how to preview a query's byte/RAM cost (rete cost / rete why), how to prove a memory bound, and the real memory-scaling limits at billion-triple scale. Use whenever a local query is slow, OOMs, or you need to bound/preview its I/O and RAM. Complements rete-sparql (which is about writing the query)./rete-publishPublish a built `.rete` dataset to the rete playground: generate optional Parquet/DuckDB/SQLite companions, upload files to Cloudflare R2, register the dataset in the catalog, and verify the public Range/CORS contract. Use after rete-from-graph has produced and verified a `.rete` whenever the task is to make a dataset explorable in the playground./rete-sparqlWrite correct SPARQL for .rete graphs — the supported SPARQL 1.1 surface, rete's extensions (OWL 2 QL reasoning, RDF-star, SERVICE federation, text index), result formats, and the recurring gotchas that silently return 0 rows. Use whenever authoring or debugging a SPARQL query against a .rete file, the playground, the Space API, or any client.npx claudepluginhub caviri/rete --plugin rete-graphOther plugins' skills for the same job