Skip to content

doc ingest: --ontology replaces --model, --catalog names --entities (and takes a mapped table) - #2206

Merged
aaj3f merged 3 commits into
mainfrom
feat/doc-ontology-catalog-flags
Nov 2, 2026
Merged

aaj3f merged 3 commits into
mainfrom
feat/doc-ontology-catalog-flags

Conversation

@aaj3f

@aaj3f aaj3f commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

--model on fluree doc ingest has always named the ontology, which collides with pretty much every other "model" around it: fluree model (governance), [doc.llm] model (an LLM name), and, soon, the extraction model itself. So this renames it to --ontology outright, with no alias, which frees --model to name the extraction model in a follow-up. --catalog becomes a visible alias for --entities.

While I was in here, --entities / --catalog also learned to take a graph source mapped over a table (fluree iceberg|sql|delta map), alongside a ledger or a file. Before this, Opened::open in doc_sources.rs only checked ledger_exists, so a mapped source came back as "no such ledger". Now, when the name isn't a ledger but is a live graph source, its labels are read through fluree.graph(alias).query(), the same R2RML-aware path fluree query <graph-source> takes, and a mention keeps the IRI the mapping mints. That means a CRM or warehouse table can be the catalog directly, without exporting it to Turtle first.

Breaking: a script passing --model <ontology> to doc ingest now gets a usage error (exit 2) and needs --ontology <ontology>. I think that's the right call while the flag is this young, but it's worth a line in the release notes, hence the breaking-change label.

