Skip to main content

Graph

Struct Graph 

Source
pub struct Graph { /* private fields */ }
Expand description

Main graph structure backed by petgraph::StableGraph

Implementations§

Source§

impl Graph

Source

pub fn table_stats(&self) -> GraphTableStats

Cheap live counts for the graph’s kernel-owned tables.

Source§

impl Graph

Source

pub fn copy_node_from( &mut self, source: &Node, source_graph: Option<String>, position: Point2D<f32>, ) -> NodeKey

Copy source’s content into this graph, minting a fresh node and recording cross-graph derivation provenance back to the source.

source is a donor Node from another Graph; source_graph is the donor graph’s id (the constellation GraphId rendered as a string), or None when unknown / same-graph. The copy is a new entity: it gets a fresh identity, and its content (title, tags, classifications, open properties, address, visuals, viewer preferences) is cloned, while its identity / runtime / session / arrangement state is reset (fresh id, unpinned, no frame hints; browser-runtime state lives in the host’s BrowserNodeState sidecar and never travels with a copy). A NodeDerivation records (CopiedFrom, source.id, source_graph) so the lineage survives and projects to a wasDerivedFrom statement.

The donor’s import_provenance is intentionally not carried over: that describes how the donor entered its graph from an external source; the copy’s provenance is the derivation record, not the donor’s import.

Not available on wasm32 (mints a random id, like add_node); use copy_node_from_with_id with a host-provided UUID there.

Source

pub fn copy_node_from_with_id( &mut self, id: Uuid, source: &Node, source_graph: Option<String>, _position: Point2D<f32>, ) -> NodeKey

copy_node_from with a caller-supplied id (the wasm-clean entry point, mirroring add_node_with_id).

Source

pub fn copy_node_from_xy( &mut self, source: &Node, source_graph: Option<String>, x: f32, y: f32, ) -> NodeKey

copy_node_from taking plain x / y screen-graph coords, so a host can place the copy without depending on euclid. (Tear-out gestures G5.)

Source

pub fn copy_component_from( &mut self, source: &Graph, seed: Uuid, source_graph: Option<String>, ) -> ComponentCopy

Copy the connected component containing seed (a node in source) into this graph: the kernel half of a tear-out fork (the reachable-subgraph snapshot, tear-out brief §4.3). The component is component_members’ (every family, both strata, shown bindings at zero hops; ruling 38), so surfaces joined only by a resource relation copy together. Each surface is minted fresh (with a CopiedFrom NodeDerivation back to its source); surface edges among the copies are re-pointed onto the new nodes by cloning each payload verbatim. Resources keep their ids (shared content, as selection Copy retains them): the walked resources and the predicate-declaration resources their content needs travel as whole records, each copied surface keeps its shown binding, and the resource edges among them travel verbatim. A resource or resource pair this graph already holds keeps this graph’s truth. Edges leaving the component are dropped (the snapshot is closed under the component). Returns the ComponentCopy: the new keys plus the source id → new id remap the host’s facet-carry maps donor facets through (G4-R R0 — positions and every other per-node character ride arrangement.* / web.* / … facets, not the graph, so the fork’s layout carry needs this mapping). (Tear-out gestures G4.)

Source§

impl Graph

Source

pub fn try_assert_semantic_statement_by_resource_ids( &mut self, from: Uuid, to: Uuid, spec: SemanticStatementSpec, ) -> Result<(RelationKey, StatementAssert), StatementWriteError>

Assert over held Resources without creating or selecting a Surface. Held handles keep their recorded placement, even after a nature change.

Source

pub fn find_semantic_statement( &self, statement_id: &str, ) -> Option<(RelationKey, &SemanticStatement)>

Locate any retained handle, including withdrawn history, independent of current nature. Use find_held_semantic_statement for default reads.

Source

pub fn find_held_semantic_statement( &self, statement_id: &str, ) -> Option<(RelationKey, &SemanticStatement)>

Source

pub fn try_assert_semantic_statement( &mut self, from: NodeKey, to: NodeKey, spec: SemanticStatementSpec, ) -> Result<(RelationKey, StatementAssert), StatementWriteError>

New assertions follow the stored declaration. Reassertions keep their handle’s store. A conflict or missing endpoint returns an error without partial writes.

Source

pub fn try_import_semantic_statement( &mut self, from: NodeKey, to: NodeKey, spec: SemanticStatementSpec, ) -> Result<(RelationKey, StatementAssert), StatementWriteError>

Import without a carried ID: retain the source time if present, but do not create chronology when the source supplied none. Content ensure keeps repeated imports idempotent until the source provides identity.

Source

pub fn try_assert_persisted_semantic_statement( &mut self, from: NodeKey, to: NodeKey, statement: SemanticStatement, ) -> Result<RelationKey, StatementWriteError>

Carried handles may update their claim, but cannot select a different claim or store.

Source

