1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! Streaming N-Triples loader with bz2/gz/plain support.
//!
//! Designed for Wikidata truthy dumps but works with any N-Triples file.
//!
//! Single-pass algorithm:
//! 1. Stream-decompress → parse lines → filter by predicate/language
//! 2. Accumulate properties per subject; flush node on subject change
//! 3. Buffer edges (source_id, target_id, predicate)
//! 4. After EOF: create all buffered edges, skip if target missing
//!
//! Split:
//! - [`parser`] — triple AST (Subject/Predicate/Object/EdgeBuffer), line
//! parser, XSD literal → Value coercion, language filters.
//! - [`writer`] — edge-creation dispatch (compact, strings, qnum map).
//! - [`loader`] — `load_ntriples` entry point + per-entity flush.
//! - [`column_builder`] — direct-write columnar build pipeline +
//! `ColumnTypeMeta` (saved to disk for mmap reload).
use ;
pub use ;
pub use load_ntriples;
/// Per-counter value carried by [`ProgressEvent`]. Pure Rust — the
/// pyapi layer maps this into Python types when (and only when)
/// adapting a Python callback into a [`ProgressSink`]. `F64` and
/// `Str` are reserved for sub-step labels emitted from Phase 1b / 2 / 3
/// once those phases get internal progress reporting.
/// Structured progress event emitted by `load_ntriples` at phase
/// boundaries and within the streaming loop. Phases: `"phase1"`,
/// `"phase1b"`, `"phase2"`, `"phase3"`, `"finalising"`.
/// Marker for cooperative cancellation. Returned by [`ProgressSink::emit`]
/// when the caller (typically the pyapi layer reacting to a Python
/// `KeyboardInterrupt`) wants the loader to stop. The loader threads
/// this back up as a clean error, which the pyapi wrapper translates
/// into `PyKeyboardInterrupt`.
;
/// Sink for [`ProgressEvent`]s. Implementations must be `Send + Sync`
/// because the loader fires events from worker contexts. The pyapi
/// layer provides a Python-callable adapter; pure-Rust callers can
/// implement this trait directly.
///
/// Returning `Err(Cancelled)` from `emit` requests the loader stop at
/// the next safe point. Implementations that never want to cancel can
/// always return `Ok(())`.
/// Stats returned after loading.
/// Configuration for the loader.