Skip to main content

StaticGraph

Struct StaticGraph 

Source
pub struct StaticGraph {
Show 35 fields pub graphid: String, pub name: StaticTranslatableString, pub author: Option<String>, pub subtitle: Option<StaticTranslatableString>, pub description: Option<StaticTranslatableString>, pub nodes: Vec<StaticNode>, pub nodegroups: Vec<StaticNodegroup>, pub edges: Vec<StaticEdge>, pub root: StaticNode, pub version: Option<String>, pub iconclass: Option<String>, pub color: Option<String>, pub isresource: Option<bool>, pub slug: Option<String>, pub is_editable: Option<bool>, pub ontology_id: Option<Vec<String>>, pub template_id: Option<String>, pub deploymentdate: Option<String>, pub deploymentfile: Option<String>, pub jsonldcontext: Option<String>, pub config: Value, pub relatable_resource_model_ids: Vec<String>, pub publication: Option<Value>, pub resource_2_resource_constraints: Option<Vec<Value>>, pub source_identifier_id: Option<String>, pub is_active: Option<bool>, pub has_unpublished_changes: Option<bool>, pub is_copy_immutable: Option<bool>, pub resource_instance_lifecycle: Option<Value>, pub spatial_views: Option<Value>, pub group_permissions: Option<Value>, pub user_permissions: Option<Value>, pub cards: Option<Vec<StaticCard>>, pub cards_x_nodes_x_widgets: Option<Vec<StaticCardsXNodesXWidgets>>, pub functions_x_graphs: Option<Vec<StaticFunctionsXGraphs>>, /* private fields */
}
Expand description

The main graph structure containing nodes, edges, and metadata

Fields§

§graphid: String§name: StaticTranslatableString§author: Option<String>§subtitle: Option<StaticTranslatableString>§description: Option<StaticTranslatableString>§nodes: Vec<StaticNode>§nodegroups: Vec<StaticNodegroup>§edges: Vec<StaticEdge>§root: StaticNode§version: Option<String>§iconclass: Option<String>§color: Option<String>§isresource: Option<bool>§slug: Option<String>§is_editable: Option<bool>§ontology_id: Option<Vec<String>>

Ontology IDs used by this graph. Accepts a single string or an array of strings on the wire; a single-element list is serialised as a plain string for round-trip compatibility with upstream Arches.

§template_id: Option<String>§deploymentdate: Option<String>§deploymentfile: Option<String>§jsonldcontext: Option<String>§config: Value§relatable_resource_model_ids: Vec<String>§publication: Option<Value>§resource_2_resource_constraints: Option<Vec<Value>>§source_identifier_id: Option<String>

Source identifier for import/export tracking

§is_active: Option<bool>

Whether graph is active

§has_unpublished_changes: Option<bool>

Whether graph has unpublished changes

§is_copy_immutable: Option<bool>

Whether copy is immutable

§resource_instance_lifecycle: Option<Value>

Resource instance lifecycle configuration

§spatial_views: Option<Value>

Spatial views configuration

§group_permissions: Option<Value>

Group permissions

§user_permissions: Option<Value>

User permissions

§cards: Option<Vec<StaticCard>>§cards_x_nodes_x_widgets: Option<Vec<StaticCardsXNodesXWidgets>>§functions_x_graphs: Option<Vec<StaticFunctionsXGraphs>>

Implementations§

Source§

impl StaticGraph

Source

pub fn from_json_string(json_str: &str) -> Result<StaticGraph, String>

Load a graph from a JSON string Handles both direct graph objects and wrapped format: {“graph”: […]}

Source

pub fn build_indices(&mut self)

Build the internal lookup indices

Source

pub fn invalidate_indices(&mut self)

Invalidate all internal lookup indices.

This must be called after mutations that modify the nodes vector, especially operations like retain() that shift element positions.

Source

pub fn get_root(&self) -> &StaticNode

Get the root node

Source

pub fn get_node_by_index(&self, idx: usize) -> Option<&StaticNode>

Get node by index

Source

pub fn get_node_by_id(&self, id: &str) -> Option<&StaticNode>

Get node by ID

Source

pub fn get_node_by_alias(&self, alias: &str) -> Option<&StaticNode>

Get node by alias

Source

pub fn display_name(&self) -> String

Get display name

Source

pub fn display_subtitle(&self) -> String