What changed:

  • fluree-db-cli/src/cli.rs: DocIngestArgs.model → ontology; entities gets visible_alias = "catalog", and the help text names the graph-source form.
  • fluree-db-cli/src/commands/doc.rs: the rename through setup_extraction, run_extraction and announce (the run header now reads ontology <source> (N classes, M properties)).
  • fluree-db-cli/src/commands/doc_sources.rs: the graph-source branch in Opened (is_graph_source, which reads as missing in a build without iceberg, so the error stays "no such ledger or graph source" there rather than a failed query).
  • Docs: docs/cli/doc.md and docs/unstructured/**.

Tests:

  • doc_ingest_catalog_names_the_entities_and_model_is_no_longer_the_ontology (integration.rs): --catalog gives the same scan as --entities, and --model is refused with exit 2.
  • doc_ingest_reads_a_catalog_from_a_mapped_table (delta_source.rs): maps the committed dim_store Delta fixture with skos:prefLabel over name, ingests a memo naming two stores, and checks both mentions point at http://example.org/store/{id}. I checked it isn't vacuous: with the graph-source branch disabled it fails with "no such ledger or graph source".
  • Ran cargo test -p fluree-db-cli --test integration doc_ (16 passed), --test delta_source (3 passed), --test docs_coverage (5 passed), and cargo clippy -p fluree-db-cli --all-targets --no-deps (clean). I haven't run the full workspace suite locally, so CI is the gate for everything else.

🤖 Generated with Claude Code

https://claude.ai/code/session_016CjYmSGfnxzJgMSzBESNee

`--model` on `fluree doc ingest` named the ontology, which collided with
every other "model" around it: `fluree model` (governance), `[doc.llm]
model`, and the extraction model itself. It is now `--ontology`, with no
alias, so `--model` is free to name the extraction model.

`--catalog` is a visible alias for `--entities`, and a catalog (or any
entities source) can now be a graph source mapped over a table (`fluree
iceberg|sql|delta map`) as well as a ledger or a file: its labels are read
through the mapping, and a mention keeps the IRI the mapping mints.

Breaking: scripts passing `--model <ontology>` to `doc ingest` must pass
`--ontology <ontology>`; the old spelling is a usage error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016CjYmSGfnxzJgMSzBESNee
@aaj3f aaj3f added enhancement New feature or request breaking-change Backwards-incompatible change; drives the Breaking Changes release-notes section area:cli fluree CLI UX, rdf toolkit, publish/export/insert flows labels Oct 29, 2026

@bplatz bplatz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. One inline note on which graph sources count as a catalog, and one for the follow-up.

For the follow-up that gives --model its new meaning: since --model <ontology> has been on doc ingest since v4.2.0, a script that isn't updated will pass an ontology path or ledger name where an extraction-model name now goes. A value that looks like an ontology source (an RDF file extension, or the name of an existing ledger) could get a pointed "did you mean --ontology?" rather than reaching the LLM endpoint as a model name.

Checked and sound:

  • sql and delta both imply iceberg, so the cfg!(feature = "iceberg") gate covers every table source.
  • A mapped table is read through fluree.graph(alias).query(), the path fluree query <graph-source> takes, and the Delta test checks the minted mention IRIs (and fails with the branch disabled).
  • The rename is complete: the --model mentions left in the docs are the iceberg|sql|delta map --model governance flag, a different command.

Comment on lines +156 to +164
async fn is_graph_source(fluree: &Fluree, id: &str) -> CliResult<bool> {
if !cfg!(feature = "iceberg") {
return Ok(false);
}
Ok(fluree
.nameservice()
.lookup_graph_source(id)
.await?
.is_some_and(|r| !r.retracted))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This accepts any live graph source, including BM25, vector and geo indexes, not only a table mapped through iceberg|sql|delta map. Passed as --catalog, one of those reaches the label queries through the mapping path, where it would either fail with an error about the mapping or come back with no labels, and the ingest would carry on with an empty gazetteer. Checking r.source_type against R2rml | Iceberg | Sql | Delta, and refusing the rest with a clear message (x is a BM25 index, not a mapped table), would keep the error where the help text points.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, and you're right: lookup_graph_source hands back any live record, so a BM25 index sailed through. In practice it failed with a misleading Ledger not found: memos-text:main rather than the empty gazetteer, but either way the error was nowhere near the help text.

Fixed in 0c50148. Opened::open now checks r.source_type.kind() == GraphSourceKind::Mapped (so R2RML, Iceberg, SQL and Delta) and refuses the rest by what they are: memos-text is a BM25 full-text index, not a table mapped as a graph source; a source is a ledger, a file, or a graph source from fluree iceberg|sql|delta map. The test uses the memos-text index the first ingest builds, and I checked that it fails against the old check.

`--catalog` / `--entities` accepted any live graph source, so a BM25,
vector or geo index named there reached the label queries and failed with
an unrelated "Ledger not found". A source is now read only when its kind
is a mapped table (R2RML, Iceberg, SQL, Delta); an index is refused by
what it is: "memos-text is a BM25 full-text index, not a table mapped as a
graph source".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016CjYmSGfnxzJgMSzBESNee
@aaj3f

aaj3f commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bplatz! The inline one is fixed here (reply on the thread).

On the --model follow-up: agreed, and it's in #2207 now (9127613). A --model value that's an RDF file (.ttl, .nt, .jsonld, .json) or the name of a ledger in the project is refused before it gets anywhere near a model: --model onto.ttl looks like an ontology (an RDF file); did you mean --ontology onto.ttl?. That catches the unchanged-script case. It also catches someone passing the same ontology to both flags, which would otherwise have gone to the LLM endpoint as a model name. Tests cover the file and ledger forms, and both fail without the check.

@aaj3f
aaj3f merged commit f129165 into main Nov 2, 2026
19 checks passed
@aaj3f
aaj3f deleted the feat/doc-ontology-catalog-flags branch November 2, 2026 22:09
@aaj3f aaj3f mentioned this pull request Nov 4, 2026
bplatz added a commit that referenced this pull request Nov 4, 2026
Brings #2247, #2232, #2246, #2248, #2245, #2230, #2205, #2231, #2255,
#2219, #2209, #2207, #2190, #2216, #2186, #2215, #2213, #2184, #2210,
#2206, #2198, #2187, #2183, #2200, #2193, #2199, #2196 and #2145 into next.

Resolutions:
- Novelty: main's fact-state trim (a cutoff plus a bounded sweep) and the
  dictionary's coverage watermark sit on next's graph slots and per-graph
  OrdMaps. A commit's reification links count toward coverage. Planner
  stats from segment sums decline under annotations, whose link deltas
  only the walk counts, and otherwise carry the indexed link counts.
- Stats-view identity: the index root's id reaches the snapshot through
  next's root decoder (`decode` takes the id, as `take_snapshot_metadata`
  does). `LedgerState::load_record` has a decoding-root form beside
  `load_decoding_root`.
- Transact: #2184's parallel-relationship check runs in next's link
  cascade, counting the `rdf:reifies` links on the retracted edge that the
  transaction does not retract itself. Main's bundle `edge_reifiers` is
  dropped, and `subjects_with_prior_rows` and
  `enforce_single_target_reifiers` stay deleted. The upsert pre-check
  takes main's dictionary probe and bounded seek.
- Query: geo search resolves the graph's POST tree once at open (pooled
  graphs keep their filter), an empty manifest when there is none.
  `branch_or_none` reads the dedicated branch, and the batched joins keep
  next's pooled lanes. The stats-view key hashes the root id.
- Indexer: `apply_dict_novelty` and `compact_forward_streams` take the
  cycle's compaction budget, so the term dictionary keeps its reserved
  share. `Prefetched` holds `ContentBytes`. `relocalize_sorted_commit`
  rewrites next's 20-byte types records.
- Disk cache: main's in-flight write registration, with an empty entry
  still read as crash debris that a write replaces. The process-wide
  eviction walk stays removed.
- Graph import (#2232): fenced CAS and publishes, the seed carries the
  record's namespace and fence, 32-bit graph ids and next's loaders. An
  import into a graph of an existing ledger refuses triple terms and edge
  annotations: the splice merges no triple-term dictionary yet.
- Iceberg: `create_iceberg_graph_source` goes with main (a source needs a
  mapping); the R2RML path keeps next's `model_instance`.
- CLI: main's shared import flags without the leaflet flags; `graph
  import` routes through next's process-wide server routing, and
  `upload_source_import` serves next's `Destination`. Doc sources read a
  ledger through the command's open instance.
- Tests: sibling ledger ids become distinct names, `genesis_ledger` is
  awaited, Cypher state dumps include each relationship's `rdf:reifies`
  link, and the graph-import arena test checks the refusal instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli fluree CLI UX, rdf toolkit, publish/export/insert flows breaking-change Backwards-incompatible change; drives the Breaking Changes release-notes section enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants