Paradigm.Graph protocol (paradigm v0.2.0)

Defines the behaviour for Graph implementations. This decouples operations (conformance, abstraction, transforms) from the underlying graph storage. Think of "data" as "all the information that the implementation requires to complete the operation". It might be the graph itself, or a pointer to an external source.

Summary

Types

t()

All the types that implement this protocol.

Types

class_id()

@type class_id() :: Paradigm.id()

node_id()

@type node_id() :: Paradigm.id()

t()

@type t() :: term()

All the types that implement this protocol.

Functions

follow_reference(data, node_id, reference)

@spec follow_reference(t(), node_id(), any()) :: Node.t() | nil

get_all_classes(data)

@spec get_all_classes(t()) :: [class_id()]

get_all_nodes(data)

@spec get_all_nodes(t()) :: [node_id()]

get_all_nodes_of_class(data, class_id)

@spec get_all_nodes_of_class(t(), class_id() | [class_id()]) :: [node_id()]

get_node(data, node_id)

@spec get_node(t(), node_id()) :: Node.t() | nil

get_node_data(data, node_id, key, default)

@spec get_node_data(t(), node_id(), any(), any()) :: any()

insert_node(data, node_id, class_id, attrs)

@spec insert_node(t(), node_id(), class_id(), map()) :: t()

insert_nodes(data, nodes)

@spec insert_nodes(t(), map() | list()) :: t()