AshNeo4j.Neo4jHelper (AshNeo4j v0.1.0)

View Source

AshNeo4j Datalayer Neo4j Helper

Summary

Functions

Creates a neo4j node with label and properties

Delete all neo4j nodes and relationships

Creates a neo4j node with label and properties

Tests if two nodes are related with a relationship type ## Examples

Reads nodes from Neo4j, given label and optionally properties

Functions

create_node(label, properties)

Creates a neo4j node with label and properties

Examples

iex> {result, _} = AshNeo4j.Neo4jHelper.create_node(:Actor, %{name: "Bill Nighy"})
iex> result
:ok

delete_all()

Delete all neo4j nodes and relationships

Examples

iex> {result, _} = AshNeo4j.Neo4jHelper.delete_all()
iex> result
:ok

merge_node(label, properties)

Creates a neo4j node with label and properties

Examples

iex> {result, _} = AshNeo4j.Neo4jHelper.merge_node(:Actor, %{name: "Bill Nighy", born: 1949})
iex> result
:ok

nodes_relate_how?(source_label, source_properties, dest_label, dest_properties, relationship)

Tests if two nodes are related with a relationship type ## Examples

iex> AshNeo4j.Neo4jHelper.create_node(:Actor, %{name: "Bill Nighy", born: 1949})
iex> AshNeo4j.Neo4jHelper.create_node(:Movie, %{title: "Love Actually"})
iex> AshNeo4j.Neo4jHelper.relate_nodes(:Actor, %{name: "Bill Nighy"}, :Movie, %{title: "Love Actually"}, :ACTED_IN)
iex> AshNeo4j.Neo4jHelper.nodes_relate_how?(:Actor, %{name: "Bill Nighy"}, :Movie, %{title: "Love Actually"}, :ACTED_IN)
true

read_nodes(label, properties \\ %{})

Reads nodes from Neo4j, given label and optionally properties

Examples

iex> AshNeo4j.Neo4jHelper.create_node(:Actor, %{name: "Bill Nighy", born: 1949})
iex> {:ok, %{records: records}} = AshNeo4j.Neo4jHelper.read_nodes(:Actor, %{name: "Bill Nighy"})
iex> length(records)
1

relate_nodes(source_label, source_properties, dest_label, dest_properties, relationship)

@spec relate_nodes(atom(), map(), atom(), map(), any()) :: term()

Relates two nodes with a relationship type ## Examples

iex> AshNeo4j.Neo4jHelper.create_node(:Actor, %{name: "Bill Nighy", born: 1949})
iex> AshNeo4j.Neo4jHelper.create_node(:Movie, %{title: "Love Actually"})
iex> {result, _} = AshNeo4j.Neo4jHelper.relate_nodes(:Actor, %{name: "Bill Nighy"}, :Movie, %{title: "Love Actually"}, :ACTED_IN)
iex> result
:ok