Get subtitle

Source

pub fn display_author(&self) -> String

Get author

Source

pub fn nodes_slice(&self) -> &[StaticNode]

Get nodes slice

Source

pub fn nodegroups_slice(&self) -> &[StaticNodegroup]

Get nodegroups slice

Source

pub fn edges_slice(&self) -> &[StaticEdge]

Get edges slice

Source

pub fn root_node(&self) -> &StaticNode

Get root node

Source

pub fn graph_id(&self) -> &str

Get graph ID

Source

pub fn get_model_class_name(&self) -> Option<String>

Get the model class name for this graph.

This returns the graph’s display name, which is used as the ResourceInstanceCacheEntry “type” field in TypeScript.

Source

pub fn edges_map(&self) -> Option<&HashMap<String, Vec<String>>>

Get edges map (parent_nodeid -> child_nodeids) Returns None if indices haven’t been built

Source

pub fn get_child_ids(&self, node_id: &str) -> Option<&Vec<String>>

Get child node IDs for a given node

Source

pub fn nodes_by_nodegroup(&self) -> Option<&HashMap<String, Vec<usize>>>

Get nodes by nodegroup (nodegroup_id -> node indices) Returns None if indices haven’t been built

Source

pub fn get_nodes_in_nodegroup(&self, nodegroup_id: &str) -> Vec<&StaticNode>

Get nodes in a specific nodegroup

Source

pub fn get_nodegroup_by_id( &self, nodegroup_id: &str, ) -> Option<&StaticNodegroup>

Get nodegroup by ID

Source

pub fn nodes_by_alias_arc(&self) -> Option<&HashMap<String, Arc<StaticNode>>>

Get Arc-wrapped nodes by alias map (for pseudo_value infrastructure) Returns None if indices haven’t been built

Source

pub fn get_node_arc_by_alias(&self, alias: &str) -> Option<Arc<StaticNode>>

Get Arc-wrapped node by alias

Source

pub fn deep_clone(&self) -> Self

Create a deep clone of the graph with fresh indices

Source

pub fn push_node(&mut self, node: StaticNode)

Push a new node to the graph

Note: You must call build_indices() after all mutations to rebuild lookup tables.

Source

pub fn push_edge(&mut self, edge: StaticEdge)

Push a new edge to the graph

Source

pub fn push_nodegroup(&mut self, nodegroup: StaticNodegroup)

Push a new nodegroup to the graph

Source

pub fn push_card(&mut self, card: StaticCard)

Push a new card to the graph

Source

pub fn push_card_x_node_x_widget(&mut self, cxnxw: StaticCardsXNodesXWidgets)

Push a new cards_x_nodes_x_widgets entry

Source

pub fn cards_slice(&self) -> &[StaticCard]

Get cards slice (for mutation checks)

Source

pub fn card_index(&self) -> Option<&CardIndex>

Get the card hierarchy index (None if graph has no cards)

Source

pub fn cards_x_nodes_x_widgets_slice(&self) -> &[StaticCardsXNodesXWidgets]

Get cards_x_nodes_x_widgets slice

Source

pub fn find_card_by_nodegroup(&self, nodegroup_id: &str) -> Option<&StaticCard>

Find a card by nodegroup_id

Source

pub fn find_node_by_alias(&self, alias: &str) -> Option<&StaticNode>

Find a node by alias (without requiring indices to be built)

Source

pub fn get_schema(&self) -> Value

Get a simplified schema view of the graph showing node aliases and structure.

Returns a nested structure representing the tree with:

  • Keys are node aliases (or nodeid if no alias)
  • Values contain ‘datatype’, ‘nodeid’, optionally ‘required’, and ‘children’

Useful for understanding what keys are available in tree output.

Source

pub fn set_descriptor_template( &mut self, descriptor_type: &str, string_template: &str, ) -> Result<(), String>

Set a descriptor template for a given descriptor type (e.g. “slug”, “name”).

The nodegroup_id is inferred from the <Node Name> placeholders in the template by looking up nodes in the graph. All placeholder nodes must belong to exactly one nodegroup — returns an error otherwise.

Creates or updates the descriptor function entry in functions_x_graphs.

Trait Implementations§

Source§

impl Clone for StaticGraph

Source§

fn clone(&self) -> StaticGraph

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 Debug for StaticGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StaticGraph

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StaticGraph

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.