cjm-context-graph-primitives
The dep-light data-primitives library for the cjm context-graph ecosystem — the shared data nouns that workflow cores, graph-storage adapters, provenance bundles, and the graph-aware composition layer all speak: structured resource locators with canonical URI rendering, content-hash-primary SourceRef provenance references, atomic typed content slices, GraphNode/GraphEdge/GraphContext containers, and the structured typed query expression executed by graph-storage adapters. Data nouns vs storage verbs: everything that consumes or produces graph data depends on this library; only persistence depends on a graph-storage adapter. Capabilities never construct SourceRef — the composition layer does.
Modules
cjm_context_graph_primitives.__init__cjm_context_graph_primitives.graph— The graph data nouns - GraphNode / GraphEdge / GraphContext. Moved here from cjm-graph-plugin-system per the data-nouns-vs-storage-verbs split (pass-2 Thread 2): every consumer of graph DATA (workflow cores, bundles, the CR-18 graph-aware layer, the storage adapter itself) depends on this library; only persistence depends on the storage adapter. GraphContext satisfies the substrate's FileBackedDTO protocol (to_temp_file) for zero-copy worker transfer. All three nouns are wire-registered (stage 4): graph-storage adapter methods return them typed across the worker boundary.cjm_context_graph_primitives.journal— The write-journal core: append-only JSONL ops — the durable, replayable source of truth.cjm_context_graph_primitives.locators— Structured resource locators - the typed sum type addressing WHERE referenced content lives (CR-19). A locator renders a canonical URI string for the things strings are good at (grep, logs, cache keys, display) while keeping typed field access primary; unknown kinds round-trip losslessly for forward compatibility.cjm_context_graph_primitives.provenance— SourceRef - the cross-cutting provenance reference (CR-19). Identity = content_hash (PRIMARY); location = locator; region = optional atomic typed slice. verify() is hash-based regardless of whether the locator still resolves - the structural fix for dangling row-id provenance (cache-hit rows; ledgers E13/D3).cjm_context_graph_primitives.query— The structured typed query expression (pass-2 Thread 5) - DATA nouns describing graph reads. Execution lives in graph-storage adapters (stage 4 translates expressions per-backend); this library only defines, validates, and (de)serializes them. Typed expressions are the primary, portable surface - no storage-schema leak (the raw-SQL nodes/edges + json_extract coupling of ledger C2/C3), and scale-shaped (server-side filter/page/count answering D13). RawQuery is the explicitly-marked, backend-coupled escape hatch: recurring raw patterns EXPOSE missing typed-expression capabilities.cjm_context_graph_primitives.slices— Atomic typed content slices - WHAT REGION of the located resource a reference consumes. The slice KIND selects the content facet on multi-facet nodes (TimeSlice -> audio, CharSlice -> text), which dissolves the chunk-local-vs-source-coordinate ambiguity without a frame field (pass-2 Thread 2).cjm_context_graph_primitives.timings— THE INSTRUMENT's collector: phase spans and the storage door's accumulator for ONE run.cjm_context_graph_primitives.writer— THE WRITE ORDER: plan -> append -> apply -> advance, one writer per journal family.
API
cjm_context_graph_primitives.graph
GraphContextclass — Container for graph read results (a subgraph).GraphEdgeclass — A relationship between two nodes. Composition is ALWAYS edges — grouping,GraphNodeclass — An entity in a context graph.
cjm_context_graph_primitives.journal
AppendedRecordclass — One recordappend_recordlanded, and where: a writer advances its applied cursor to itappend_opfunction — Append one op record — the envelope-agnostic coreappend_writewraps;append_recordappend_recordfunction — Append one op record and say where it landed — the coreappend_opanswers True / False for.append_recordsfunction — Append an atomic unit's records in ONE write (ruling 3de795e4) and say where each landed. Noappend_writefunction — Append one write op (skipping an exact (verb,args) duplicate) its caller has ALREADYcommitted_lengthfunction — How much of the live tail is COMMITTED (ruling 3de795e4): everything but a partial last linecompress_cold_segmentsfunction — Compress every PLAIN cold segment of a family (the live tail is never touched).compress_segmentfunction — Store one cold segment xz-compressed, proven lossless before the plain copy goes.current_sessionfunction — The session key stamped on journal appends (provenance, not replay input).family_lockfunction — The family's exclusive writer lock: an flock on its own open of the lock file, so itfamily_lock_syncfunction —family_lockfor a synchronous family act -- a rotation (ruling 6683f49e (3)). Joins anindexed_segmentsfunction — The SEGMENT FAMILY with each segment's index: a cold segment by its NNNN, the live tail atjournal_segmentsfunction — The journal's SEGMENT FAMILY: rotated cold segments + the live tail.journaledfunction — The append dedup rule: an explicit opidis exact-once; an id-less op matches an id-lesslive_indexfunction — The live tail's place in its family: one past the highest cold index, plain or compressed.lock_pathfunctionmaybe_rotatefunction — Rotate the live tail once it reaches the budget (the POST-append check).op_clockfunction — Open one op's clock window: reuse an open one (replay, or an enclosing write unit),op_clockedfunction — Decorator form ofop_clockfor a write entry point (sync or async): every db writeop_nowfunction — The op clock's current value: every write-path time reads THIS, nevertime.time().read_journalfunction — Read every journaled write op across the SEGMENT FAMILY (one JSON object perread_segmentfunction — Read one journal segment's text, plain or xz-compressed.rotate_journalfunction — Close the live tail into the next immutable cold segment (explicit rotation).seal_tailfunction — Cut an uncommitted end off the live tail (ruling 3de795e4): a partial last line and astamp_recordfunction — Stamp an op for the journal, each field only when ABSENT -- at its append, or as a unitwrite_segmentfunction — Write one segment atomically, in its own encoding (plain or xz-compressed).
cjm_context_graph_primitives.locators
FileRefclass — Locator for a filesystem artifact (e.g. a consumed run manifest).GraphNodeRefclass — Locator for a node in a context graph.UnknownLocatorclass — Lossless carrier for a locator kind this library version does not know.locator_from_dictfunction — Reconstruct a locator from its wire dict.
cjm_context_graph_primitives.provenance
SourceRefclass — A provenance reference to (a region of) a resource.
cjm_context_graph_primitives.query
EdgeQueryclass — Typed edge read: filter / order / page / project / count.EdgeQueryResultclass — Typed result of anEdgeQuery— exactly one field is populated,NodeQueryclass — Typed node read: filter / traverse / order / page / project / count.NodeQueryResultclass — Typed result of aNodeQuery— exactly one field is populated,OrderByclass — Result ordering by one property (server-side; C2/C3 ORDER BY index).PropertyPredicateclass — One property comparison; a query'swherelist combines predicates with AND.RawQueryclass — The explicitly-marked, backend-coupled escape hatch.RawQueryResultclass — Typed result of aRawQuery— tabular, backend-shaped (the columns areRelationPredicateclass — Match nodes that have an edge ofrelation_type(one-hop, typed traversal —SourcePredicateclass — Match nodes whosesourcescontain a reference matching by content hashquery_from_dictfunction — Reconstruct a query expression from its tagged wire dict.result_from_dictfunction — Reconstruct a query result from its tagged wire dict.
cjm_context_graph_primitives.slices
CharSliceclass — Character-range slice into a text facet.FrameSliceclass — Frame-range slice into a video facet.FullContentclass — Whole-facet reference (no range) — selects a content facet without slicing.LineSliceclass — Line-range slice into code or structured text.PageSliceclass — Page slice into a paginated document facet (PDF, EPUB).TimeSliceclass — Temporal slice into an audio/video facet, in seconds.UnknownSliceclass — Lossless carrier for a slice kind this library version does not know.parse_slicefunction — Parse a canonical slice string into a typed slice.slice_from_dictfunction — Reconstruct a typed slice from its wire dict.
cjm_context_graph_primitives.timings
Runclass — One measured run: its identity, the phase table, the storage table, the series.append_eventfunction — Append one timing event: O(1), dedup off (every run is one event), fail-open -- thebegin_runfunction — Arm a run for the current context; every span and storage call below lands in it.current_phasefunction — The span path a measurement would land under now.end_runfunction — Disarm a run begun withbegin_run(its tables stay readable forevent).io_deltafunction — The I/O a stretch of work did.process_startedfunction — When this process started, to ~10 ms: its age (uptime less its start tick, both fromread_iofunction — This process's I/O counters from /proc/self/io (design detail 2f5033bf (1)): read_bytes /record_appendfunction — Fold one journal append into the armed run (a no-op when none is): ops and bytes perrecord_replayfunction — Fold one replayed op into the armed run (a no-op when none is): ops and bytes per journalrecord_seriesfunction — Fold one positioned cost into its bin (the armed run's series; a no-op when none is):record_storagefunction — Fold one storage call into the armed run (a no-op when none is): by method, and -- whenspanfunction — Measure one phase of the armed run (a no-op yielding a scratch dict when none is). Atimedfunction — Decorator form ofspanfor a function (sync or async): each call is one phase.timings_pathfunction — The timings ledger beside a db (dev-graph.db->dev-graph.timings.jsonl).
cjm_context_graph_primitives.writer
CursorMismatchclass — The family under a cursor is not the one it applied -- rewritten (compaction) or pairedCursorStoreclass — Where a db keeps its applied cursors: beside the graph, one per journal family.JournalPositionclass — How far into a journal family a db has applied: the segment holding the last appliedJournalWriterclass — One writer's unit of work on one journal family (65f4a6c9):async withtakes theNoCursorclass — The db holds no applied cursor for a family that holds records: it predates the cursor orfamily_namefunction — A family is keyed by its live tail's FILE NAME, never its path: a db and its journals movefault_armedfunction — Whether a proof may crash atpoint-- so the write path takes a fault's shape (a tornfault_pointfunction — A crash-injection point on the write path: the in-process hook, then the armed env.journal_lagfunction — How far a db trails its journal, for a READER to report (65f4a6c9 (2d)): readers neverread_tailfunction — Every record of the family pastposition, in append order -- only the tail is read (thestamp_cursorfunction — Record the family's END as the db's cursor -- for a db that holds the whole family: a
Dependencies
Depends on: cjm-substrate
Used by: cjm-capability-graph-sqlite, cjm-context-graph-layer, cjm-context-graph-projection, cjm-dev-graph-schema, cjm-graph-storage-adapter-interface, cjm-graph-workbench-qt, cjm-markdown-decompose-core, cjm-notebook-decompose-core, cjm-python-decompose-core, cjm-session-scratchpad-qt, cjm-substrate-qt-kit, cjm-transcript-correction-core, cjm-transcript-correction-qt, cjm-transcript-decomp-core, cjm-transcript-graph-schema, cjm-transcription-core, cjm-workflow-hub-qt
Metadata
Release files for cjm-context-graph-primitives 0.0.29
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cjm_context_graph_primitives-0.0.29.tar.gz | 62.6 kB | Without provenance | Details for cjm_context_graph_primitives-0.0.29.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cjm_context_graph_primitives-0.0.29-py3-none-any.whl | Python 3 | none | any | Details for cjm_context_graph_primitives-0.0.29-py3-none-any.whl |
Total release size: 112.8 kB
Release files / cjm_context_graph_primitives-0.0.29.tar.gz
| Download URL | cjm_context_graph_primitives-0.0.29.tar.gz |
|---|---|
| Size | 62.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb8165f508bc64f31b2220e433e652411776f54485483476ebeceec17f592647
|
|
BLAKE2b-256 checksum How to use checksums |
12d0bd1531656f45797fbca5d065b2b1873a4dcb5e6a418b0dbe8f7bb076739d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / cjm_context_graph_primitives-0.0.29-py3-none-any.whl
| Download URL | cjm_context_graph_primitives-0.0.29-py3-none-any.whl |
|---|---|
| Size | 50.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81ba86dda2872bbeb8f7bd588dd2e3583910f98c27f069afb601b2d43dcb0b02
|
|
BLAKE2b-256 checksum How to use checksums |
c806cc37073fe657f07cddbc5a31ba2112663df87c97f7ef75fde3ce49cf6c62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for cjm-context-graph-primitives 0.0.29
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.