pub fn update_assertion_metadata( &mut self, statement_id: &str, label: Option<String>, asserted_at_ms: Option<u64>, ) -> bool

Edit one exact held assertion without selecting a content-key survivor.

Source

pub fn try_assert_semantic_reason( &mut self, from: NodeKey, to: NodeKey, spec: SemanticStatementSpec, ) -> Result<(RelationKey, StatementAssert), StatementWriteError>

Ensure an assertion by its L13 reason key. Method version and note may update on the same ID; a changed method IRI or evidence set creates a new independently withdrawable assertion.

Source

pub fn reconfirm_semantic_assertion( &mut self, statement_id: &str, label: Option<String>, asserted_at_ms: Option<u64>, ) -> bool

Confirm one exact held ID. Missing caller time is stamped once here; an unknown or withdrawn ID is never selected by matching its content.

Source

pub fn withdraw_semantic_assertion( &mut self, statement_id: &str, at_ms: Option<u64>, by: Option<String>, ) -> bool

Apply an exact-ID withdrawal. Unknown IDs are explicitly unapplied; callers with causal event streams must defer/reject until admitted.

Source

pub fn apply_imported_semantic_withdrawal( &mut self, statement_id: &str, at_ms: Option<u64>, by: Option<String>, ) -> bool

Import/replay path: preserve missing time and never synthesize the clock. It returns false for unknown IDs so an event is not acknowledged.

Source

pub fn apply_imported_semantic_withdrawal_for_pair( &mut self, from: NodeKey, to: NodeKey, statement_id: &str, at_ms: Option<u64>, by: Option<String>, ) -> bool

Apply an imported exact-ID withdrawal only when its authored pair owns the assertion. Source events with no carried time remain undated.

Source

pub fn withdraw_semantic_assertion_for_pair( &mut self, from: NodeKey, to: NodeKey, statement_id: &str, ) -> bool

Authored pair-checked exact-ID withdrawal. It records the current time and configured writer only after verifying the owning bucket.

Source

pub fn find_assertion( &self, id: &str, ) -> Option<(RelationKey, &SemanticStatement)>

All-family aliases retain exact owner, ID, basis and lifecycle admission.

Source

pub fn find_held_assertion( &self, id: &str, ) -> Option<(RelationKey, &SemanticStatement)>

Source

pub fn try_assert_relation_statement( &mut self, from: NodeKey, to: NodeKey, spec: SemanticStatementSpec, ) -> Result<(RelationKey, StatementAssert), StatementWriteError>

Source

pub fn try_assert_persisted_relation_statement( &mut self, from: NodeKey, to: NodeKey, statement: SemanticStatement, ) -> Result<RelationKey, StatementWriteError>

Source

pub fn retract_assertion(&mut self, statement_id: &str) -> bool

Compatibility spelling for authored exact-ID withdrawal.

Source§

impl Graph

The durable representation excludes the default session-only entries.

Install a separate cache slot after truth replay, without deriving claims.

Purging changes no snapshot, source document, assertion or journal entry.

Source

pub fn semantic_observation_revision(&self) -> u64

Source

pub fn without_pending_derivation<R>( &mut self, edit: impl FnOnce(&mut Self) -> R, ) -> R

Suppress ambient extraction through a complete replay or import batch. The previous scope is restored on unwind; clones do not inherit it.

Retry only after completed live admission. Recorded assertions remain authoritative: a carried held claim consumes its cache input unchanged.

Source§

impl Graph

Source

pub fn freeze_resource_selection( &mut self, spec: Value, members: Vec<Uuid>, ) -> Result<Uuid, String>

Mint a Resource that bears a revision-frozen nested graph of references and exact relation copies. Member payloads stay in their owning resources. The spec is opaque to the kernel; the facade supplies its portable value.

Source

pub fn freeze_resource_selection_with_nonce( &mut self, spec: Value, members: Vec<Uuid>, nonce: Uuid, ) -> Result<Uuid, String>

Portable freeze entry point: the host supplies a fresh UUID nonce, as it does for new Surfaces on wasm. A reused address is refused before writing.

Source

pub fn open_frozen_selection( &self, owner: Uuid, ) -> Result<OpenedFrozenSelection<'_>, String>

Open the immutable graph without loading or inventing its referenced members.

Source§

impl Graph

Read a current pair without minting a Resource. An empty pair is a valid reading result for drift comparison, but cannot be frozen.

Freeze a link in one graph stratum as a distinct immutable Resource.

Source§

impl Graph

Source

pub fn known_coverage(&self) -> &CoverageNote

Source

pub fn set_known_coverage(&mut self, note: CoverageNote)

Runtime host context, never graph truth, a journal edit or a geometry key.

Source

pub fn coverage_note(&self) -> CoverageNote

Source

pub fn coverage_for_resource_refs(&self, references: &[Uuid]) -> CoverageNote

Coverage for explicit portable references, without inventing absent records.

Source

pub fn copy_semantic_context_from(&mut self, graph: &Self)

