 
 (def all-whales (metamodel whales-model))
 (def counted-whales (ccount all-whales))
-
-(def whales-by-type (split all-whales :type))
-(def counted-whales-by-type (ccount whales-by-type))
-(def grouped-counted-whales-by-type (union counted-whales-by-type "Whales.split(:type).count()"))
 
 (def #^NavigableSet years
      (TreeSet.

     extra-keys]))


(defn union [[#^Model src-metamodel #^Metadata src-metadata #^Collection extra-keys] #^String prefix]
  (let [tgt-model (model (str prefix ".union()") nil src-metadata)
	tgt-metamodel (meta-view ".union()" src-metamodel (fn [tgt-metamodel src-model & extra-values] (connect src-model tgt-model)))]
    (insert *metamodel* tgt-model)
    (insert tgt-metamodel [tgt-model])

		  (doall (map (fn [#^Update insertion] (apply f tgt-metamodel (.getNewValue insertion))) insertions)))))
  tgt-metamodel))

(defn split [[#^Model src-metamodel #^Metadata src-metadata #^Collection extra-keys] split-key & [split-key-fn subchain]]
  [(meta-view
    (str ".split(" split-key")")
    src-metamodel
