Skip to content

Commit 9b98673

Browse files
committed
doc: update AGENTS.md
1 parent cf72825 commit 9b98673

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

AGENTS.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ pathrex/
2626
│ │ └── inmemory.rs # InMemory marker, InMemoryBuilder, InMemoryGraph
2727
│ └── formats/
2828
│ ├── mod.rs # FormatError enum, re-exports
29-
│ └── csv.rs # Csv<R> — CSV → Edge iterator (CsvConfig, ColumnSpec)
29+
│ ├── csv.rs # Csv<R> — CSV → Edge iterator (CsvConfig, ColumnSpec)
30+
│ └── nt.rs # NTriples<R> — N-Triples → Edge iterator (LabelExtraction)
3031
├── tests/
3132
│ └── inmemory_tests.rs # Integration tests for InMemoryBuilder / InMemoryGraph
3233
├── deps/
@@ -187,9 +188,13 @@ into a single graph.
187188

188189
### Format parsers
189190

190-
[`Csv<R>`](src/formats/csv.rs:52) is the only built-in parser. It yields
191-
`Iterator<Item = Result<Edge, FormatError>>` and is directly pluggable into
192-
`GraphBuilder::load()` via its `GraphSource<InMemoryBuilder>` impl.
191+
Two built-in parsers are available, both yielding
192+
`Iterator<Item = Result<Edge, FormatError>>` and pluggable into
193+
`GraphBuilder::load()` via their `GraphSource<InMemoryBuilder>` impls.
194+
195+
#### `Csv<R>`
196+
197+
[`Csv<R>`](src/formats/csv.rs:52) parses delimiter-separated edge files.
193198

194199
Configuration is via [`CsvConfig`](src/formats/csv.rs:17):
195200

@@ -204,6 +209,27 @@ Configuration is via [`CsvConfig`](src/formats/csv.rs:17):
204209
[`ColumnSpec`](src/formats/csv.rs:11) is either `Index(usize)` or `Name(String)`.
205210
Name-based lookup requires `has_header: true`.
206211

212+
#### `NTriples<R>`
213+
214+
[`NTriples<R>`](src/formats/nt.rs:57) parses [W3C N-Triples](https://www.w3.org/TR/n-triples/)
215+
RDF files using `oxttl`. Each triple `(subject, predicate, object)` becomes an
216+
[`Edge`](src/graph/mod.rs:154) where:
217+
218+
- `source` — subject IRI or blank-node ID (`_:label`).
219+
- `target` — object IRI or blank-node ID; triples whose object is an RDF
220+
literal yield `Err(FormatError::LiteralAsNode)` (callers may filter these out).
221+
- `label` — predicate IRI, transformed by [`LabelExtraction`](src/formats/nt.rs:36):
222+
223+
| Variant | Behaviour |
224+
|---|---|
225+
| `LocalName` (default) | Fragment (`#name`) or last path segment of the predicate IRI |
226+
| `FullIri` | Full predicate IRI string |
227+
228+
Constructors:
229+
230+
- [`NTriples::new(reader)`](src/formats/nt.rs:72) — uses `LabelExtraction::LocalName`.
231+
- [`NTriples::with_label_extraction(reader, strategy)`](src/formats/nt.rs:76) — explicit strategy.
232+
207233
### FFI layer
208234

209235
[`lagraph_sys`](src/lagraph_sys.rs) exposes raw C bindings for GraphBLAS and
@@ -254,7 +280,7 @@ Tests in `src/graph/mod.rs` use `CountingBuilder` / `CountOutput` / `VecSource`
254280
[`src/utils.rs`](src/utils.rs) — these do **not** call into GraphBLAS and run without
255281
native libraries.
256282

257-
Tests in `src/formats/csv.rs` are pure Rust and need no native dependencies.
283+
Tests in `src/formats/csv.rs` and `src/formats/nt.rs` are pure Rust and need no native dependencies.
258284

259285
Tests in `src/graph/inmemory.rs` and [`tests/inmemory_tests.rs`](tests/inmemory_tests.rs)
260286
call real GraphBLAS/LAGraph and require the native libraries to be present.

src/graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl LagraphGraph {
109109
Self::new(matrix, kind)
110110
}
111111

112-
pub fn check_graph(&self) -> Result<(), GraphError> {
112+
pub fn check_graph(&self) -> Result<(), GraphError> {
113113
la_ok!(LAGraph_CheckGraph(self.inner))
114114
}
115115
}

0 commit comments

Comments
 (0)