Source

pub fn clear_semantic_context(&mut self)

History starts from truth only, never an ambient extraction input.

Source§

impl Graph

Source

pub fn replace_loaded_recorded_snapshot( &mut self, snapshot: &GraphSnapshot, facets: &NodeFacetStore, coverage: CoverageNote, ) -> Result<(), ResourceSnapshotError>

Validate the complete candidate before publishing a resident replacement.

Source§

impl Graph

Source§

impl Graph

Source

pub fn surface_node_lifetime(&self, id: Uuid) -> Option<SurfaceNodeLifetime>

Observe membership without allocating or changing its life.

Source§

impl Graph

Source§

impl Graph

Source

pub fn facets(&self) -> &NodeFacetStore

The graph’s single live atomic-facet authority.

Source

pub fn install_facets( &mut self, facets: NodeFacetStore, ) -> Result<(), ResourceSnapshotError>

Replace the facet store with facets, a sidecar loaded for this graph.

Refused, with the previous store kept, when the result would fail checked open: a retained Surface literal may not reuse a handle a Resource holds ([validate_active_resource_assertion_handles] (Graph::validate_active_resource_assertion_handles)).

Source

pub fn overlay_facets( &mut self, facets: NodeFacetStore, ) -> Result<(), ResourceSnapshotError>

Overlay a canonical sidecar after snapshot load.

Legacy snapshot columns are imported while reconstructing the graph. Existing facets.json values then win for matching keys, while both stores preserve unrelated namespaces. Checked and kept as install_facets is.

Source§

impl Graph

Source

pub fn insert_node_tags(&mut self, key: NodeKey, tags: Vec<String>) -> bool

Insert tags on the shown Resource, retaining each tagger’s assertion.

Source

pub fn append_node_properties( &mut self, key: NodeKey, incoming: Vec<NodeProperty>, ) -> bool

Append literal assertions to the shown Resource in one facet replacement.

Source

pub fn add_node_classifications( &mut self, key: NodeKey, incoming: Vec<NodeClassification>, ) -> bool

Preserve complete classification variants and the caller’s origin.

Source§

impl Graph

Source

pub fn bear_nested(&mut self, key: NodeKey, nested: Option<LogId>) -> bool

Directly bear (or clear) a nested graph on a node WITHOUT running the delta spine — for copy/load paths building a graph that has no journal yet (a fork re-bearing the worlds it carried as real file copies; the component copy itself deliberately drops nested so two LIVE nodes never share one world). Journaled edits go through GraphDelta::SetNodeNested instead.

Source

pub fn frame_layout_hints(&self, key: NodeKey) -> Option<Vec<FrameLayoutHint>>

Source

pub fn frame_split_offer_suppressed(&self, key: NodeKey) -> Option<bool>

Source

pub fn node_is_pinned(&self, key: NodeKey) -> Option<bool>

Source

pub fn node_tags(&self, key: NodeKey) -> Option<&HashSet<String>>

Source

pub fn node_tag_presentation( &self, key: NodeKey, ) -> Option<NodeTagPresentationState>

Source

pub fn node_import_provenance( &self, key: NodeKey, ) -> Option<Vec<NodeImportProvenance>>

Source

pub fn node_classifications( &self, key: NodeKey, ) -> Option<Vec<NodeClassification>>

Source

pub fn legacy_node_classifications( &self, key: NodeKey, ) -> Option<Vec<NodeClassification>>

Raw retained Surface content, used by legacy replay and RDF compatibility.

Source

pub fn node_properties(&self, key: NodeKey) -> Option<Vec<NodeProperty>>

Source

pub fn legacy_node_properties(&self, key: NodeKey) -> Option<Vec<NodeProperty>>

Source

pub fn node_derivations(&self, key: NodeKey) -> Option<Vec<NodeDerivation>>

Source

pub fn node_last_visited(&self, key: NodeKey) -> Option<SystemTime>

When key was last visited: the recency the canvas reads. Not a projection of the browse trail, which Stemma holds.

Source

pub fn node_last_session_visited(&self, key: NodeKey) -> Option<u64>

Source§

impl Graph

Source

pub fn predicate_declarations( &self, predicate: &str, ) -> Result<Option<PredicateDeclarations>, PredicateDeclarationError>

The declarations held by this mere for one predicate.

Source

pub fn effective_predicate_stratum( &self, predicate: &str, ) -> Result<GraphStratum, PredicateDeclarationError>

Placement for a future assertion; exact historical handles retain their stores.

Source

pub fn declare_predicate( &mut self, predicate: &str, stratum: GraphStratum, ) -> Result<String, PredicateDeclarationError>

Retain an authored nature change and explicitly select it for future writes.

Source

pub fn select_predicate_declaration( &mut self, predicate: &str, declaration_id: &str, ) -> Result<bool, PredicateDeclarationError>

Resolve a retained conflict by exact declaration id, without moving statements.

Source§

impl Graph

