Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A wrapper around neo4j (http://neo4j.org/ ) in the Clojure language

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src Removed reflection and lookup method. June 07, 2012
Octocat-spinner-32 test core/property now returns nil if key doesn't exist. June 06, 2012
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.markdown
Octocat-spinner-32 license.txt Licensed in the public domain. December 06, 2008
Octocat-spinner-32 project.clj Added tests, removed vars, updated docs. April 27, 2012
README.markdown

A Neo4j library for Clojure

The clojure-neo4j project provides a lispy interface to Neo4j, a graph-structured on-disk transactional database.

Get It

The latest version, 0.3.0-SNAPSHOT, is available from clojars.

Add [clojure-neo4j "0.3.0-SNAPSHOT"] to your project's dependency list and fetch with lein deps.

Building

lein jar

Example

(use '[neo4j.core :exclude [open shutdown]])

(def db (neo4j.core/open "/path/to/db"))

;;; Create a root for customers and add a customer.
(with-tx db
  (let [customer-root (new-node db) 
        bob (new-node db)]
    (relate (top-node db) :customers customer-root)
    (relate customer-root :customer bob)
    (properties bob {"name" "Bob"
                     "age" 30
                     "id" "C12345"})))

;;; Fetch all customer IDs
(with-tx db
  (let [customer-root (-> (top-node db)
                          (.getSingleRelationship (relationship :customers) outgoing)
                          (.getEndNode))]
    (doall (map #(property % "id") 
                (traverse customer-root
                          breadth-first
                          (depth-of 1)
                          all-but-start
                          {:customer outgoing})))))

(neo4j.core/shutdown db)
Something went wrong with that request. Please try again.