The dep-light data-primitives library for the cjm context-graph ecosystem — defines 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.
Project description
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.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).
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
append_opfunction — Append one op record — the envelope-agnostic coreappend_writewraps.append_writefunction — Append one write op (skipping an exact (verb,args) duplicate).current_sessionfunction — The session key stamped on journal appends (provenance, not replay input).journal_segmentsfunction — The journal's SEGMENT FAMILY: rotated cold segments + the live tail.maybe_rotatefunction — Rotate the live tail once it reaches the budget (the POST-append check).read_journalfunction — Read every journaled write op (one JSON object per line; missing file = []).rotate_journalfunction — Close the live tail into the next immutable cold segment (explicit rotation).
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.
Dependencies
Depends on: cjm-substrate
Used by: cjm-capability-graph-sqlite, cjm-context-graph-layer, cjm-context-graph-projection, cjm-dev-graph-schema, cjm-markdown-decompose-core, cjm-notebook-decompose-core, cjm-python-decompose-core, cjm-transcript-correction-core, cjm-transcript-correction-tui, cjm-transcript-decomp-core, cjm-transcript-graph-schema
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cjm_context_graph_primitives-0.0.15.tar.gz.
File metadata
- Download URL: cjm_context_graph_primitives-0.0.15.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3120445fc0a8775d3e76a85c15101c1051096572374b5c237a7cd72793d9c94c
|
|
| MD5 |
6a7361e757c27ba5de2b4f630d1a2ef1
|
|
| BLAKE2b-256 |
efc4395229a34faa62728105d80b6445e9000184d7001ba68f55a5a822802a9e
|
File details
Details for the file cjm_context_graph_primitives-0.0.15-py3-none-any.whl.
File metadata
- Download URL: cjm_context_graph_primitives-0.0.15-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28adcf2ffeddfb9f1042303fe1cd253582326b7edd722ce880427acb93ed43c6
|
|
| MD5 |
cd2935c75705ce490c99345deb00618b
|
|
| BLAKE2b-256 |
3263b9d9af036325fd0e7d1260143edea15ab397f5a4f9a76bc34157676e91e4
|