Neo4j.Sips (0.2)Deps Status

A simple Elixir wrapper around the Neo4j graph database REST API.

You can also look at: Bolt.Sips, a similar driver but using Bolt, this time. Neo4j's newest network protocol, designed for high-performance. Cheers!

Install

From hex.pm. Edit the mix.ex file and add the neo4j_sips dependency to the deps/1 function:

defp deps do
[{:neo4j_sips, "~> 0.2"}]
end

or from Github:

defp deps do
[{:neo4j_sips, github: "florinpatrascu/neo4j_sips"}]
end

If you're using a local development copy:

defp deps do
[{:neo4j_sips, path: "../neo4j_sips"}]
end

Then add the neo4j_sips dependency the applications list:

def application do
[applications: [:logger, :neo4j_sips],
mod: {Neo4j.Sips.Application, []}]
end

Edit the config/config.exs and describe a Neo4j server endpoint, example:

config :neo4j_sips, Neo4j,
url: "http://localhost:7474",
pool_size: 5,
max_overflow: 2,
timeout: 30

Run mix do deps.get, deps.compile

If your server requires basic authentication, add this to your config file:

basic_auth: [username: "foo", password: "bar"]

Or:

token_auth: "bmVvNGo6dGVzdA==" # if using an authentication token?!

You can also specify the authentication in the url config:

url: "http://neo4j:neo4j@localhost:7474"

Example

With a minimalist setup configured as above, and a Neo4j server running, we can connect to the server and run some queries using Elixir’s interactive shell (IEx):

$ cd <my_mix_project>
$ iex -S mix
Erlang/OTP 19 [erts-8.0.2] [source] [64-bit] ...
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> alias Neo4j.Sips, as: Neo4j
iex(2)> Neo4j.start_link(url: "http://localhost:7474")
{:ok, #PID<0.204.0>}
iex(3)> cypher = """
CREATE (n:Neo4jSips {title:'Elixir sipping from Neo4j', released:2015,
license:'MIT', neo4j_sips_test: true})
"""
iex(4)> Neo4j.query(Neo4j.conn, cypher)
{:ok, []}
iex(5)> n = Neo4j.query!(Neo4j.conn, "match (n:Neo4jSips {title:'Elixir sipping from Neo4j'}) where n.neo4j_sips_test return n")
[%{"n" => %{"license" => "MIT", "neo4j_sips_test" => true, "released" => 2015,
"title" => "Elixir sipping from Neo4j"}}]

For more examples, see the test suites.

Contributing

Contributors

...Paul (@dotdotdotpaul)

Author

Florin T.PATRASCU (@florinpatrascu)

License