Source

pub fn get_relation(&self, key: RelationKey) -> Option<&EdgePayload>

Read the owning store named by this relation handle.

Source

pub fn get_resource_edge(&self, key: ResourceEdgeKey) -> Option<&EdgePayload>

Read a resource edge without accepting a surface edge index.

Source

pub fn find_resource_edge_key( &self, from: Uuid, to: Uuid, ) -> Option<ResourceEdgeKey>

Find the first directed resource edge between resource identities.

Source

pub fn resource_relations( &self, ) -> impl Iterator<Item = (ResourceEdgeKey, Uuid, Uuid, &EdgePayload)>

Every retained Resource edge, with a typed handle and stable endpoints. This raw storage iterator includes tombstone-only buckets for history; ordinary projected reads filter to held topology.

Source

pub fn retained_relations_between( &self, from: NodeKey, to: NodeKey, ) -> impl Iterator<Item = (RelationKey, &EdgePayload)>

All retained Surface edges followed by retained edges between the resources shown, including tombstone-only assertion history. Parallel records and self-loops each appear once per directed pair.

Source

pub fn projected_relations_between( &self, from: NodeKey, to: NodeKey, ) -> impl Iterator<Item = (RelationKey, &EdgePayload)>

Directed held Surface edges followed by held edges between the resources shown. Use retained_relations_between for explicit history.

Source

pub fn projected_outgoing_relations( &self, from: NodeKey, ) -> impl Iterator<Item = (NodeKey, RelationKey, &EdgePayload)>

Outgoing relations lifted to every surface showing their target resource.

Source

pub fn projected_incoming_relations( &self, to: NodeKey, ) -> impl Iterator<Item = (NodeKey, RelationKey, &EdgePayload)>

Incoming relations lifted from every surface showing their source resource.

Source§

impl Graph

Source

pub fn resource(&self, id: Uuid) -> Option<&ResourceNode>

Read a resource by its stable identity.

Source

pub fn resource_nodes(&self) -> impl Iterator<Item = &ResourceNode>

The resources currently held in this graph.

Source

pub fn resource_edges( &self, ) -> impl Iterator<Item = (&ResourceNode, &ResourceNode, &EdgePayload)>

Resource edges with their resource endpoints. Surface indices never cross this seam.

Source

pub fn resource_facets(&self) -> &FacetStore<Uuid>

Resource metadata, separate from surface metadata.

Source

pub fn shown_resource_id(&self, surface: NodeKey) -> Option<Uuid>

The resource explicitly shown by a surface, when recorded.

Source

pub fn surface_ids_showing_resource(&self, resource_id: Uuid) -> Vec<Uuid>

Surface identities showing a resource, in stable order.

Source

pub fn resource_record(&self, id: Uuid) -> Option<PersistedResourceRecord>

Source

pub fn appearance_admission_revision(&self) -> u64

Runtime receipt for completed new shown-Resource associations. This advances on admission, including navigation to an already held Resource.

Source§

impl Graph

Source

pub fn persisted_resource_edges_between_bounded( &self, from: Uuid, to: Uuid, max_edges: usize, max_bytes: usize, ) -> Result<Vec<PersistedEdge>, ResourceEdgesBoundError>

Capture all live rows for a directed resource pair, including session assertions omitted from durable snapshots. This is suitable for exact replacement, not a substitute for a durable graph snapshot.

max_edges limits pair rows. max_bytes independently limits each of the raw payload and returned row JSON arrays, including array framing. Both limits are checked before cloning any persisted rows. Pair lookup scans source adjacency metadata; unrelated payloads are not serialized.

Source§

impl Graph

Source§

impl Graph

Source

pub fn validate_active_resource_assertion_handles( &self, ) -> Result<(), ContentError>

Check Resource handle ownership after a host overlays retained Surface facets. Held Surface-only duplicates keep their historical grammar. Checked open and replayed writes share this one rule; a replayed edge set also keeps each handle to one row.

Source§

impl Graph

Source

pub fn resource_properties(&self, id: Uuid) -> Vec<NodeProperty>

Source

pub fn append_resource_properties( &mut self, id: Uuid, incoming: Vec<NodeProperty>, ) -> Result<bool, ContentError>

Source

pub fn retract_resource_property( &mut self, id: Uuid, statement_id: &str, ) -> Result<bool, ContentError>

Source§

impl Graph

Source

pub fn resource_tag_concept(&self, id: Uuid) -> Option<TagConcept>

Source

pub fn resource_tag_labels(&self, id: Uuid) -> HashSet<String>

Source

pub fn node_content_tags(&self, key: NodeKey) -> Option<HashSet<String>>

Content tags of the shown resource; raw Surface tags remain legacy fallback.

Source

pub fn define_tag_concept( &mut self, id: Uuid, concept: TagConcept, ) -> Result<bool, ContentError>

Preserve an explicit SKOS concept’s prepared IRI and declared owner.

Source

