pub struct GraphMutator { /* private fields */ }Expand description
Builder for constructing and modifying graphs
Uses a combination of Builder and Command patterns:
- Builder pattern for ergonomic, chainable API
- Command pattern for serializable, replayable mutations
Implementations§
Source§impl GraphMutator
impl GraphMutator
Sourcepub fn new(base_graph: StaticGraph) -> Self
pub fn new(base_graph: StaticGraph) -> Self
Create a new GraphMutator from a base graph
Sourcepub fn with_options(base_graph: StaticGraph, options: MutatorOptions) -> Self
pub fn with_options(base_graph: StaticGraph, options: MutatorOptions) -> Self
Create a new GraphMutator with custom options
Sourcepub fn mutations(&self) -> &[GraphMutation]
pub fn mutations(&self) -> &[GraphMutation]
Get the list of pending mutations (for debugging/serialization)
Sourcepub fn add_semantic_node(
self,
parent_alias: Option<&str>,
alias: &str,
name: &str,
cardinality: Cardinality,
ontology_class: &str,
parent_property: &str,
description: Option<&str>,
options: NodeOptions,
config: Option<Value>,
) -> Self
pub fn add_semantic_node( self, parent_alias: Option<&str>, alias: &str, name: &str, cardinality: Cardinality, ontology_class: &str, parent_property: &str, description: Option<&str>, options: NodeOptions, config: Option<Value>, ) -> Self
Add a semantic node (structural grouping node)
Sourcepub fn add_string_node(
self,
parent_alias: Option<&str>,
alias: &str,
name: &str,
cardinality: Cardinality,
ontology_class: &str,
parent_property: &str,
description: Option<&str>,
options: NodeOptions,
config: Option<Value>,
) -> Self
pub fn add_string_node( self, parent_alias: Option<&str>, alias: &str, name: &str, cardinality: Cardinality, ontology_class: &str, parent_property: &str, description: Option<&str>, options: NodeOptions, config: Option<Value>, ) -> Self
Add a string node
Sourcepub fn add_concept_node(
self,
parent_alias: Option<&str>,
alias: &str,
name: &str,
collection_id: Option<&str>,
is_list: bool,
cardinality: Cardinality,
ontology_class: &str,
parent_property: &str,
description: Option<&str>,
options: NodeOptions,
config: Option<Value>,
) -> Self
pub fn add_concept_node( self, parent_alias: Option<&str>, alias: &str, name: &str, collection_id: Option<&str>, is_list: bool, cardinality: Cardinality, ontology_class: &str, parent_property: &str, description: Option<&str>, options: NodeOptions, config: Option<Value>, ) -> Self
Add a concept node (RDM collection reference)
Sourcepub fn add_number_node(
self,
parent_alias: Option<&str>,
alias: &str,
name: &str,
cardinality: Cardinality,
ontology_class: &str,
parent_property: &str,
description: Option<&str>,
options: NodeOptions,
config: Option<Value>,
) -> Self
pub fn add_number_node( self, parent_alias: Option<&str>, alias: &str, name: &str, cardinality: Cardinality, ontology_class: &str, parent_property: &str, description: Option<&str>, options: NodeOptions, config: Option<Value>, ) -> Self
Add a number node
Sourcepub fn add_date_node(
self,
parent_alias: Option<&str>,
alias: &str,
name: &str,
cardinality: Cardinality,
ontology_class: &str,
parent_property: &str,
description: Option<&str>,
options: NodeOptions,
config: Option<Value>,
) -> Self
pub fn add_date_node( self, parent_alias: Option<&str>, alias: &str, name: &str, cardinality: Cardinality, ontology_class: &str, parent_property: &str, description: Option<&str>, options: NodeOptions, config: Option<Value>, ) -> Self
Add a date node
Sourcepub fn add_boolean_node(
self,
parent_alias: Option<&str>,
alias: &str,
name: &str,
cardinality: Cardinality,
ontology_class: &str,
parent_property: &str,
description: Option<&str>,
options: NodeOptions,
config: Option<Value>,
) -> Self
pub fn add_boolean_node( self, parent_alias: Option<&str>, alias: &str, name: &str, cardinality: Cardinality, ontology_class: &str, parent_property: &str, description: Option<&str>, options: NodeOptions, config: Option<Value>, ) -> Self
Add a boolean node
Sourcepub fn add_generic_node(
self,
parent_alias: Option<&str>,
alias: &str,
name: &str,
cardinality: Cardinality,
datatype: &str,
ontology_class: &str,
parent_property: &str,
description: Option<&str>,
options: NodeOptions,
config: Option<Value>,
) -> Self
pub fn add_generic_node( self, parent_alias: Option<&str>, alias: &str, name: &str, cardinality: Cardinality, datatype: &str, ontology_class: &str, parent_property: &str, description: Option<&str>, options: NodeOptions, config: Option<Value>, ) -> Self
Add a generic node with any datatype (consuming builder pattern)
Sourcepub fn add_card(
self,
nodegroup_id: &str,
name: &str,
options: CardOptions,
config: Option<Value>,
) -> Self
pub fn add_card( self, nodegroup_id: &str, name: &str, options: CardOptions, config: Option<Value>, ) -> Self
Add a card for a nodegroup
Sourcepub fn add_widget_to_card(
self,
node_id: &str,
widget: &Widget,
label: &str,
config: Value,
sortorder: Option<i32>,
visible: Option<bool>,
) -> Self
pub fn add_widget_to_card( self, node_id: &str, widget: &Widget, label: &str, config: Value, sortorder: Option<i32>, visible: Option<bool>, ) -> Self
Add a widget to a card
Sourcepub fn build(self) -> Result<StaticGraph, MutationError>
pub fn build(self) -> Result<StaticGraph, MutationError>
Apply all mutations and return the resulting graph
Auto Trait Implementations§
impl Freeze for GraphMutator
impl RefUnwindSafe for GraphMutator
impl Send for GraphMutator
impl Sync for GraphMutator
impl Unpin for GraphMutator
impl UnsafeUnpin for GraphMutator
impl UnwindSafe for GraphMutator
Blanket Implementations§
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
Mutably borrows from an owned value. Read more