AshNeo4j.Cypher (AshNeo4j v0.2.2)
View SourceAshNeo4j Cypher
Summary
Functions
Converts a node variable, label and optional properties to cypher expression
Converts a node variable, label and optional properties to cypher node.
Converts a map to a cypher properties string.
The map is converted to a string in the format {key1: value1, key2: value2}
.
Converts a node_relationship tuple to cypher clause, ignoring the label
Converts a relationship variable, label and optional direction to cypher relationship.
Converts a list into a remove properties string.
The list is converted to a string in the format n.key1, n.key2
.
Runs some cypher
Functions
Converts a node variable, label and optional properties to cypher expression
Examples
iex> AshNeo4j.Cypher.expression(:s, "name", "in", "[Bill Nighy]")
"s.name in [Bill Nighy]"
iex> AshNeo4j.Cypher.expression(:s, "name", "in", "[]")
"s.name IS NOT NULL"
iex> AshNeo4j.Cypher.expression(:s, "name", "contains", "access")
"s.name CONTAINS 'access'"
Converts a node variable, label and optional properties to cypher node.
Examples
iex> AshNeo4j.Cypher.node(:s, :Actor)
"(s:Actor)"
iex> AshNeo4j.Cypher.node(:s, :Actor, %{name: "Bill Nighy"})
"(s:Actor {name: 'Bill Nighy'})"
Converts a map to a cypher properties string.
The map is converted to a string in the format {key1: value1, key2: value2}
.
Examples
iex> AshNeo4j.Cypher.properties(%{name: "Bill Nighy", born: 1949, bafta_winner: true})
"{name: 'Bill Nighy', born: 1949, bafta_winner: true}"
Converts a node_relationship tuple to cypher clause, ignoring the label
Examples
iex> AshNeo4j.Cypher.relationship({:movies, :ACTED_IN, :outgoing})
"-[r:ACTED_IN]->"
iex> AshNeo4j.Cypher.relationship(nil)
"-[r]-"
Converts a relationship variable, label and optional direction to cypher relationship.
Examples
iex> AshNeo4j.Cypher.relationship(:r, :ACTED_IN, :outgoing)
"-[r:ACTED_IN]->"
iex> AshNeo4j.Cypher.relationship(:r, :ACTED_IN, :incoming)
"<-[r:ACTED_IN]-"
iex> AshNeo4j.Cypher.relationship(:r, :KNOWS)
"-[r:KNOWS]-"
Converts a list into a remove properties string.
The list is converted to a string in the format n.key1, n.key2
.
Examples
iex> AshNeo4j.Cypher.remove_properties(:n, [:born, :bafta_winner])
"n.born, n.bafta_winner"
Runs some cypher
Examples
iex> cypher = "CREATE (n:Actor {name: 'Bill Nighy', born: 1949, bafta_winner: true}) RETURN n"
iex> {result, _} = AshNeo4j.Cypher.run(cypher)
iex> result
:ok