ArangoDB's Graphs operations.
Every function takes the pool as its first argument and returns the decoded
response body. See Arangox.API.Client for the options they all accept and
for what a 404 returns.
Summary
Functions
Add a node collection
Add a node collection. Raises on error.
List all graphs
List all graphs. Raises on error.
List edge collections
List edge collections. Raises on error.
List node collections
List node collections. Raises on error.
Create a graph
Create a graph. Raises on error.
Create an edge
Create an edge. Raises on error.
Add an edge definition
Add an edge definition. Raises on error.
Create a node
Create a node. Raises on error.
Drop a graph
Drop a graph. Raises on error.
Remove an edge
Remove an edge. Raises on error.
Remove an edge definition
Remove an edge definition. Raises on error.
Remove a node. Raises on error.
Remove a node collection
Remove a node collection. Raises on error.
Get a graph
Get a graph. Raises on error.
Get an edge. Raises on error.
Get a node. Raises on error.
Replace an edge
Replace an edge. Raises on error.
Replace an edge definition
Replace an edge definition. Raises on error.
Replace a node. Raises on error.
Update an edge
Update an edge. Raises on error.
Update a node. Raises on error.
Get inbound and outbound edges
Get inbound and outbound edges. Raises on error.
Functions
@spec add_vertex_collection(Arangox.conn(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Add a node collection
Adds a node collection to the set of orphan collections of the graph. If the collection does not exist, it is created.
@spec add_vertex_collection!(Arangox.conn(), binary(), term(), keyword()) :: term()
Add a node collection. Raises on error.
@spec all( Arangox.conn(), keyword() ) :: {:ok, term()} | {:error, Exception.t()}
List all graphs
Lists all graphs stored in this database.
Returns
Recorded against ArangoDB 3.12.10:
%{
"code" => integer,
"error" => boolean,
"graphs" => [%{
"_id" => string,
"_key" => string,
"_rev" => string,
"edgeDefinitions" => [%{
"collection" => string,
"from" => [string],
"to" => [string]
}],
"name" => string,
"orphanCollections" => []
}]
}
@spec all!( Arangox.conn(), keyword() ) :: term()
List all graphs. Raises on error.
See all/1.
@spec all_edge_collections(Arangox.conn(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
List edge collections
Lists all edge collections within this graph.
Returns
Recorded against ArangoDB 3.12.10:
%{
"code" => integer,
"collections" => [string],
"error" => boolean
}
@spec all_edge_collections!(Arangox.conn(), binary(), keyword()) :: term()
List edge collections. Raises on error.
@spec all_vertex_collections(Arangox.conn(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
List node collections
Lists all node collections within this graph, including orphan collections.
Returns
Recorded against ArangoDB 3.12.10:
%{
"code" => integer,
"collections" => [string],
"error" => boolean
}
@spec all_vertex_collections!(Arangox.conn(), binary(), keyword()) :: term()
List node collections. Raises on error.
@spec create(Arangox.conn(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Create a graph
The creation of a graph requires the name of the graph and a definition of its edges.
@spec create!(Arangox.conn(), term(), keyword()) :: term()
Create a graph. Raises on error.
See create/2.
@spec create_edge(Arangox.conn(), binary(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Create an edge
Creates a new edge in the specified collection.
Within the body the edge has to contain a _from and _to value referencing to valid nodes in the graph.
Furthermore, the edge has to be valid according to the edge definitions.
Create an edge. Raises on error.
See create_edge/4.
@spec create_edge_definition(Arangox.conn(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Add an edge definition
Adds an additional edge definition to the graph.
This edge definition has to contain a collection and an array of
each from and to node collections. An edge definition can only
be added if this definition is either not used in any other graph, or
it is used with exactly the same definition. For example, it is not
possible to store a definition "e" from "v1" to "v2" in one graph, and
"e" from "v2" to "v1" in another graph, but both can have "e" from
"v1" to "v2".
Additionally, collection creation options can be set.
@spec create_edge_definition!(Arangox.conn(), binary(), term(), keyword()) :: term()
Add an edge definition. Raises on error.
@spec create_vertex(Arangox.conn(), binary(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Create a node
Adds a node to the given collection.
Create a node. Raises on error.
See create_vertex/4.
@spec delete(Arangox.conn(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Drop a graph
Drops an existing graph object by name. Optionally all collections not used by other graphs can be dropped as well.
@spec delete!(Arangox.conn(), binary(), keyword()) :: term()
Drop a graph. Raises on error.
See delete/2.
@spec delete_edge(Arangox.conn(), binary(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Remove an edge
Removes an edge from an edge collection of the named graph. Any other edges that directly reference this edge like a node are removed, too.
Remove an edge. Raises on error.
See delete_edge/4.
@spec delete_edge_definition(Arangox.conn(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Remove an edge definition
Remove one edge definition from the graph. This only removes the edge collection from the graph definition. The node collections of the edge definition become orphan collections but otherwise remain untouched and can still be used in your queries.
@spec delete_edge_definition!(Arangox.conn(), binary(), binary(), keyword()) :: term()
Remove an edge definition. Raises on error.
@spec delete_vertex(Arangox.conn(), binary(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Remove a node
Removes a node from a collection of the named graph. Additionally removes all incoming and outgoing edges of the node.
Remove a node. Raises on error.
See delete_vertex/4.
@spec delete_vertex_collection(Arangox.conn(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Remove a node collection
Removes a node collection from the list of the graph's orphan collections. It can optionally delete the collection if it is not used in any other graph.
You cannot remove node collections that are used in one of the edge definitions of the graph. You need to modify or remove the edge definition first in order to fully remove a node collection from the graph.
@spec delete_vertex_collection!(Arangox.conn(), binary(), binary(), keyword()) :: term()
Remove a node collection. Raises on error.
@spec get(Arangox.conn(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Get a graph
Selects information for a given graph. Returns the edge definitions as well as the orphan collections, or returns an error if the graph does not exist.
Returns
Recorded against ArangoDB 3.12.10:
%{
"code" => integer,
"error" => boolean,
"graph" => %{
"_id" => string,
"_key" => string,
"_rev" => string,
"edgeDefinitions" => [%{
"collection" => string,
"from" => [string],
"to" => [string]
}],
"name" => string,
"orphanCollections" => []
}
}
@spec get!(Arangox.conn(), binary(), keyword()) :: term()
Get a graph. Raises on error.
See get/2.
@spec get_edge(Arangox.conn(), binary(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Get an edge
Gets an edge from the given collection.
Get an edge. Raises on error.
See get_edge/4.
@spec get_vertex(Arangox.conn(), binary(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Get a node
Gets a node from the given collection.
Returns
Recorded against ArangoDB 3.12.10:
%{
"code" => integer,
"error" => boolean,
"vertex" => %{
"_id" => string,
"_key" => string,
"_rev" => string
}
}
Get a node. Raises on error.
See get_vertex/4.
@spec replace_edge(Arangox.conn(), binary(), binary(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Replace an edge
Replaces the data of an edge in the collection.
Replace an edge. Raises on error.
See replace_edge/5.
@spec replace_edge_definition(Arangox.conn(), binary(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Replace an edge definition
Change the node collections of one specific edge definition. This modifies all occurrences of this definition in all graphs known to your database.
Replace an edge definition. Raises on error.
@spec replace_vertex(Arangox.conn(), binary(), binary(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Replace a node
Replaces the data of a node in the collection.
Replace a node. Raises on error.
See replace_vertex/5.
@spec update_edge(Arangox.conn(), binary(), binary(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Update an edge
Partially modify the data of the specific edge in the collection.
Update an edge. Raises on error.
See update_edge/5.
@spec update_vertex(Arangox.conn(), binary(), binary(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Update a node
Updates the data of the specific node in the collection.
Update a node. Raises on error.
See update_vertex/5.
@spec vertex_edges(Arangox.conn(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Get inbound and outbound edges
Returns an array of edges starting or ending in the node identified by
vertex.
Returns
Recorded against ArangoDB 3.12.10:
%{
"code" => integer,
"edges" => [%{
"_from" => string,
"_id" => string,
"_key" => string,
"_rev" => string,
"_to" => string
}],
"error" => boolean,
"stats" => %{
"cacheHits" => integer,
"cacheMisses" => integer,
"cursorsCreated" => integer,
"cursorsRearmed" => integer,
"documentLookups" => integer,
"executionTime" => float,
"filtered" => integer,
"httpRequests" => integer,
"intermediateCommits" => integer,
"peakMemoryUsage" => integer,
"scannedFull" => integer,
"scannedIndex" => integer,
"searchParallelism" => integer,
"seeks" => integer,
"writesExecuted" => integer,
"writesIgnored" => integer
}
}
@spec vertex_edges!(Arangox.conn(), binary(), binary(), keyword()) :: term()
Get inbound and outbound edges. Raises on error.
See vertex_edges/3.