/**
  * Short description of method run
  *
  * @access protected
  * @author Bertrand Chevrier, <*****@*****.**>
  * @return mixed
  */
 protected function run()
 {
     if (!defined('DEBUG_PERSISTENCE')) {
         define('DEBUG_PERSISTENCE', false);
     }
     switch ($this->mode) {
         case self::MODE_SMOOTH2HARD:
             $this->out("Compiling triples to relational database...", array('color' => 'light_blue'));
             $options = array('recursive' => true, 'append' => true, 'createForeigns' => false, 'referencesAllTypes' => true, 'rmSources' => true);
             $switcher = new core_kernel_persistence_Switcher(array('http://www.tao.lu/middleware/wfEngine.rdf#ClassProcessVariables', 'http://www.tao.lu/Ontologies/TAOResult.rdf#GradeVariable'));
             $api = core_kernel_impl_ApiModelOO::singleton();
             $toCompile = $api->getAllClasses()->toArray();
             foreach ($toCompile as $tC) {
                 $classLabel = $tC->getLabel();
                 $this->out("\nCompiling '{$classLabel}' class...", array('color' => 'light_blue'));
                 $switcher->hardify($tC, $options);
             }
             unset($switcher);
             $this->out("Compilation process complete.");
             break;
         case self::MODE_HARD2SMOOTH:
             $this->out("Uncompiling relational database to triples...", array('color' => 'light_blue'));
             $options = array('recursive' => true, 'removeForeigns' => true);
             $switcher = new core_kernel_persistence_Switcher(array('http://www.tao.lu/middleware/wfEngine.rdf#ClassProcessVariables', 'http://www.tao.lu/Ontologies/TAOResult.rdf#GradeVariable'));
             $api = core_kernel_impl_ApiModelOO::singleton();
             $toDecompile = $api->getAllClasses()->toArray();
             foreach ($toDecompile as $tD) {
                 $classLabel = $tD->getLabel();
                 $this->out("\nDecompiling '{$classLabel}' class...", array('color' => 'light_blue'));
                 $switcher->unhardify($tD, $options);
             }
             $this->out("Decompilation process complete.");
             unset($switcher);
             break;
         default:
             $this->err('Unknow mode', true);
     }
 }