 neo4j = require "neo4j"
 {race} = require 'sinkrow'
 
-module.exports = class Graph 
+module.exports = class Graph
   constructor:(config)->
     @db = new neo4j.GraphDatabase(config.host + ":" + config.port);
 

        , ->
          console.log new Date().getTime() - start
          callback null, tempRes
        resultData = ( result.koding.data for result in results)  
        objectify resultData, (objecteds)->
          for objected in objecteds
            tempRes.push objected
            collectRelations objected 

  fecthRelatedItems:(itemId, callback)->
    query = [

    query = [
      'start koding=node:koding(\'id:*\')'
      'where koding.name = "JTutorial"'
      ' or koding.name = "JCodeSnip"'
      ' or koding.name = "JDiscussion"'
      ' or koding.name = "JStatusUpdate"'
      'return *'
      'order by koding.`meta.createdAt` DESC'
      'limit 4'
    ].join('\n');

    params =
      itemId : "515360d23af2fb6b6b000009"

    @db.query query, params, (err, results)=>
#      console.log results
