 ;;(? (pivot :ocean oceans (keyword (count-value-key nil)))(ccount)(split :ocean)(from "Whales"))
 
 
-(if false
-  (do
+;; (if false
+;;   (do
     
-    ;; all whales
-    (inspect (? (dfrom "Whales")))
-
-    ;; count all whales
-    (inspect (? (dcount)(dfrom "Whales")))
-
-    ;; sum length of all whales
-    (inspect (? (dsum :length)(dfrom "Whales")))
-
-    ;; we're only interested in toothed whales
-    (inspect (? (dsplit :type (fn [type] (if (isa? whale-hierarchy :odontoceti type) [:odontoceti] []))) (dfrom "Whales")))
-
-    ;; we're only interested in rorquals
-    (inspect (? (dsplit :type (fn [type] (if (isa? whale-hierarchy :balaenopteridae type) [:balaenopteridae] []))) (dfrom "Whales")))
-
-    ;; split by suborder
-    (do
-      (def whale-hierarchy-children
-	(reduce (fn [reduction [key vals]] (reduce (fn [reduction val] (conj reduction [val key])) reduction vals)) {} (whale-hierarchy :parents)))
+;;     ;; all whales
+;;     (inspect (? (dfrom "Whales")))
+
+;;     ;; count all whales
+;;     (inspect (? (dcount)(dfrom "Whales")))
+
+;;     ;; sum length of all whales
+;;     (inspect (? (dsum :length)(dfrom "Whales")))
+
+;;     ;; we're only interested in toothed whales
+;;     (inspect (? (dsplit :type (fn [type] (if (isa? whale-hierarchy :odontoceti type) [:odontoceti] []))) (dfrom "Whales")))
+
+;;     ;; we're only interested in rorquals
+;;     (inspect (? (dsplit :type (fn [type] (if (isa? whale-hierarchy :balaenopteridae type) [:balaenopteridae] []))) (dfrom "Whales")))
+
+;;     ;; split by suborder
+;;     (do
+;;       (def whale-hierarchy-children
+;; 	(reduce (fn [reduction [key vals]] (reduce (fn [reduction val] (conj reduction [val key])) reduction vals)) {} (whale-hierarchy :parents)))
       
-      (def whale-type-to-suborder
-	(reduce (fn [reduction type] (conj reduction [type (whale-hierarchy-children (whale-hierarchy-children type))])) {} types))
+;;       (def whale-type-to-suborder
+;; 	(reduce (fn [reduction type] (conj reduction [type (whale-hierarchy-children (whale-hierarchy-children type))])) {} types))
       
-      (inspect (? (dsplit :type (fn [type] [(whale-type-to-suborder type)])) (dfrom "Whales"))))
+;;       (inspect (? (dsplit :type (fn [type] [(whale-type-to-suborder type)])) (dfrom "Whales"))))
     
-    ;; split by family
-    (do
-      (def whale-hierarchy-children
-	(reduce (fn [reduction [key vals]] (reduce (fn [reduction val] (conj reduction [val key])) reduction vals)) {} (whale-hierarchy :parents)))
+;;     ;; split by family
+;;     (do
+;;       (def whale-hierarchy-children
+;; 	(reduce (fn [reduction [key vals]] (reduce (fn [reduction val] (conj reduction [val key])) reduction vals)) {} (whale-hierarchy :parents)))
       
-      (def whale-type-to-family
-	(reduce (fn [reduction type] (conj reduction [type (whale-hierarchy-children type)])) {} types))
+;;       (def whale-type-to-family
+;; 	(reduce (fn [reduction type] (conj reduction [type (whale-hierarchy-children type)])) {} types))
       
-      (inspect (? (dsplit :type (fn [type] [(whale-type-to-family type)])) (dfrom "Whales"))))
-
-    ;; split by ocean
-    (inspect (? (dsplit :ocean)(dfrom "Whales")))
-    (inspect (? (dsplit :ocean)(dfrom "WhalesAndOceans")))
-
-    ;; flat split by type then ocean
-    (inspect (? (dsplit :ocean)(dsplit :type)(dfrom "Whales")))
-
-    ;; nested split by type then ocean
-    (inspect (? (dsplit :type list [(dsplit :ocean)])(dfrom "Whales")))
-
-    (inspect (? (dsplit :type list [(dunion)(dsplit :ocean)])(dfrom "Whales")))
-
-    ;; sum weights per ocean
-    (inspect (? (dsum :weight)(dsplit :ocean)(dfrom "Whales")))
-
-    ;; summarise weights per ocean
-    (inspect (? (dunion)(dsum :weight)(dsplit :ocean)(dfrom "Whales")))
-    ;; summarise weights per type
-    (inspect (? (dunion)(dsum :weight)(dsplit :type)(dfrom "Whales")))
-
-    ;; pivot weights per ocean summary
-    (inspect (? (dpivot :ocean ["arctic" "atlantic" "indian" "pacific" "southern"] (keyword "sum(:weight)")) (dsum :weight) (dsplit :ocean) (dfrom "Whales")))
-
-    ;; for each type - pivot weights per ocean summary
-    (inspect (? (dsplit :type list [(dpivot :ocean ["arctic" "atlantic" "indian" "pacific" "southern"] (keyword "sum(:weight)")) (dsum :weight) (dsplit :ocean)]) (dfrom "Whales")))
-
-    (inspect (? (dsplit :type list [(dunion)(dpivot :ocean ["arctic" "atlantic" "indian" "pacific" "southern"] (keyword "sum(:weight)")) (dsum :weight) (dsplit :ocean)]) (dfrom "Whales")))
-
-;; TODO
-;; split multiple dimensions at same time...
-;; reduce multiple columns at same time...
-;; rethink pivot 
-;; support adding/deleting UI rows
-;; support updating UI rows
-
-  ;;(? (union "count/type/ocean")(split :type nil [(pivot :ocean oceans (keyword (count-value-key nil)))(ccount)(split :ocean )]) (from "Whales"))
-  ;;(? (union "count/ocean/type")(split :ocean nil [(pivot :type types (keyword (count-value-key nil)))(ccount)(split :type )]) (from "Whales"))
-
-  ;; weight/ocean/type
-  ;;(inspect (? (dsplit :type nil [(dpivot :ocean oceans (keyword (sum-value-key :weight)))(dsum :weight)(dsplit :ocean )])(dfrom "Whales")))
+;;       (inspect (? (dsplit :type (fn [type] [(whale-type-to-family type)])) (dfrom "Whales"))))
+
+;;     ;; split by ocean
+;;     (inspect (? (dsplit :ocean)(dfrom "Whales")))
+;;     (inspect (? (dsplit :ocean)(dfrom "WhalesAndOceans")))
+
+;;     ;; flat split by type then ocean
+;;     (inspect (? (dsplit :ocean)(dsplit :type)(dfrom "Whales")))
+
+;;     ;; nested split by type then ocean
+;;     (inspect (? (dsplit :type list [(dsplit :ocean)])(dfrom "Whales")))
+
+;;     (inspect (? (dsplit :type list [(dunion)(dsplit :ocean)])(dfrom "Whales")))
+
+;;     ;; sum weights per ocean
+;;     (inspect (? (dsum :weight)(dsplit :ocean)(dfrom "Whales")))
+
+;;     ;; summarise weights per ocean
+;;     (inspect (? (dunion)(dsum :weight)(dsplit :ocean)(dfrom "Whales")))
+;;     ;; summarise weights per type
+;;     (inspect (? (dunion)(dsum :weight)(dsplit :type)(dfrom "Whales")))
+
+;;     ;; pivot weights per ocean summary
+;;     (inspect (? (dpivot :ocean ["arctic" "atlantic" "indian" "pacific" "southern"] (keyword "sum(:weight)")) (dsum :weight) (dsplit :ocean) (dfrom "Whales")))
+
+;;     ;; for each type - pivot weights per ocean summary
+;;     (inspect (? (dsplit :type list [(dpivot :ocean ["arctic" "atlantic" "indian" "pacific" "southern"] (keyword "sum(:weight)")) (dsum :weight) (dsplit :ocean)]) (dfrom "Whales")))
+
+;;     (inspect (? (dsplit :type list [(dunion)(dpivot :ocean ["arctic" "atlantic" "indian" "pacific" "southern"] (keyword "sum(:weight)")) (dsum :weight) (dsplit :ocean)]) (dfrom "Whales")))
+
+;; ;; TODO
+;; ;; split multiple dimensions at same time...
+;; ;; reduce multiple columns at same time...
+;; ;; rethink pivot 
+;; ;; support adding/deleting UI rows
+;; ;; support updating UI rows
+
+;;   ;;(? (union "count/type/ocean")(split :type nil [(pivot :ocean oceans (keyword (count-value-key nil)))(ccount)(split :ocean )]) (from "Whales"))
+;;   ;;(? (union "count/ocean/type")(split :ocean nil [(pivot :type types (keyword (count-value-key nil)))(ccount)(split :type )]) (from "Whales"))
+
+;;   ;; weight/ocean/type
+;;   ;;(inspect (? (dsplit :type nil [(dpivot :ocean oceans (keyword (sum-value-key :weight)))(dsum :weight)(dsplit :ocean )])(dfrom "Whales")))
   
-  ;; weight/type/ocean
-  ;;(inspect (? (dsplit :ocean nil [(dpivot :type types (keyword (sum-value-key :weight)))(dsum :weight)(dsplit :type )])(dfrom "Whales")))
-
-    ))
+;;   ;; weight/type/ocean
+;;   ;;(inspect (? (dsplit :ocean nil [(dpivot :type types (keyword (sum-value-key :weight)))(dsum :weight)(dsplit :type )])(dfrom "Whales")))
+
+;;     ))
 
 (if false
   (do

;; Join scratch area
;;--------------------------------------------------------------------------------

(if false
  (do

    (inspect (? (dfrom "Whales")))
    (inspect (? (dfrom "Oceans")))
    (inspect (? (dfrom "WhalesAndOceans")))

    (insert oceans-model (Ocean. "arctic"   1000000 99999999 17880))
    (insert oceans-model (Ocean. "southern" 1000000  10000000 23737))

    (insert whales-model (Whale. 50 3011 (Date. 0 1 1) "jules" "blue whale" "atlantic" 100 100))
    (delete whales-model (Whale. 50 3100 (Date. 0 1 1) "jules" "blue whale" "seaworld" 100 100))
    (.find whales-model 10000)

    ))

;;--------------------------------------------------------------------------------
;; DSL experimentation

  [clojure set]
  [org.dada core]
  [org.dada.core dql]
  [org.dada.demo server])
 (:import
  [clojure.lang
