 
 (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.

		  (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]]
  [(meta-view
    (str ".split(" split-key")")
    src-metamodel

	     (let [model-entry (list* model (concat extra-values [extra-value]))]
	       (insert tgt-metamodel model-entry)
	       (insert *metamodel* model)
	       (if subchain
		 (subchain
		  [(meta-view
		    (str "=" extra-value)
		    tgt-metamodel
		    (fn [tgt-metamodel2 model & extra-values]
			;;(insert tgt-metamodel tgt-metamodel2)
			(insert tgt-metamodel2 model-entry)
			;;(insert *metamodel* model)
			))
		   src-metadata
		   (concat extra-keys [split-key])]))
	       model
	       )))))
   src-metadata
   (concat extra-keys [split-key])])
