/**
  * 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
     }
 }
 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();
     }
 }
Example #3
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();
     }
 }
 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());
     }
 }