Mnemosyne.Graph.Changeset (mnemosyne v0.1.6)

Copy Markdown View Source

Batched mutations for the knowledge graph.

A changeset accumulates node additions and link operations that can be applied atomically to a Mnemosyne.Graph.

Summary

Functions

Records a typed link between two node IDs in the changeset.

Appends a node to the changeset's addition list.

Merges two changesets by concatenating their additions, links, and metadata maps.

Creates an empty changeset.

Associates metadata with a node ID in the changeset.

Types

t()

@type t() :: %Mnemosyne.Graph.Changeset{
  additions: [struct()],
  links: [{String.t(), String.t(), Mnemosyne.Graph.Edge.edge_type()}],
  metadata: %{required(String.t()) => Mnemosyne.NodeMetadata.t()}
}

Functions

add_link(cs, id_a, id_b, type)

@spec add_link(t(), String.t(), String.t(), Mnemosyne.Graph.Edge.edge_type()) :: t()

Records a typed link between two node IDs in the changeset.

add_node(cs, node)

@spec add_node(
  t(),
  struct()
) :: t()

Appends a node to the changeset's addition list.

merge(a, b)

@spec merge(t(), t()) :: t()

Merges two changesets by concatenating their additions, links, and metadata maps.

new()

@spec new() :: t()

Creates an empty changeset.

put_metadata(cs, node_id, meta)

@spec put_metadata(t(), String.t(), Mnemosyne.NodeMetadata.t()) :: t()

Associates metadata with a node ID in the changeset.