Ejemplo n.º 1
0
 /**
  * Creates a new software agent, if it does not already exist in the SoftwareAgents 
  * Collection.
  * 
  * @param $name Name of the software agent to be created
  * @param $label Label providing once sentence description of the agent 
  * @param $creator a function which configures any agent specific settings. 
  */
 private function createIfNotExist($name, $label)
 {
     $sc = SoftwareAgent::find($name);
     if (is_null($sc)) {
         $this->command->info('...Initializing: ' . $name);
         $agent = new SoftwareAgent($name, $label);
         // Create generic agent
         $agent->save();
         // And save the agent
     }
 }
Ejemplo n.º 2
0
 public function createVideoSegmentingSoftwareAgent()
 {
     if (!SoftwareAgent::find('videosegmenting')) {
         $softwareAgent = new SoftwareAgent();
         $softwareAgent->_id = "videosegmenting";
         $softwareAgent->label = "This component (pre)processes video documents by splitting the video into segments";
         $softwareAgent->save();
     }
 }
Ejemplo n.º 3
0
 public function createSoftwareAgent()
 {
     try {
         if (!SoftwareAgent::find('relexstructurer')) {
             $this->softwareAgent->_id = "relexstructurer";
             $this->softwareAgent->label = "This component (pre)processes chang documents into structured relex documents";
             $this->softwareAgent->save();
         }
     } catch (Exception $e) {
         $this->status['error']['relexstructurer'] = $e->getMessage();
     }
 }
Ejemplo n.º 4
0
 public function createOpenimagesVideoDescriptionExtractorSoftwareAgent()
 {
     if (!SoftwareAgent::find('videodescriptiongetter')) {
         $softwareAgent = new SoftwareAgent();
         $softwareAgent->_id = "videodescriptiongetter";
         $softwareAgent->label = "This component is used for getting the videos description from openimages.nl and storing them as documents within MongoDB";
         $softwareAgent->save();
     }
 }
Ejemplo n.º 5
0
 public function postUpload()
 {
     try {
         $files = Input::file('files');
         $project = Input::get('projectname');
         if (!SoftwareAgent::find('filecreator')) {
             $softwareAgent = new SoftwareAgent();
             $softwareAgent->_id = "filecreator";
             $softwareAgent->label = "This component is used for creating files in the database";
             $softwareAgent->save();
         }
         $activity = new Activity();
         $activity->label = "File added to the platform";
         $activity->softwareAgent_id = 'filecreator';
         $activity->save();
         $success = [];
         $entities = [];
         foreach ($files as $file) {
             try {
                 $entity = new File();
                 $entity->project = $project;
                 $entity->activity_id = $activity->_id;
                 $entity->store($file);
                 $entity->save();
                 array_push($success, 'Added ' . $entity->title . ' to ' . $entity->project);
                 array_push($entities, $entity);
             } catch (Exception $e) {
                 foreach ($entities as $en) {
                     $en->forceDelete();
                 }
                 throw $e;
             }
         }
         Session::flash('flashSuccess', $success);
         return $this->loadMediaUploadView();
     } catch (Exception $e) {
         return Redirect::back()->with('flashError', $e->getMessage());
     }
 }