Skip to main content

GraphMutator

Struct GraphMutator 

Source
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

Source

pub fn new(base_graph: StaticGraph) -> Self

Create a new GraphMutator from a base graph

Source

pub fn with_options(base_graph: StaticGraph, options: MutatorOptions) -> Self

Create a new GraphMutator with custom options

Source

pub fn mutations(&self) -> &[GraphMutation]

Get the list of pending mutations (for debugging/serialization)

Source

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)

Source

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

Source

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)

Source

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

Source

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

Source

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

Source

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)

Source

pub fn add_card( self, nodegroup_id: &str, name: &str, options: CardOptions, config: Option<Value>, ) -> Self

Add a card for a nodegroup

Source

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

Source

pub fn build(self) -> Result<StaticGraph, MutationError>

Apply all mutations and return the resulting graph

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> 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, 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.