Skip to content
Cayley driver for Elixir
Elixir
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config
lib/caylir
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
mix.exs
mix.lock

README.md

Caylir

Cayley driver for Elixir

Warning

This module is highly experimental at the moment and may behave or change unexpectedly.

Tested cayley version: 0.5.0 (see .travis.yml to be sure)

Setup

Add Caylir as a dependency to your mix.exs file:

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

You should also update your applications to include all necessary projects:

def application do
  [ applications: [ :caylir ] ]
end

Usage

Graph Connections

Defining a graph connection requires defining a module:

defmodule MyApp.MyGraph do
  use Caylir.Graph, otp_app: :my_app
end

The :otp_app name and the name of the module can be freely chosen. They only need to be linked to an entry in your config.exs:

config :my_app, MyApp.MyGraph,
  host: "localhost",
  pool: [ max_overflow: 0, size: 1 ],
  port: 64210

You now have a graph definition you can hook into your supervision tree:

Supervisor.start_link(
  [ MyApp.MyGraph.child_spec ],
  strategy: :one_for_one
)

Queries

Writing Data:

MyApp.MyGraph.write(%{
  subject:   "graph",
  predicate: "connection",
  object:    "target"
})

Querying data:

# Gremlin Syntax!
MyApp.MyGraph.query("graph.Vertex('graph').Out('connection').All()")

Deleting Data:

MyApp.MyGraph.delete(%{
  subject:   "graph",
  predicate: "connection",
  object:    "target"
})

License

Apache License, Version 2.0

Something went wrong with that request. Please try again.