Permalink
Browse files

v0.1.0

  • Loading branch information...
1 parent 2462e73 commit a629b8fcda50ede8e662e014bdec6e3d30c4586d @eduardoejp committed Feb 25, 2012
Showing with 53 additions and 2 deletions.
  1. +51 −0 README.md
  2. +2 −2 src/clj_blueprints.clj
View
@@ -0,0 +1,51 @@
+
+clj-blueprints
+==============
+
+`clj-blueprints` is a binding for the Blueprints graph DBMS API.
+
+Usage
+-----
+
+Simply add this to your leiningen deps: `[clj-blueprints "0.1.0"]`
+
+Documentation
+-------------
+
+The documentation can be found here: http://eduardoejp.github.com/clj-orient/
+
+Examples
+--------
+
+Working with the database:
+
+ ; Opening the database and setting the *db* var for global use.
+ (set-db! (tinker-graph)) ; You can open every other GraphDB by instantiation the required GraphDB object (like OrientGraph)
+
+ ; Dynamically bind *db* to another DB.
+ (with-db (tinker-graph)
+ (form-1 ...)
+ (form-2 ...)
+ (form-3 ...)
+ ...
+ (form-n ...))
+
+ ; Shutdown the DB
+ (shutdown!)
+
+ ; Using transactions (*db* must be bound to some database in the surrounding scope).
+ (with-tx
+ (form-1 ...)
+ (form-2 ...)
+ (form-3 ...)
+ ...
+ (form-n ...))
+
+Working with vertices and eges:
+ (with-tx
+ (let [v1 (vertex {:first-name "John", :last-name "Doe", :age 20, :country "USA"})
+ v2 (vertex {:first-name "Jane", :last-name "Doe", :age 25, :country "USA"})]
+ (link! v1 :knows {:since "2012/02/24"} v2)))
+
+*Please note*: This is not a comprehensive guide. Please read the library documentation to know what functions and macros are available.
+
View
@@ -94,10 +94,10 @@
(defn load-edge "" [id] (.getEdge *db* id))
-(defn vertex!
+(defn vertex
"Adds a vertex to the database. If given a hash-map, sets the properties of the vertex."
([id props] (let [v (.addVertex *db* id)] (when props (apply passoc! v (interleave (map name (keys props)) (vals props)))) v))
- ([id] (if-not (map? id) (.addVertex *db* id) (vertex! nil id)))
+ ([id] (if-not (map? id) (.addVertex *db* id) (vertex nil id)))
([] (.addVertex *db* nil)))
(defn link!

0 comments on commit a629b8f

Please sign in to comment.