Skip to content
vic

andreasronge/neoxir

An Elixir driver for the Neo4j Graph Database, see www.neo4j.org

andreasronge/neoxir.json
{
"createdAt": "2015-01-05T16:09:31Z",
"defaultBranch": "master",
"description": "An Elixir driver for the Neo4j Graph Database, see www.neo4j.org",
"fullName": "andreasronge/neoxir",
"homepage": null,
"language": "Elixir",
"name": "neoxir",
"pushedAt": "2016-04-06T07:10:28Z",
"stargazersCount": 28,
"topics": [],
"updatedAt": "2024-09-21T19:51:38Z",
"url": "https://github.com/andreasronge/neoxir"
}

Build Status

An Elixir driver for the Neo4j Graph Database, see www.neo4j.org

{:ok, session} = Neoxir.create_session("http://localhost:7474")

Or

session = Neoxir.create_session! # http://localhost:7474 is default

All cypher operations are executed in transactions.

Commit a single cypher query

{:ok, response} = Neoxir.commit(session, statement: "CREATE (n) RETURN ID(n)")
# or, which might raise an exception:
response = Neoxir.commit!(session, statement: "CREATE (n) RETURN ID(n)")

Commit multiple cypher queries:

{:ok, response} = Neoxir.commit(session, [statement: "CREATE (n) RETURN ID(n)", statement: "..."])

TODO

transaction = Neoxir.begin_tx!(session, \\ [statements: "..."])
response = Neoxir.execute!(transaction, statement: "CREATE (n) RETURN ID(n)")
Neoxir.commit!(transaction, \\ [statements: "..."])

Single statement

{:ok, response} = Neoxir.commit(session, statement: "MATCH (n) RETURN ID(n) as X LIMIT 3")
# => [%{x: 0}, %{x: 1}, %{x: 2}]

REST response

{:ok, response} = commit(session, statement: "CREATE (n {name: 'andreas'}) RETURN n", resultDataContents: [ "REST" ])
# => [%{n: %{"all_relationships" => "http://localhost:7474/db/data/node/886/relationships/all",
# "all_typed_relationships" => "http://localhost:7474/db/data/node/886/relationships/all/{-list|&|types}",
# ...

Multiple statements

{:ok, response} = Neoxir.commit(session, [statement: "MATCH (n) RETURN ID(n) as X LIMIT 3"])
# => [[%{x: 0}, %{x: 1}, %{x: 2}]]