 ;;  => #<Graph 6d863860-723d-1195-8101-7831c1bbb832 (1 triples)>
 ;;  => #<Graph 6d863860-723d-1195-8101-7831c1bbb832 (1 triples)>
 ;;  => #<Graph 6d863860-723d-1195-8101-7831c1bbb832 (1 triples)>
+
+(defmacro with-context [designator & body]
+  `(binding [*context* (intern-graph (graph ~designator))]
+     ~@body))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

     (-> (->Graph (uuid/the-uuid id) {} tuples)
       (add-index s p o)
       (add-index p o s)
       (add-index o s p)
       )))


(defprotocol GraphBuilder

                     (query (graph *context*) subj pred obj))))))


;;;
;;; Identity and Context: examples.
;;;

;; (select (graph #{[1 2 3] [4 5 6]}) [nil nil nil])
;;   => #<Graph e9a62310-7238-1195-8101-7831c1bbb832 (2 triples)>    

;; (with-context #{[1 2 3]}
;;   (query (graph *context*) 1 2 nil))
;;   => #{[1 2 3]}

;; (with-context (select (graph #{[1 2 3] [4 5 6]}) [nil nil nil])
;;   (triples (select (graph nil) [nil nil nil])))
;;   => #{[4 5 6] [1 2 3]}

;; (select (graph #{[1 2 3] [4 5 6]}) [nil nil nil])
;;   => #<Graph 0322eb40-723c-1195-8101-7831c1bbb832 (2 triples)>
;;   => #<Graph 0322eb40-723c-1195-8101-7831c1bbb832 (2 triples)>
;;   => #<Graph 0322eb40-723c-1195-8101-7831c1bbb832 (2 triples)>

;; (with-context (select (graph #{[1 2 3] [4 5 6]}) [nil nil nil])
;;   (select (graph nil) [nil nil nil]))
;;   => #<Graph 0322eb40-723c-1195-8101-7831c1bbb832 (2 triples)>
;;   => #<Graph 0322eb40-723c-1195-8101-7831c1bbb832 (2 triples)>
;;   => #<Graph 0322eb40-723c-1195-8101-7831c1bbb832 (2 triples)>


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
