               ;(. @database add (HGPlainLink. (into-array HGHandle [threadHandle userHandle postHandle])))
               (HGQuery$hg/addUnique @database (HGRel. (into-array HGHandle [userHandle threadHandle])) userThreadRelType (HGQuery$hg/link (into-array HGHandle [userHandle threadHandle])))
               (. @database add (HGRel. (into-array HGHandle [userHandle postHandle])) userPostRelType)
-              (. @database add (HGRel. (into-array HGHandle [threadHandle postHandle])) threadPostRelType)
+              ;(. @database add (HGRel. (into-array HGHandle [threadHandle postHandle])) threadPostRelType)
+              (. @database add (HGValueLink. (. (. post getCreateTime) getMillis) (into-array HGHandle [threadHandle postHandle])))
 
               (def saveTime (+ saveTime (- (System/currentTimeMillis) saveStart)))
               )

    (let [operationStart (System/currentTimeMillis)]
      (do
        (println "najbardziej popularny temat w maju 2013")

        (println (string/join " " ["Operation took" (String/valueOf (/ (- (System/currentTimeMillis) operationStart) 1000.0)) "seconds"]))
        )
      )

    (let [operationStart (System/currentTimeMillis)]
      (do
        (println "liczba tematów utworzonych w 2013 roku")
        ;(def threadFirstPostLinks (HGQuery$hg/findAll @database (HGQuery$hg/type threadFirstPostRelType)))
        ;(println (count threadFirstPostLinks))
        ;(def threadFirstPosts (map (fn [threadFirstPostLink] (HGQuery$hg/getOne @database (HGQuery$hg/and (into-array HGQueryCondition [(HGQuery$hg/type Post) (HGQuery$hg/target threadFirstPostLink)])))) threadFirstPostLinks))
        ;(println (count threadFirstPosts))
        ;(println (. (filter (fn [threadFirstPost] (t/within? (t/interval (t/date-time 2013) (t/date-time 2014)) (. threadFirstPost getCreateTime))) threadFirstPosts) size))
        (def threadHandles (HGQuery$hg/findAll @database (HGQuery$hg/type ForumThread)))
        (def threadFirstPosts (map (fn [threadHandle] (reduce (fn [currentFirstThreadPostLink threadPostLink] (if (< (. currentFirstThreadPostLink getValue) (. threadPostLink getValue)) currentFirstThreadPostLink threadPostLink)) (HGQuery$hg/getAll @database (HGQuery$hg/and (into-array HGQueryCondition [(HGQuery$hg/type Long) (HGQuery$hg/incident threadHandle)])))) ) threadHandles))
        (def yearBegin (. (t/date-time 2013) getMillis))
        (def yearEnd (. (t/date-time 2014) getMillis))
        (println (count (filter (fn [threadFirstPost] (and (>= (. threadFirstPost getValue) yearBegin) (< (. threadFirstPost getValue) yearEnd))) threadFirstPosts)))
        ;(def threadFirstPosts (map (fn [threadFirstPostLink] (HGQuery$hg/getOne @database (HGQuery$hg/and (into-array HGQueryCondition [(HGQuery$hg/type Post) (HGQuery$hg/target threadFirstPostLink)])))) threadPostLinks))
        ;(println (count threadFirstPosts))
        ;(println (. (filter (fn [threadFirstPost] (t/within? (t/interval (t/date-time 2013) (t/date-time 2014)) (. threadFirstPost getCreateTime))) threadFirstPosts) size))


        (println (string/join " " ["Operation took" (String/valueOf (/ (- (System/currentTimeMillis) operationStart) 1000.0)) "seconds"]))
        )
