     ;; initial data
     (on-upsert bs b1)
     (is (= [[{}{}]{:b [b1]} {}] (data join)))
+    (is (= {} (data joined-model)))
 
     (on-upsert cs c1)
     (is (= [[{}{}]{:b [b1]} {:c [c1]}] (data join)))
+    (is (= {} (data joined-model)))
 
     ;; join - lhs - a1
     (on-upsert as a1)
     (is (= [[{:b [a1]}{:c [a1]}]{:b [b1]} {:c [c1]}] (data join)))
+    (is (= {:a1-b1-c1 (->ABC :a1-b1-c1 0 "b1-data" "c1-data")} (data joined-model)))
 
     ;; join - new rhs - b2
     (on-upsert bs b2)
     (is (= [[{:b [a1]}{:c [a1]}]{:b [b1 b2]} {:c [c1]}] (data join)))
+    (is (= {
+	   :a1-b1-c1 (->ABC :a1-b1-c1 0 "b1-data" "c1-data")
+	   :a1-b2-c1 (->ABC :a1-b2-c1 0 "b2-data" "c1-data")}
+	   (data joined-model)))
 
     ;; join - new rhs - c2
     (on-upsert cs c2)
     (is (= [[{:b [a1]}{:c [a1]}]{:b [b1 b2]} {:c [c1 c2]}] (data join)))
-
+    (is (= {
+	   :a1-b1-c1 (->ABC :a1-b1-c1 0 "b1-data" "c1-data")
+	   :a1-b2-c1 (->ABC :a1-b2-c1 0 "b2-data" "c1-data")
+	   :a1-b1-c2 (->ABC :a1-b1-c2 0 "b1-data" "c2-data")
+	   :a1-b2-c2 (->ABC :a1-b2-c2 0 "b2-data" "c2-data")
+	   }
+	   (data joined-model)))
     ;; join - new lhs - a2
     (on-upsert as a2)
     (is (= [[{:b [a1 a2]}{:c [a1 a2]}]{:b [b1 b2]} {:c [c1 c2]}] (data join)))
-
+    (is (= {
+	   :a1-b1-c1 (->ABC :a1-b1-c1 0 "b1-data" "c1-data")
+	   :a1-b2-c1 (->ABC :a1-b2-c1 0 "b2-data" "c1-data")
+	   :a1-b1-c2 (->ABC :a1-b1-c2 0 "b1-data" "c2-data")
+	   :a1-b2-c2 (->ABC :a1-b2-c2 0 "b2-data" "c2-data")
+	   :a2-b1-c1 (->ABC :a2-b1-c1 0 "b1-data" "c1-data")
+	   :a2-b2-c1 (->ABC :a2-b2-c1 0 "b2-data" "c1-data")
+	   :a2-b1-c2 (->ABC :a2-b1-c2 0 "b1-data" "c2-data")
+	   :a2-b2-c2 (->ABC :a2-b2-c2 0 "b2-data" "c2-data")
+	   }
+	   (data joined-model)))
     ;; what about amend-in/out ?
     ;; what about delete ?
 
+    ;; check outgoing joins
     ))

	rhs-indeces (rest new-indeces)
	joins (mapcat (fn [lhs] (derive-joins lhs rhs-indeces rhs-ks join-fn)) lhses)
	]
    (println "RHS JOINS: " joins)
    new-indeces
    ))

;;; TODO

(defn- rhs-upserts [old-indeces i ks vs join-fn])
(defn- rhs-deletes [old-indeces i ks vs join-fn])

(defn- rhs-view [indeces i key keys join-fn joined-model]
  (reify
   View
   ;; singleton changes
   (on-upsert [_ upsertion] ((swap*! indeces rhs-upsert i key keys upsertion join-fn joined-model) []) nil) ;TODO: pass in views to notifier
   (on-delete [_ deletion]  (swap! indeces rhs-delete i keys deletion join-fn) nil)
   ;; batch changes
   (on-upserts [_ upsertions] (swap! indeces rhs-upserts i keys upsertions join-fn) nil)