pub fn tag_resource_with_concept( &mut self, resource_id: Uuid, concept_iri: &str, concept: TagConcept, ) -> Result<bool, ContentError>

Reuse an explicitly named concept, including one in another owner’s vocabulary.

Source

pub fn tag_resource_with_asserter( &mut self, resource_id: Uuid, concept_iri: &str, concept: TagConcept, asserter_iri: String, ) -> Result<bool, ContentError>

Tag with an explicit imported source rather than the host’s Author fallback.

Source§

impl Graph

Source

pub fn field(&self, id: FieldId) -> Option<&Field>

The field with this id, if any.

Source

pub fn fields(&self) -> impl Iterator<Item = &Field>

All fields, in id order.

Source

pub fn couplings(&self) -> impl Iterator<Item = &Coupling>

All couplings, in id order.

Source

pub fn couplings_for_field( &self, field: FieldId, ) -> impl Iterator<Item = &Coupling> + '_

Couplings whose target is the given field.

Source

pub fn field_coupling_strength(&self, field: FieldId) -> Option<f32>

The strength of the first coupling targeting field, if any (a field carries one default coupling). For the roster’s per-field strength readout. (Field regions — strength tuning.)

Source

pub fn nodes_matching<'a>( &'a self, selector: &'a NodeSelector, ) -> impl Iterator<Item = NodeKey> + 'a

Resolve a coupling’s NodeSelector to the matching nodes, against node tags and classifications. Kind(k) matches a node carrying any affirmative classification whose value is k (the v1 interpretation; a scheme-qualified match can refine it later).

Source§

impl Graph

Source

pub fn collect_node_traversals( &self, key: NodeKey, ) -> Option<Vec<DissolvedTraversalRecord>>

Collect traversals from all incident edges without mutating graph state.

Source

pub fn assert_semantic_statement( &mut self, from: NodeKey, to: NodeKey, spec: SemanticStatementSpec, ) -> Option<(RelationKey, StatementAssert)>

Statement-aware assert (petgraph-RDF Phase 1 write API): assert one semantic statement with full per-statement metadata on the (from, to) pair bucket, creating the bucket edge if absent. Content-dedup returns the EXISTING fact handle (updating its metadata in place); a genuine change bumps the revision. This compatibility surface writer remains during P2 integration; the checked counterpart uses durable placement.

Source

pub fn assert_persisted_semantic_statement( &mut self, from: NodeKey, to: NodeKey, statement: SemanticStatement, ) -> Option<RelationKey>

Assert a semantic statement whose id is ALREADY minted — the re-ingest / round-trip path (a reifier carried the fact handle, and preserving it is what makes RDF -> kernel -> RDF id-stable). Reasserting the same asserter updates its existing handle; endpoints must exist. The checked counterpart supplies declaration-aware placement and collision errors.

Source

pub fn retract_semantic_statement( &mut self, _from: NodeKey, _to: NodeKey, statement_id: &str, ) -> bool

Compatibility spelling for an authored exact-ID withdrawal. The assertion remains as a tombstone in its original pair bucket.

Source

pub fn retract_relations_where( &mut self, from: NodeKey, to: NodeKey, selector: RelationSelector, allow: impl FnMut(&SemanticStatement) -> bool, ) -> Retraction

retract_relations that asks allow about each statement before withdrawing it, across both strata of the pair. A refused statement stays held and is counted in Retraction::refused. Traversal history holds no statements, so allow is not consulted for that family.

Source

pub fn get_edge(&self, key: EdgeKey) -> Option<&EdgePayload>

Get an edge payload by key.

Source

pub fn find_edge_key(&self, from: NodeKey, to: NodeKey) -> Option<EdgeKey>

Find the first directed edge key between two nodes.

Source

pub fn edges_between_undirected( &self, a: NodeKey, b: NodeKey, ) -> impl Iterator<Item = (EdgeKey, &EdgePayload)> + '_

Every edge between a and b in either direction: all a->b edges first, then all b->a edges, each run in petgraph’s edges_connecting order (deterministic for a given graph). The substrate is a multigraph, so a pair may carry an antiparallel or parallel set; read predicates that mean “the pair” rather than “the first arc” go through here instead of Self::find_edge_key. Self-loops (a == b) are yielded once.

Source§

impl Graph

Source

pub fn get_node(&self, key: NodeKey) -> Option<&Node>

Get a node by key

Source

pub fn find_node_by_address( &self, address: &Address, ) -> Option<(NodeKey, &Node)>

Find a node whose AddressClaims include the given address (any AddressRole). Returns an arbitrary matching node when multiple nodes share the address — the caller is expected to handle duplicates explicitly when relevant.

Canonical address lookup per the node identity + duplicates brief; supersedes the URL-string-keyed get_node_by_url (which is retained as a transitional shim — see below).

Source

pub fn get_node_by_url(&self, url: &str) -> Option<(NodeKey, &Node)>

