Example #1
0
 public function __construct($argv)
 {
     parent::__construct();
     // get the parsers;
     $parsers = $this->getParsers();
     parent::addParameter('parser', true, implode("|", $parsers), null, 'bio2rdf parser to run');
     parent::addParameter('statistics', false, "true|false", "false", 'generate statistics');
     if (parent::setParameters($argv, true) === FALSE) {
         if (parent::getParameterValue('parser') == '') {
             parent::printParameters();
             exit;
         }
     }
     $statistics = parent::getParameterValue("statistics");
     // now get the file and run it
     $parser_name = parent::getParameterValue('parser');
     $file = $parser_name . '/' . $parser_name . '.php';
     if (!file_exists($file)) {
         trigger_error("{$file} does not exist", E_USER_ERROR);
         exit(-1);
     }
     require $file;
     $parser_class = str_replace(".", "", $parser_name) . "Parser";
     $parser = new $parser_class($argv);
     set_time_limit(0);
     $start = microtime(true);
     $parser->Run();
     $end = microtime(true);
     $time_taken = $end - $start;
     print "Start: " . date("l jS F \\@ g:i:s a", $start) . "\n";
     print "End:   " . date("l jS F \\@ g:i:s a", $end) . "\n";
     print "Time:  " . sprintf("%.2f", $time_taken) . " seconds\n";
 }