redisgraph v0.1.0 RedisGraph.Node View Source

A Node member of a Graph.

Nodes have an alias which uniquely identifies them in a Graph. Nodes must have an alias in order for their associated Graph to be committed to the database.

Nodes have a label which is analogous to a type definition. Nodes can be queried based on their label, e.g. person or place or food.

Nodes may optionally have properties, a map of values associated with the entity. These properties can be returned by database queries.

Nodes may have aliases. When adding a RedisGraph.Node to a RedisGraph.Graph, a random alias may be set on the Node prior to being added to the Graph if it does not already have one.

Nodes which are created as the result of a MATCH query in a RedisGraph.QueryResult will also have numeric ids which are internal to the graph in the database.

Link to this section Summary

Functions

Compare two Nodes with respect to equality.

Creates a new Node.

Converts the properties to a query-appropriate string.

Sets the node's alias if it is nil.

Converts the node to a query-appropriate string.

Link to this section Types

Link to this type

t()

View Source
t() :: %RedisGraph.Node{
  alias: String.t(),
  id: integer(),
  label: String.t(),
  properties: %{optional(String.t()) => any()}
}

Link to this section Functions

Link to this function

compare(left, right)

View Source
compare(t(), t()) :: boolean()

Compare two Nodes with respect to equality.

Comparison logic:

  • if ids differ then returns false
  • if aliases differ then returns false
  • if labels differ then returns false
  • if properties differ then returns false
  • otherwise returns true

Creates a new Node.

Example

john = Node.new(%{
  label: "person",
  properties: %{
    name: "John Doe",
    age: 33
  }
})
Link to this function

properties_to_string(node)

View Source
properties_to_string(t()) :: String.t()

Converts the properties to a query-appropriate string.

Link to this function

set_alias_if_nil(node)

View Source
set_alias_if_nil(t()) :: t()

Sets the node's alias if it is nil.

Link to this function

to_query_string(node)

View Source
to_query_string(t()) :: String.t()

Converts the node to a query-appropriate string.