forked from drone29a/clojure-neo4j
-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
33 lines (26 loc) · 1.03 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
The clojure-neo4j project provides a more lispy interface to Neo4j, a graph-structured on-disk transactional database.
This library is under active development and there's plenty more work to do.
Usage:
(use ['neo4j :exclude ['start 'shutdown]])
(neo4j/start "/path/to/db")
;;; Create a root for customers and add a customer.
(with-tx
(let [customer-root (new-node)
bob (new-node)]
(relate (top-node) :customers customer-root)
(relate customer-root :customer bob)
(properties bob {"name" "Bob"
"age" 30
"id" "C12345"})))
;;; Fetch all customer IDs
(with-tx
(let [customer-root (-> (top-node)
(.getSingleRelationship (relationship :customers) outgoing)
(.getEndNode))]
(doall (map #(property % "id")
(traverse customer-root
breadth-first
(depth-of 1)
all-but-start
{:customer outgoing})))))
(neo4j/shutdown)