pub struct GraphProjectionSpec {
pub node_labels: Vec<String>,
pub edge_types: Vec<String>,
pub weight_property: Option<String>,
pub include_reverse: bool,
pub node_properties: Vec<String>,
pub edge_properties: Vec<String>,
pub project_all: bool,
}Expand description
Selects which subgraph an AlgorithmHost::project call materializes.
Naming node_labels / edge_types scopes the projection to exactly those.
Leaving BOTH empty means “the whole graph”, but that is only honored when
Self::project_all is true — otherwise the projection fails loud (G9),
so an unscoped projection can never silently pull in unrelated labels (e.g.
a coexisting search tree) and corrupt an index-keyed kernel. weight_property
names an edge property to expose through GraphView::out_weight;
include_reverse requests inbound adjacency (GraphView::in_neighbors).
Fields§
§node_labels: Vec<String>Vertex labels to include; empty (with Self::project_all) selects every label.
edge_types: Vec<String>Edge types to include; empty (with Self::project_all) selects every type.
weight_property: Option<String>Edge property surfaced as the traversal weight, if any.
include_reverse: boolWhether to also build inbound adjacency.
node_properties: Vec<String>Vertex properties to materialize into per-vertex [V] tensors the guest
reads by name via gc.node_property (issue #151).
edge_properties: Vec<String>Edge properties to materialize into per-edge [E] tensors the guest
reads by name via gc.edge_property (issue #151).
project_all: boolDeliberate opt-in to projecting the whole graph when neither
node_labels nor edge_types is named (G9). With both empty and this
false, AlgorithmHost::project fails loud instead of silently
pulling in every schema label/edge-type. First-party providers set this
to preserve the ergonomic whole-graph default; guest loaders must pass
projectAll: true in their config to project everything on purpose.
Implementations§
Source§impl GraphProjectionSpec
impl GraphProjectionSpec
Sourcepub const CONFIG_KEYS: &'static [&'static str]
pub const CONFIG_KEYS: &'static [&'static str]
Keys that mark a trailing CALL argument as a projection-config object (a “graphRef”) rather than a guest algorithm argument. Covers the Native knobs, the P2 property-tensor knobs, and the P3 Cypher/Named graphRef knobs so the trailing object is stripped from the guest’s arguments consistently across every projection mode.
Sourcepub const QUERY_CONFIG_KEYS: &'static [&'static str]
pub const QUERY_CONFIG_KEYS: &'static [&'static str]
Keys that mark a config object as a Cypher/Named graphRef rather
than a Native label/edge-type scoping object.
Single-sourced so the query layer’s graphRef sniffing and the per-scope parsing below cannot drift: a scope routed to the Native storage scan when it names a Cypher query would silently project the wrong graph.
Sourcepub fn from_config_object(cfg: &Map<String, Value>) -> Self
pub fn from_config_object(cfg: &Map<String, Value>) -> Self
Parses the Native-mode projection knobs from a guest/procedure config
object. This is the single source of truth for nodeLabels /
edgeTypes (accepting the relationshipTypes alias) / weightProperty
/ includeReverse — the native providers and all four guest loaders
funnel through it so the knob names cannot drift.
includeReverse defaults to true (inbound adjacency is built unless
the caller opts out), matching the graphRef contract in uni-algo and
keeping In-direction kernels (WCC / k-core / HITS) working. Unknown keys
are ignored and malformed values fall back to the field default: this is
a best-effort projection hint, not a strict schema.
Sourcepub fn is_query_graph_ref(cfg: &Map<String, Value>) -> bool
pub fn is_query_graph_ref(cfg: &Map<String, Value>) -> bool
Whether a config object names a Cypher/Named projection.
Sourcepub fn scopes_from_config_object(
cfg: &Map<String, Value>,
) -> Result<Vec<GraphScopeSpec>, String>
pub fn scopes_from_config_object( cfg: &Map<String, Value>, ) -> Result<Vec<GraphScopeSpec>, String>
Parses the scopes map into pre-declared named projections.
A guest that needs more than one view of the store declares them at the CALL site rather than projecting on demand, because projection is the one thing a guest must not be able to trigger in a loop:
CALL myplugin.compare([], {
nodeLabels: ['Cell'], edgeTypes: ['ADJ'],
scopes: {
agg: {nodeLabels: ['Cell'], edgeTypes: ['AGGREGATES']},
flow: {nodeQuery: 'MATCH (c:Cell) RETURN id(c) AS id'}
}
})The outer object stays the primary projection — the one emit keys its
nodeId column to. Each scope value is parsed by the same
Self::from_config_object, so every Native knob works per scope; a
scope bearing a Cypher/Named key is carried through verbatim for the
resolver instead.
§Errors
Returns a message naming the offending scope when scopes is not an
object, a scope name is empty, a scope value is not an object, or a scope
is named graph (which would shadow the primary handle’s own accessor).
Sourcepub fn reject_scopes(
cfg: &Map<String, Value>,
algorithm: &str,
) -> Result<(), FnError>
pub fn reject_scopes( cfg: &Map<String, Value>, algorithm: &str, ) -> Result<(), FnError>
Rejects a scopes map on an algorithm that does not consume one.
scopes joined Self::CONFIG_KEYS so a scopes-only object is stripped
from the guest’s positional arguments. That stripping applies to every
algorithm, but only the guest loader adapters build the declared
projections — so without this a first-party provider would accept a
scopes map, project nothing, and run as if it had never been asked.
Silently ignoring a projection the caller asked for is the same failure
the unscoped-projection change (G9) made loud; this keeps it loud.
§Errors
Returns 0x86E naming algorithm when cfg carries a non-empty scopes.
Sourcepub fn take_config_from_args(
args: &mut Vec<Value>,
) -> Option<Map<String, Value>>
pub fn take_config_from_args( args: &mut Vec<Value>, ) -> Option<Map<String, Value>>
Like Self::take_from_args but also returns the raw config object.
Self::take_from_args discards the object after parsing, which is fine
for the Native knobs but loses scopes (whose values must be re-parsed
per scope, and whose Cypher entries must survive verbatim).
Sourcepub fn take_from_args(args: &mut Vec<Value>) -> Option<Self>
pub fn take_from_args(args: &mut Vec<Value>) -> Option<Self>
If the last element of args is a JSON object bearing at least one
Self::CONFIG_KEYS key, removes it from args and returns the parsed
Native spec; otherwise leaves args untouched and returns None.
The Native-spec half of the “trailing object is the projection config”
convention. The guest loaders now go through
ProjectionPlan,
which needs the raw object to parse scopes; this remains for callers
that want only the Native knobs. Both share
Self::take_config_from_args, so the recognition rule cannot drift.
In P3 Cypher/Named
mode the returned Native spec is empty (the query/name keys are unknown
to Self::from_config_object) and is ignored by the bridge in favor of
the pre-built projection — but the object is still stripped here so it
never reaches the guest function.
Trait Implementations§
Source§impl Clone for GraphProjectionSpec
impl Clone for GraphProjectionSpec
Source§fn clone(&self) -> GraphProjectionSpec
fn clone(&self) -> GraphProjectionSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphProjectionSpec
impl Debug for GraphProjectionSpec
Source§impl Default for GraphProjectionSpec
impl Default for GraphProjectionSpec
Source§fn default() -> GraphProjectionSpec
fn default() -> GraphProjectionSpec
Auto Trait Implementations§
impl Freeze for GraphProjectionSpec
impl RefUnwindSafe for GraphProjectionSpec
impl Send for GraphProjectionSpec
impl Sync for GraphProjectionSpec
impl Unpin for GraphProjectionSpec
impl UnsafeUnpin for GraphProjectionSpec
impl UnwindSafe for GraphProjectionSpec
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more