             (println line-count)
             map))))))
 
-(defn role-count
-  "Returns a hash-map from role names to their cardinality."
-  [file]
-  (with-in-reader file
-    (binding [*in* (clojure.lang.LineNumberingPushbackReader. *in*)]
-      (loop [map {},
-             line-count 0]
-        (if-let [line (read-line)]
-          (do
-            (when (zero? (mod line-count 10000))
-              (println line-count (count map)))
-            (let [[role [A B]] (line-to-pair line)]
-              (recur (assoc map role (inc (get map role 0)))
-                     (inc line-count))))
-          map)))))
-
-(defn capitalize [word]
+(defn- capitalize
+  "Capitalizes word."
+  [word]
   (if (empty? word)
     word
     (apply str (Character/toUpperCase (first word)) (rest word))))
 
-(defn symbolify [coll]
+(defn- symbolify
+  "Transforms every string in coll to a symbol, walking through
+  sequential collectiones recursively."
+  [coll]
   ((fn transform [thing]
      (cond
       (string? thing) (symbol (capitalize thing)),

      :else thing))
   coll))

(defn prepare-for-conexp [hash-map]
  (into {} (for [[k v] (symbolify hash-map)]
             [k (set v)])))

(defn role-map->concept-map [role-map]
  (assert (= 1 (count role-map)))
  (loop [concept-map {},
         is-as (get role-map (first (keys role-map)))]


(use '[clojure.contrib.io :only (with-in-reader)]
     '[clojure.walk :only (walk)]
     '[conexp.base :only (set-of)])

;;;

(defn- line-to-pair
  "Converts RDF line to a pair [role [First Second]]."
  [line]
  (let [[A to B] (rest (re-find #"<(.*)> <(.*)> <(.*)>" line))]
    [to [A B]]))

(defn- map-count
  "Counts overall entries in a map."
  [hash-map]
  (reduce + (map #(count (get hash-map %)) (keys hash-map))))

(defn- read-lines-from-file [file interesting-role? interesting-A? interesting-B?]
  (with-in-reader file
    (binding [*in* (clojure.lang.LineNumberingPushbackReader. *in*)]
      (loop [map {},
