Exakat\Stats::collect PHP Method

collect() public method

public collect ( )
    public function collect()
    {
        $this->stats['tokens_count'] = $this->gremlin->queryOne('g.V().has(id, neq(0))' . $this->file_filter . '.count()');
        //'.has("atom",not(within("Index")))
        $this->stats['relations_count'] = $this->gremlin->queryOne('g.E().has(id, neq(0))' . $this->file_filter . '.count()');
        $this->stats['atoms_count'] = $this->gremlin->queryOne('g.V().label().unique()' . $this->file_filter . '.size()');
        $this->stats['LINK_count'] = $this->gremlin->queryOne('g.E().label().unique()' . $this->file_filter . '.size()');
        $this->stats['file_count'] = $this->gremlin->queryOne('g.V().inE("FILE").count(); ');
    }

Usage Example

Beispiel #1
0
 public function run()
 {
     $stats = new Stats($this->gremlin);
     if ($this->config->filename) {
         $stats->setFileFilter($this->config->filename);
     }
     $stats->collect();
     $stats = $stats->toArray();
     if ($this->config->json) {
         $output = json_encode($stats);
     } elseif ($this->config->table) {
         $output = $this->table_encode($stats);
     } else {
         $output = $this->text_encode($stats);
     }
     if ($this->config->output) {
         $outputFile = fopen($this->config->filename, 'w+');
         fwrite($outputFile, $output);
         fclose($outputFile);
     } else {
         echo $output;
     }
 }