-
Notifications
You must be signed in to change notification settings - Fork 15
Graph Database
(use 'clj-orient.graph)
Note: You cannot use any type of document as a vertex or an edge. The classes must be explicitly declared to be vertices or edges. You do this by using create-vertex-type!
and create-edge-type!
, or by using the schema definition functionality and deriving your classes from OGraphVertex
and OGraphEdge
.
You can set root nodes using add-root!
, which takes a keyword naming the root and you access your roots with get-root
.
link!
allows you to connect your vertices with an edge, e.g.:
(link! john jane)
(link! john :knows jane)
(link! john :knows {:since (java.util.Date.)} jane)
Remember to save your edges after creating them.
If you read the Document DB wiki page, you'll know that accessing :out
and :in
properties of vertices and edges will return you results not wrapped by the CljODoc
type. To solve it, use functions like get-edges
and get-vertex
, which will wrap the results for you.
get-ends
differs from get-edges
in that it will return you the vertices at the ends of the edges.