      'conexp.contrib.dl.languages.EL-gfp-exploration
      'conexp.contrib.dl.languages.interaction)
 
-(defn read-wiki-model [roles]
+(defn read-wiki-model
+  "For the given set of roles (as symbols) returns the smallest model
+  containing the interpretations of roles in the data-set of dbpedia."
+  [roles]
   (let [[concepts, roles] (read-wiki roles)]
     (interpretation->model concepts roles :base-lang EL-gfp)))
 
-(defn collect [start relation]
+(defn collect
+  "Returns the smallest connected subrelation of relation containing start."
+  [start relation]
   (let [related (set (for [[x y] relation,
                            :when (or (contains? start x)
                                      (contains? start y)),

      :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 {},
