Repository navigation
doc read: read one file with an HTTP reader and print the reading - #2209
Conversation
`fluree doc read <FILE> --ontology O [--catalog C]... [--model ID] [--format jsonld|turtle|trig]` parses the file as `doc parse` does, reads it with the `[doc.reader]` that serves the model, and prints the reading in the shape `doc ingest` would commit. No ledger is written or needed: the reader comes from the project's config, else the global config, else FLUREE_DOC_READER_*; file sources need no project, a ledger source does. Stderr carries the counts, calls (and cache hits), what the reader billed, and its ontology notes. `trig` prints the structure graph in <doc> and the reading in <doc>/reading. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016CjYmSGfnxzJgMSzBESNee
arnaud-fluree
left a comment
There was a problem hiding this comment.
@aaj3f this is a good "hello world" for a reader, and at a design level no pushback: parse as parse does, run the same read_document as ingest, print only the graph on stdout, and let a file ontology or catalog work with no project. I ran it against the real Nakaya gateway with no .fluree/ at all, the reader coming from FLUREE_DOC_READER_* (FLUREE_DOC_READER_AUTH_HEADER=X-Fluree-API-Key works), in all three formats, with -o, from the cache and with --no-cache: the contract holds, including stdout staying empty on a reader error. Two headline notes.
(1) Against the real reader, what gets printed isn't yet "the same shape ingest would commit" in any useful sense: the reading stays in nakaya-proposal# terms (four nk:Occurrence, one nk:LocalEntity, no doc:Mention, no doc:sourceElement, and a printed @context with no nk prefix), and the receipt on stderr says 0 mention(s), 0 entities, 2 relation(s) for a successful read. The cause is #2207's empty profile table, which I've flagged there; what belongs to this layer is the receipt, which shouldn't announce zero for a reading it just printed eight nodes of. Inline at doc.rs:1535.
(2) Two of the body's statements about configuration don't match the code: in a project the global config is never consulted (I tried it: the project's [doc.reader] missing, the global one present, --model refused), and FLUREE_DOC_READER_* overrides field by field rather than acting as a fallback. Both predate this PR; this is the PR that documents them as a chain. Inline at docs/cli/doc.md:203.
Full review below:
✅ Approve.
The command does what it says, and the parts I probed hold: output assembled in memory and written in one go, so a reader error (a stub answering 500) leaves stdout at zero bytes with exit 1 and BrokenPipe is tolerated for | head; Opened::open(source, Option<&FlureeDir>) is the minimal change for "no project", a file works with no config directory at all (two runs with an empty HOME, two calls, nothing created) and a ledger says a ledger source needs a project (fluree init); and the TriG resolves, with doc:sourceElement of the reading declared in <doc>, and on a 131,683-character document three calls with part-N IRIs, rebased offsets and distinct source elements.
By weight:
- 🟠
doc.rs:1535: the receipt reports zero mentions for a reading it just printed (inline; the root cause is #2207's). - 🟠
reading.rs:346:to_graphlacks the #2211 workaroundparse_jsonldcarries, so a reader answering native JSON numbers printsnif:beginIndex "31"in Turtle and TriG; Nakaya answers typed, so it's correct there (inline). - 🟠
docs/cli/doc.md:203: the resolution rule as written isn't what the code does (inline). - 🟠
doc.rs:1557:-oto an unwritable path is validated after the billed call, and the error doesn't name the file (inline). - 🟡
integration.rs:7220:--no-cacheisn't asserted; the test stays green with the flag ignored (inline). - 🟡
reading.rs:367: the TriG tests only look at graph headers; swapping the two graphs stays green (inline). - 🟡
doc.rs:1495: an empty document is sent and billed (inline). - 🟡
docs/cli/doc.md:225: the offsets' reference is the parser's text, not the file, anddocs/unstructured/doesn't knowread(inline). - 👍
doc.rs:1557: stdout carries only the graph, errors included (inline).
Smaller notes: run_read doesn't print parsed.escalation_skipped ("deterministic tier only: …; raise --max-crops") or announce the vision model the way run_parse does (doc.rs:1388), so a PDF beyond --max-crops is read silently with the deterministic tier alone; a read-only parse cache fails with Permission denied (os error 13) and no path (before any call, which is good; pre-existing in parse); commands::doc::run keeps a DocAction::Read arm that lib.rs:997 makes unreachable, consistent with Parse but typed dead code; and the printed JSON-LD is expanded (full IRIs, @type as an array) under a prefix @context that doesn't apply, insertable as-is, so cosmetic.
Adherence to repo commitments:
- Patterns/abstractions: ✔
readreusesparse_fileanddoc_reader::read_documentrather than a third path;Opened::opentaking an optional project is the right seam.⚠️ the receipt counts a vocabulary the reader doesn't speak (inline). - Performance: ✔ one parse, one read, output assembled once; the reading cache makes the second format free.
- Deployment targets: ✔ n/a; the CLI is the only consumer. Live check against the Nakaya gateway below.
- Testing:
⚠️ the two integration tests run by name and pass, but two targeted mutations leave them green (inline), anddocs_coverageonly coversdocs/cli/, so thedocs/unstructured/gap isn't caught. - Conventions: ✔ conventional commits, fmt and clippy clean; the reference page is in
docs/cli/doc.md.
Verified locally at 3bf6eda41 (a private target dir): cargo test -p fluree-db-cli --test integration doc_read 2 passed, --test docs_coverage 5 passed, cargo test -p fluree-db-doc reader 22 passed, cargo fmt --check and cargo clippy -p fluree-db-doc -p fluree-db-cli --all-targets --no-deps clean. Two mutations, each restored: --no-cache ignored (green) and TriG graphs swapped (green). About fifteen probes against a local stub: cache hit on the second run, each format, insert into a ledger and FILTER(?b > 30) on the JSON-LD (integers are integers), an empty file, a binary file (not UTF-8, no call), a 500, -o to a bad path, project vs global config, empty HOME, a read-only cache, and a 131,683-character document in three calls. Live, two billed calls to fluree-nakaya-small (release fluree-small-5.2.5): jsonld, then turtle from the cache (1 from cache), then trig with --no-cache (billed again), then -o from the cache with an identical file; the four nif:anchorOf match text[begin:end] of fluree doc parse --format text exactly. Not exercised: a real 503 with Retry-After, fluree-nakaya-large, --cache, vision escalation and doc.remote inside read, and the full fluree-db-cli suite.
Approving so you can merge when ready, but I'd fold in the receipt and the doc wording before, and the to_graph retyping if #2212 doesn't land first.
|
|
||
| let usage = doc_reader::usage_note(&read.usage); | ||
| eprintln!( | ||
| "{} {} mention(s), {} entit{}, {} relation(s); {} call(s){}{}", |
There was a problem hiding this comment.
🟠 Should address: against the real reader this receipt says 0 mention(s), 0 entities for a reading it just printed.
Live, fluree doc read invoice.md --ontology ontology.ttl --catalog catalog.ttl --model fluree-nakaya-small printed eight nodes on stdout: four nk:Occurrence (one with nk:refersTo ex:daxin, the catalog link), one nk:LocalEntity, two rdf:Statement typed doc:Relation, one nk:ExtractionRun, all stamped doc:sourceDocument; and stderr said ✓ 0 mention(s), 0 entities, 2 relation(s); 1 call(s), 716 tokens. read_answer counts only doc:Mention / doc:Entity (reading.rs:160-175) and Nakaya writes neither, because #2207's PROFILES is empty. I've raised the profile on #2207, since it decides what ingest commits too.
What belongs here is the receipt. Until a profile exists, counting what was received (8 node(s) beside the typed counts, or instead of them when they're all zero) would stop the first thing a user sees from contradicting the second.
There was a problem hiding this comment.
Agreed, the first line a user sees shouldn't contradict the second. Two changes, one per layer:
- On doc ingest: read with an HTTP reader ([doc.reader], --model, --cache) #2207, 3ae66a7 now counts a mention by NIF type (
nif:RFC5147String/nif:String/nif:Phrase/nif:Wordwithnif:beginIndex) whatever the reader's own class is, so a reading like the one you ran reports its occurrences as mentions. - Here, 304a80c makes the receipt lead with what was received:
✓ N node(s): M mention(s), E entities, R relation(s); …. A reader whose terms we don't know yet still shows its whole reading, and the typed counts read as "among those" rather than as the total. The integration test asserts the new line.
|
|
||
| /// A reading (expanded JSON-LD nodes) as a graph, for printing it as | ||
| /// Turtle or TriG. | ||
| pub fn to_graph(nodes: &[Value]) -> Result<fluree_graph_ir::Graph> { |
There was a problem hiding this comment.
🟠 Should address: to_graph doesn't carry the #2211 workaround that request::parse_jsonld does, so the new turtle and trig outputs type a native-number offset as a string.
The nodes go straight to fluree_graph_json_ld::adapter::to_graph_events, which is where #2207's body locates the bug (process_literal typing {"@value": 0} as xsd:string); parse_jsonld retypes afterwards (request.rs:446-473), this path doesn't, and #2212 is still open. Observed with a stub answering native numbers, --format trig:
<urn:fluree:doc:memo.md> { # structure, through parse_jsonld
<urn:fluree:doc:memo.md-element-4> … nif:beginIndex 15 ; …
}
<urn:fluree:doc:memo.md/reading> { # reading, through to_graph
<urn:fluree:doc:memo.md/reading#o31-35> a doc:Mention ;
nif:beginIndex "31" ; nif:endIndex "35" ; …
}
Same file, same predicate, two datatypes; a fluree insert of that Turtle stores strings and FILTER(?b > 30) finds nothing, and a strict consumer (the reader itself, pySHACL in Nakaya's conformance suite) refuses "31" where it expects an integer. The nuance: Nakaya answers typed ({"@value": "13", "@type": xsd:integer}), and there the Turtle is right (nif:beginIndex 13, scores ^^xsd:double, checked live). So this bites a reader that writes native JSON numbers, which JSON-LD allows and which this PR's stub and #2219's Python fixture both do. a_reading_prints_as_turtle_and_trig (:536) only checks prefixes and graph names, so it wouldn't see it.
Until #2212 lands, extracting the loop at request.rs:455-470 into a retype_native_literals(&mut Graph) called from both sides, plus an assertion like ttl.contains("nif:beginIndex 0") / !ttl.contains("nif:beginIndex \"0\""), would close it; once #2212 is in, both workarounds go together. If #2212 merges first, this is just the assertion.
There was a problem hiding this comment.
Good catch. #2212 hasn't landed, so I did the extraction you suggested. In 304a80c the loop from parse_jsonld is now request::retype_native_literals(&mut Graph), and to_graph calls it too, so both graphs in a TriG come out the same way. Both sides go together when #2212 is in.
Two assertions pin it. a_native_json_number_prints_as_a_number (an occurrence with {"@value": 31} and a score of 0.5, checking beginIndex 31 and no "31" / "0.5") covers the crate. And the integration run's --format trig now checks beginIndex 31 and not beginIndex "31", since the stub writes native numbers.
|
|
||
| ## fluree doc read | ||
|
|
||
| Parses one file as `parse` does, reads it with the [HTTP reader](#an-http-reader) that serves `--model`, and prints the reading: mentions linked to catalog records, entities, and claims, each anchored to the text's offsets, in the same shape `ingest` would commit. No ledger is written or needed. The reader comes from the project's `[doc.reader]` when there is a project, else the global config's, else `FLUREE_DOC_READER_*`; files as ontology and catalog need no project, a ledger does. |
There was a problem hiding this comment.
🟠 Should address: the resolution rule here isn't what the code does, on two points.
"the project's [doc.reader] when there is a project, else the global config's, else FLUREE_DOC_READER_*":
- In a project the global config is never read.
run_readcallsresolve_config(dirs)(doc.rs:1442), which readsdirs.config_dir()only, andfind_or_global_fluree_dir(config.rs:100) returns the project as soon as there is one. I tried it: a globalconfig.tomlwith[doc.reader] models = ["stub-reader"],fluree initin a folder,fluree doc read … --model stub-readerthere answerserror: --model stub-reader: no [doc.reader] lists it in models; the same command outside the project works. Someone who configured the reader once in their home, which is what the body sells, loses it on entering any project. - The environment isn't a fallback, it overrides field by field.
ReaderEndpoint::apply_env(fluree-db-doc/src/config.rs:200-224) replacesurl,api_key,auth_header,modelsandcacheindividually, soFLUREE_DOC_READER_URL=Bbeside a project[doc.reader]withurl = A, api_key = Ksends the project's keyKtoB, with the project'smodelslist. That's doc ingest: read with an HTTP reader ([doc.reader], --model, --cache) #2207's behaviour, consistent with the LLM slots; this is the PR that describes it as a chain.
Saying what the code does would be enough: "the [doc.reader] of the project when there is one, of the global config otherwise; FLUREE_DOC_READER_* overrides any of its fields". If the project-then-global fallback is what you want, that's a change in resolve_config, not in the docs.
There was a problem hiding this comment.
You're right on both points, and thanks for actually trying the global-config case. I went with saying what the code does rather than changing resolve_config. A project-then-global fallback for [doc.reader] alone would make the reader slot behave unlike [doc.llm] / [doc.vlm] / [doc.embedding], and I'd rather not have one slot with its own resolution rule.
304a80c rewrites the paragraph: the reader is "the [doc.reader] of the project when there is one, and of the global config otherwise (a project's config is read alone, not merged with the global one); FLUREE_DOC_READER_* overrides any of its fields one by one, so setting only FLUREE_DOC_READER_URL still sends the configured key and models." The last clause is there because of the URL-B-with-key-K case you described, which I think is the more surprising half. The new book page (docs/unstructured/cli/read.md) says the same. If we want project-then-global across all the [doc] slots, I think that's worth its own discussion, since it changes ingest and parse too.
| eprintln!(" {} ontology {note}", "·".dimmed()); | ||
| } | ||
| match &args.output { | ||
| Some(target) => std::fs::write(target, out)?, |
There was a problem hiding this comment.
🟠 Should address: -o to a path that can't be written is discovered after the billed call, and the error doesn't name the file.
Nothing validates --output before the read. Observed: fluree doc read docs/memo.md … -o /nonexistent/dir/x.jsonld prints ✓ 1 mention(s) … 1 call(s), 1,032 tokens and then error: No such file or directory (os error 2), exit 1. With the reading cache the retry is free; in the no-config-directory mode this PR puts forward, or with --no-cache, it's paid twice. parse has the same order, but parse costs nothing.
Opening the target before spawn_blocking (File::create(target) kept for the write, or at least a parent-exists check) and naming the path in the error (CliError::Input(format!("{}: {e}", target.display()))) would do it.
👍 On the same lines: assembling the output in memory and writing it once is what keeps "stdout carries only the graph" true on the error path. With a stub answering 500, stdout is zero bytes and exit is 1, and BrokenPipe is tolerated for | head.
There was a problem hiding this comment.
Agreed, a billed call shouldn't come before a check that costs nothing. In 304a80c, -o is opened with File::create before the read, and errors on both the open and the write name the path (<path>: <cause>). If the read then fails, the empty file is removed, so a failed read doesn't leave a zero-byte output behind. The integration test runs -o no/such/dir/out.jsonld, expects a failure naming that path, and checks the stub saw no new call.
And thanks for the 👍 on stdout. That part is unchanged: the output is still assembled in memory and written once.
| .stderr(predicate::str::contains("(1 from cache)")); | ||
| assert_eq!(seen.lock().unwrap().len(), 1); | ||
|
|
||
| read(&["--format", "trig", "--no-cache"]) |
There was a problem hiding this comment.
🟡 Optional: this run doesn't assert that --no-cache made a second call, so the test stays green with the flag ignored.
I removed .filter(|_| !args.no_cache) at doc.rs:1457 (parse and reading caches stay active under --no-cache) and doc_read_prints_one_files_reading_without_a_project still passed. The stub repeats its last answer (spawn_stub_reader, answers[n.min(len - 1)]), so the output is identical with or without the call. An assert_eq!(seen.lock().unwrap().len(), 2) after this run pins the body's "--no-cache reads afresh".
There was a problem hiding this comment.
Fair, the stub repeating its last answer made that assertion vacuous. 304a80c adds assert_eq!(seen.lock().unwrap().len(), 2) after the --format trig --no-cache run, so ignoring the flag (a cache hit, one call) turns it red.
|
|
||
| /// The structure graph and the reading as TriG, each in its own named | ||
| /// graph: `<doc>` and `<doc>/reading`. | ||
| pub fn trig(doc_iri: &str, structure: &fluree_graph_ir::Graph, nodes: &[Value]) -> Result<String> { |
There was a problem hiding this comment.
🟡 Optional: the TriG tests only look at the graph headers, so swapping the two graphs stays green.
With the structure put in <doc>/reading and the reading in <doc>, a_reading_prints_as_turtle_and_trig (:558) and the integration run (integration.rs:7224) both pass: each looks for "<…> {" and "<…/reading> {" and not for what's inside. Asserting that a structure triple (doco:Paragraph) sits between <doc> { and its closing brace, and a doc:Mention inside the <doc>/reading block (split the output on "\n}\n"), would make the placement part of the contract, which is the point of trig.
There was a problem hiding this comment.
Agreed, placement is the point of trig. In 304a80c, a_reading_prints_as_turtle_and_trig cuts the output into the <urn:d> { … } and <urn:d/reading> { … } blocks and checks that the structure element is in the first and not the second, and that the mention is in the second and not the first. Swapping the graphs now turns it red.
| let format = args.format; | ||
| let (read, structure) = tokio::task::spawn_blocking(move || -> CliResult<_> { | ||
| let (meta, parsed) = | ||
| fluree_db_doc::parse_file(&p, &file_name, &iri, cache.as_ref(), vlm.as_ref())?; |
There was a problem hiding this comment.
🟡 Optional: an empty document is still sent, with the ontology and the catalog, and billed.
Structure::plan returns one part for zero characters (request.rs:192), read_document sends it, and nothing here looks at parsed.text. Observed with a zero-byte empty.md: exit 0, 1 call(s), 1,032 tokens, and the stub received <urn:fluree:doc:empty.md> nif:isString "". A scanned PDF with no vision model configured has the same shape. A guard after the parse (doc.parsed.text.trim().is_empty() → print an empty graph and a ! no text to read note, no call) would cover it; the same guard in read_document would protect ingest, which is #2207's layer.
There was a problem hiding this comment.
Agreed, and I put the guard at the lower layer as you suggested so ingest gets it too. On #2207, 64e78c0 makes read_document send no call for a document whose text is empty or only whitespace: ingest sees an empty reading, pinned by doc_ingest_reader_sends_nothing_for_a_document_with_no_text. Here, 304a80c has read say ! no text to read: nothing was sent. The integration test reads an empty docs/empty.md and checks for 0 call(s) and that the stub saw nothing.
| | `--no-escalate`, `--max-crops <N>` | Vision-model escalation during the parse, as for `parse`. | | ||
| | `--no-cache` | Neither read nor write the parse and reading caches. | | ||
|
|
||
| The reading goes to stdout. Stderr says what was read with which model, then the counts, the calls made (and how many the cache answered), what the reader billed, and what it set aside or adapted in the ontology. |
There was a problem hiding this comment.
🟡 Optional: two things the docs should say, one here and one in the book.
The offsets' reference is the parser's text, not the file. Live, the four-line invoice became one paragraph with newlines turned into spaces, and the nif:anchorOf values match text[begin:end] of fluree doc parse --format text exactly, not the file's own offsets. Expected, but a reader of "anchored to the text's offsets" will reach for the file; a sentence pointing at doc parse --format text (or the nif:isString of the structure graph in trig) would save them the surprise.
And docs/unstructured/cli/README.md:3 still says "fluree doc has three subcommands" and lists ingest, search, parse; the book has a page per subcommand (docs/unstructured/cli/parse.md is the model) and docs/SUMMARY.md:250-253 an entry each. docs_coverage only covers docs/cli/, so nothing flags it. Commenting here because the book's files are outside this diff.
There was a problem hiding this comment.
Both fair, thanks for flagging the book even though it's outside the diff. In 304a80c:
docs/cli/doc.mdnow says the offsets index the parser's text, which is whatfluree doc parse --format textprints (and the document'snif:isStringin--format trig), not the file's bytes. The new book page has an "Offsets" section saying the same.docs/unstructured/cli/read.mdis new, modelled onparse.md, withdocs/unstructured/cli/README.mdsaying four subcommands and areadentry indocs/SUMMARY.md.
You're right that docs_coverage doesn't look at docs/unstructured/. I didn't widen it here, because that test's shape is "every command has a page under docs/cli/", and I wasn't sure the book should be held to a page per command.
# Conflicts: # fluree-db-cli/tests/integration.rs # fluree-db-doc/src/reader/reading.rs
…at it does - The receipt counts the nodes received beside the mentions, entities and relations among them, so a reading in a reader's own terms never reports less than it printed. - `-o` is opened before the read and its errors name the path: a path that can't be written fails before anything is billed (and the empty file is taken back if the read then fails). - The reading printed as Turtle or TriG goes through the same literal retyping as the structure graph (`request::retype_native_literals`), so a native JSON number prints as a number in both graphs. - `read` says when a document is read with the deterministic tier only (`--max-crops`) and names the vision model, as `parse` does, and says when a file has no text to send. - Tests: `--no-cache` makes a second call; an unwritable `-o` fails by name with no call; an empty file is not sent; the TriG graphs hold their own triples; native numbers print typed. - Docs: the reader resolution rule as the code applies it (project or global, env overriding field by field), offsets index the parser's text, `--cache off`, and a `read` page in the book with its SUMMARY and README entries. Also restores a test's closing brace lost in the previous merge. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016CjYmSfiNVsRZmcpMicDfq
A read-only or misplaced `.fluree/cache/doc/` failed `parse`, `read` and `ingest` with a bare "Permission denied (os error 13)". The error now reads `parse cache <dir>: <cause>`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016CjYmSfiNVsRZmcpMicDfq
|
Thanks, @arnaud-fluree, and thanks for approving. The live run with no
From the smaller notes:
Gate on the pushed head: |
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.
Stacked on #2207 (the HTTP reader), which is stacked on #2206.
fluree doc read <FILE>is the "hello world" for a reader: one file in, its reading printed, and no project needed.It parses the file as
doc parsedoes (parse_file, so the parse cache and[doc.vlm]escalation work the same way), then runs the samedoc_reader::read_documentthatdoc ingestuses. So the cut into calls, the windows, the resend rule and the reading's shape are all identical to what ingest would commit. Output:jsonld(default) prints the reading's nodes with the pipeline's@context;turtleprints the same as Turtle;trigprints the structure graph in<doc>and the reading in<doc>/reading, so a mention'sdoc:sourceElementresolves in the same file.Stdout carries only the graph. Stderr says what was read with which model, then the counts, the calls made (and how many the cache answered), what the reader billed, and what it set aside or adapted in the ontology.
On "no project":
doccommands resolve a.fluree/today, andparsewas already the exception (find_or_global_fluree_dir).readfollows it. The reader comes from the project's[doc.reader], else the global config's, elseFLUREE_DOC_READER_*.doc_sources::Opened::opennow takes an optional project, so a file ontology or catalog works anywhere and only a ledger source asks forfluree init. With no config directory at all, there's simply no reading cache.Tests (
integration.rs):doc_read_prints_one_files_reading_without_a_project: nofluree init, reader from the environment, against the stub reader from doc ingest: read with an HTTP reader ([doc.reader], --model, --cache) #2207. It checks the JSON-LD reading on stdout with every node stamped, the receipt on stderr, a second--format turtlerun answered from the cache in the global directory with no call, and--format trigwith both named graphs.doc_read_names_what_is_missing: no model, and a model no reader lists.cargo test -p fluree-db-cli(all suites pass),cargo test -p fluree-db-doc,--test docs_coverage, andcargo clippy -p fluree-db-doc -p fluree-db-cli --all-targets --no-deps(clean).The reference page is in
docs/cli/doc.md("fluree doc read"). One open question for review:readonly runs a reader today. Running the LLM extractor over chunks for a single file would be easy to add, but it isn't what this command is for, so I've left it out unless someone wants it.🤖 Generated with Claude Code
https://claude.ai/code/session_016CjYmSGfnxzJgMSzBESNee