Convenience wrapper over Graph::find_node_by_address for callers that have a URL string rather than a typed [Address]. Builds the [Address] internally and delegates.

Use this for tests and quick lookups; prefer Graph::find_node_by_address in code paths that already have a typed [Address] in hand.

Source

pub fn get_nodes_by_url(&self, url: &str) -> Vec<NodeKey> ⓘ

Get all node keys currently mapped to a URL.

Source

pub fn get_node_by_id(&self, id: Uuid) -> Option<(NodeKey, &Node)>

Get a node by UUID.

Source

pub fn get_node_key_by_id(&self, id: Uuid) -> Option<NodeKey>

Get node key by UUID.

Source

pub fn nodes(&self) -> impl Iterator<Item = (NodeKey, &Node)>

Iterate over all nodes as (key, node) pairs

Source

pub fn relations(&self) -> impl Iterator<Item = RelationView> + '_

Iterate over all stored relations, one row per recognized statement/family carried by the pair-local edge bucket. One EdgePayload between two nodes may therefore yield multiple semantic rows.

Canonical read surface per the 2026-05-11 relation-taxonomy plan §2. Stage 4 removed the legacy EdgeType-flavoured edges() iterator that this replaces.

Source

pub fn surface_relation_buckets( &self, ) -> impl Iterator<Item = (EdgeKey, NodeKey, NodeKey, &EdgePayload)> + '_

Retained Surface buckets without expanding statements or lifting Resource relations. Each handle names its exact bucket, including parallel pairs. This is a raw retained-history view; use held relation iterators for ordinary reads. Tombstone-only buckets remain included.

Source

pub fn surface_outgoing_relation_buckets( &self, from: NodeKey, ) -> impl Iterator<Item = (EdgeKey, NodeKey, NodeKey, &EdgePayload)> + '_

Held Surface buckets outgoing from from, including every parallel bucket without expanding its assertions. Cost is proportional to the node’s out-degree.

Source

pub fn projected_relations( &self, ) -> impl Iterator<Item = (RelationKey, RelationView)> + '_

Surface relations followed by content relations lifted to every pair of surfaces showing their endpoints. The handle retains its owning store; projection does not copy resource assertions into the surface graph.

Source

pub fn projected_assertions( &self, ) -> impl Iterator<Item = (RelationKey, NodeKey, NodeKey, &SemanticStatement)> + '_

Every exact held assertion lifted to its displayed endpoint pairs. Traversal remains an event rollup and is not an assertion record.

Source

pub fn outgoing_relations( &self, key: NodeKey, ) -> impl Iterator<Item = RelationView> + '_

Relations whose from endpoint is key, expanded with exactly the row semantics of Self::relations but visiting only that node’s outgoing edges. Cost is proportional to the node’s out-degree, not the graph’s edge count.

Source

pub fn incoming_relations( &self, key: NodeKey, ) -> impl Iterator<Item = RelationView> + '_

Relations whose to endpoint is key, expanded with exactly the row semantics of Self::relations but visiting only that node’s incoming edges. Cost is proportional to the node’s in-degree, not the graph’s edge count.

Source

pub fn semantic_edges(&self) -> impl Iterator<Item = SemanticEdgeView> + '_

Source

pub fn arrangement_edges( &self, ) -> impl Iterator<Item = ArrangementEdgeView> + '_

Source

pub fn containment_edges( &self, ) -> impl Iterator<Item = ContainmentEdgeView> + '_

Source

pub fn derive_containment_for(&mut self, key: NodeKey)

Derive the containment this one node’s address implies, at the moment the node is created.

Current relation routing stores this assertion on Resources. Ordinary snapshot loading separately rebuilds compatibility Surface containment; recorded loading preserves stored relations without that rebuild. Both strata are included in snapshots.

The UrlPath half of [rebuild_derived_containment_relations], applied to a single node. It exists because that rebuild runs only on snapshot load, which used to mean a node visited under a folder had no containment edge until the session was saved and reloaded. Anything reading containment live (a graph behavior’s watch, which names a region by its container) saw nothing there. Deriving at creation makes the local relation available before the first save.

The Domain half is deliberately not here. A domain anchor is the shallowest node on a host, so minting one node can re-anchor every other node sharing that host: a whole-graph fact, which stays with the whole-graph rebuild. This one is purely local, which is what makes it cheap enough to run per node.

Source

pub fn out_neighbors(&self, key: NodeKey) -> impl Iterator<Item = NodeKey> + '_

Iterate outgoing neighbor keys for a node

Source

pub fn in_neighbors(&self, key: NodeKey) -> impl Iterator<Item = NodeKey> + '_

Iterate incoming neighbor keys for a node

Source

pub fn neighbors_undirected( &self, key: NodeKey, ) -> impl Iterator<Item = NodeKey> + '_

Iterate undirected neighbor keys for a node, Surface stratum only. projected_neighbors reads both strata.

Source

