public function run() { if (!file_exists($this->config->projects_root . '/projects/' . $this->config->project . '/config.ini')) { throw new NoSuchProject($this->config->project); } $files = glob($this->exakatDir . '/*.csv'); foreach ($files as $file) { unlink($file); } $this->checkTokenLimit(); $this->id0 = $this->addAtom('Project'); $this->setAtom($this->id0, array('code' => 'Whole', 'fullcode' => $this->config->project, 'line' => -1, 'token' => 'T_WHOLE')); if (static::$client === null) { static::$client = new CypherG3(); // static::$client = new GremlinServerNeo4j(); } $this->datastore->cleanTable('tokenCounts'); if ($filename = $this->config->filename) { if (!is_file($filename)) { throw new MustBeAFile($filename); } if ($this->processFile($filename)) { $this->saveFiles(); $this->saveDefinitions(); } } elseif ($dirName = $this->config->dirname) { if (!is_dir($dirName)) { throw new MustBeADir($dirName); } $this->processDir($dirName); } elseif (($project = $this->config->project) !== 'default') { $this->processProject($project); } else { throw new NoFileToProcess($filename); } static::$client->finalize(); $this->datastore->addRow('hash', array('status' => 'Load')); $loadFinal = new LoadFinal($this->gremlin, $this->config, self::IS_SUBTASK); $loadFinal->run(); }