pub fn projected_neighbors( &self, key: NodeKey, ) -> impl Iterator<Item = NodeKey> + '_

Every node adjacent to key in either direction across both strata: the Surface neighbours, plus the surfaces showing the far end of each Resource relation of the resource key shows. One entry per incident held relation, so parallel relations repeat; a self-loop is read once, from its outgoing side, so a node adjacent to itself appears once. Hides are a view concern and do not apply here.

Source

pub fn neighbors_undirected_sorted(&self, key: NodeKey) -> Vec<NodeKey> ⓘ

Undirected neighbors sorted by stable node-key order.

Source

pub fn connected_frame_import_nodes(&self, seeds: &[NodeKey]) -> Vec<NodeKey> ⓘ

Seed nodes plus one-hop undirected neighbors for frame import workflows.

Source

pub fn connected_candidates_with_depth( &self, source: NodeKey, max_depth: u8, ) -> Vec<(NodeKey, u8)>

Connected candidate expansion around a source node with depth annotations.

max_depth currently supports 1 or 2, matching connected-open scope behavior.

Source

pub fn hop_distances_from(&self, source: NodeKey) -> HashMap<NodeKey, usize>

Undirected hop distances from source using unit edge weights.

Source

pub fn orphan_node_keys(&self) -> Vec<NodeKey> ⓘ

Nodes with no incoming or outgoing edges.

Source

pub fn shortest_path(&self, from: NodeKey, to: NodeKey) -> Option<Vec<NodeKey>>

Shortest undirected path between two nodes using unit edge weights.

Source

pub fn is_reachable(&self, from: NodeKey, to: NodeKey) -> bool

Reachability in the undirected graph.

Source

pub fn weakly_connected_components(&self) -> Vec<Vec<NodeKey>>

Weakly connected components of the surface stratum (undirected projection), a topology metric like Self::orphan_node_keys. Resource relations and shown bindings do not join here; the semantic Component is Self::component_members.

Source

pub fn component_members( &self, seed: Uuid, selectors: &[RelationSelector], ) -> Vec<Uuid>

Surfaces reachable from seed through either stratum’s undirected relations. Shown bindings join at zero hops, including through unshown resources. Empty if seed is not a surface in the graph. selectors is the edge projection: only edges matching a selector are followed (an empty slice follows every family). So the same nodes can be one Component under one projection and a different one under another. The Component subgraph’s derivation. (Subgraph derivation, Phase 3 — selectors.)

Source

pub fn ego_members( &self, seed: Uuid, radius: u8, selectors: &[RelationSelector], ) -> Vec<Uuid>

The Ego neighborhood of seed: surfaces within radius undirected relation hops across both strata. Shown bindings cost zero, so radius 0 also includes surfaces showing the seed’s resource. Uses the selectors edge projection (empty = all families). The Ego subgraph’s derivation. (Subgraph derivation, Phase 3 — selectors.)

Source

pub fn strongly_connected_components(&self) -> Vec<Vec<NodeKey>>

Strongly connected components in the directed graph.

Source

pub fn has_edge_between(&self, from: NodeKey, to: NodeKey) -> bool

Check if a directed edge exists from from to to

Source

pub fn node_count(&self) -> usize

Count of nodes in the graph

Source

pub fn edge_count(&self) -> usize

Count of retained Surface buckets, including tombstone-only history. Use held topology queries when asking how many relations are active.

Source§

impl Graph

Source

pub fn node_display_label(&self, key: NodeKey) -> String

A human-meaningful label for key’s node (see the module docs for the derivation). Empty string if the key is not in the graph. Full text, not width-clamped: a caller drawing into a fixed box truncates.

Source

pub fn node_display_caption(&self, key: NodeKey) -> String

The document’s label with its host appended (label · host) when the label does not already name it: the at-rest “where am I” caption. The one label with a host added, not a second derivation.

Source§

impl Graph

Source

pub fn try_from_snapshot( snapshot: &GraphSnapshot, ) -> Result<Self, ResourceSnapshotError>

Check all explicit resource columns and navigation indices before loading either graph stratum. Legacy surface conversion retains its existing compatibility behavior.

Source

pub fn try_from_recorded_snapshot( snapshot: &GraphSnapshot, ) -> Result<Self, ResourceSnapshotError>

Load caller-qualified recorded truth without deriving relations from current URLs. Explicit resource columns and navigation receive the same validation as legacy loads.

Source§

impl Graph

Source

pub fn from_snapshot(snapshot: &GraphSnapshot) -> Self

Load a snapshot, stopping on invalid explicit resource data or navigation indices. Fallible load boundaries should use Self::try_from_snapshot.

Source§

impl Graph

Source

pub fn to_snapshot(&self) -> GraphSnapshot

The graph’s snapshot, dated now by the wall clock.

Source

pub fn to_snapshot_at(&self, timestamp_secs: u64) -> GraphSnapshot

The graph’s snapshot dated timestamp_secs, reading no clock: two snapshots of one graph at one date are equal whenever they are taken (reservoir plan ruling 47).

Source§

impl Graph

Source

pub fn persisted_edges_between( &self, from: NodeKey, to: NodeKey, ) -> Vec<PersistedEdge>

Every live Surface edge from from to to, in exact capture order. Retains session arrangements that durable snapshots intentionally omit.

Source§

impl Graph

Source

pub fn new() -> Self

Create a new empty graph

Source

pub fn set_recorder(&mut self, recorder: Option<DeltaRecorder>)

Send every delta this graph applies through apply_graph_delta to recorder, or stop with None. The per-graph twin of the thread’s capture hook: a host holding many session graphs records each into its own journal. A clone of this graph, and a replay onto it, record nothing.

Source

pub fn is_recording(&self) -> bool

Whether this graph records its deltas.

Source

pub fn write_author(&self) -> &Author

The recorder identity used when a writer has no attributed source.

Source

pub fn write_as<R>( &mut self, author: Author, write: impl FnOnce(&mut Self) -> R, ) -> R

Run a write under the same author its journal will record.

Source

pub fn set_current_session(&mut self, session: u64)

Set the current app-launch session number (Alembic B5). The host calls this once, right after construction or snapshot-restore, with its persisted-and-incremented session counter; every navigate_node call afterwards stamps the visited node’s [Node::last_session_visited] with this value.

Source

pub fn current_session(&self) -> u64

The launch number set_current_session installed.

Source

pub fn revision(&self) -> u64

The current structural revision (see revision). A consumer captures it alongside a derived result and recomputes only when it has advanced. (Graph signals.)

Source

pub fn url_grouping_revision(&self) -> u64

The current URL-authority grouping revision. This advances only when a node’s primary URL moves between site groups, letting site-grouped projections refresh without invalidating structural caches for an ordinary same-site navigation.

Source

pub fn content_revision(&self) -> u64

The current content revision (see the field’s doc): it advances on a node’s title or primary URL changing and on a node joining or leaving, never on an edge or relation change.

Source

pub fn visit_revision(&self) -> u64

The current visit revision (see the field’s doc): it advances when a node’s visit history may have changed, never on structure or text.

Source

pub fn url_grouping_key(url: &str) -> &str

The categorical site key used by URL-grouped projections: the authority after :// and before a path, query, or fragment, or the whole hostless input. It deliberately retains ports and opaque values.

Source

pub fn node_namespace_id(url: &str) -> Uuid

The deterministic node UUID for url: a name-based UUIDv5 under NODE_NAMESPACE. Two hosts that materialize the same url mint the same id, so a federated merge needs no identity reconciliation. The linked-data ingest layer uses this for a document’s @id, where the URL is the identity. Raw [add_node] keeps a fresh random id, because the kernel treats a node’s address as a property and lets several nodes share one (see get_nodes_by_url).

Source

pub fn node_can_back(&self, key: NodeKey) -> bool

Whether key’s within-node history can step back (toolbar gating).

Source

pub fn node_can_forward(&self, key: NodeKey) -> bool

Whether key’s within-node history can step forward (toolbar gating).

Source

pub fn node_history_projection(&self, key: NodeKey) -> NodeHistoryProjection

key’s linear-history projection (active path + cursor).

Source

pub fn node_history_branch_projection( &self, key: NodeKey, ) -> NodeHistoryBranchProjection

key’s branching-history projection (visit tree with alternates).

Source

pub fn node_history_semantic_summary( &self, key: NodeKey, ) -> NodeHistorySemanticSummary

A coarse semantic summary of key’s history.

Trait Implementations§

Source§

impl Archive for Graph

Source§

type Archived = <GraphSnapshot as Archive>::Archived

The archived representation of this type. Read more
Source§

type Resolver = <GraphSnapshot as Archive>::Resolver

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
Source§

fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)

Creates the archived version of this value at the given position and writes it to the given output. Read more
Source§

const COPY_OPTIMIZATION: CopyOptimization<Self> = _

An optimization flag that allows the bytes of this type to be copied directly to a writer instead of calling serialize. Read more
Source§

impl Clone for Graph

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Graph

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<D> Deserialize<Graph, D> for Archived<GraphSnapshot>

Source§

fn deserialize(&self, deserializer: &mut D) -> Result<Graph, D::Error>

Deserializes using the given deserializer
Source§

impl<S> Serialize<S> for Graph

Source§

fn serialize(&self, serializer: &mut S) -> Result<Self::Resolver, S::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Graph

§

impl !UnwindSafe for Graph

§

impl Freeze for Graph

§

impl Send for Graph

§

impl Sync for Graph

§

impl Unpin for Graph

§

impl UnsafeUnpin for Graph

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> ArchiveUnsized for T
where T: Archive,

Source§

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized. Read more
Source§

fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata

Creates the archived version of the metadata for this value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Fallible + Writer + ?Sized,

Source§

fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.