Пример #1
0
 function createImageObject($obj_specimen_pid, $obj_jp2URL, $obj_rft_id, $obj_sourceURL, $obj_width, $obj_height, $obj_jpeg_datastream_url, $obj_label)
 {
     $this->pid = $this->getNextImagePid();
     $this->specimen_pid = $obj_specimen_pid;
     $this->jp2URL = $obj_jp2URL;
     $this->rft_id = $obj_rft_id;
     $this->sourceURL = $obj_sourceURL;
     $this->width = $obj_width;
     $this->height = $obj_height;
     $this->jpeg_datastream_url = $obj_jpeg_datastream_url;
     if ($obj_label != null && $obj_label != '') {
         $this->label = $obj_label;
     } else {
         $this->label = $this->pid;
         //We may use something other than the pid for the label eventually
     }
     //create relationships
     $pid_base = 'image';
     if ($this->startFOXML()) {
         if (!$this->addImage_RELS_EXT_datastream()) {
             echo 'Unable to addImage_RELS_EXT_datastream.<br>';
         }
         if (!$this->addDC_datastream()) {
             echo 'Unable to addDC_datastream.<br>';
         }
         list($this->width, $this->height) = getimagesize($this->jp2URL);
         if (!$this->addImageMetadata_datastream()) {
             echo 'Unable to addImageMetadata_datastream.<br>';
         }
         if (!$this->addJPEG_datastream()) {
             echo 'Unable to addJPEG_datastream.<br>';
         }
         try {
             $foxml_file = str_replace(':', '_', $this->pid);
             $foxml_file = '/var/www/drupal/sites/default/files/apiary_datastreams/' . $foxml_file . '.xml';
             if (file_exists($foxml_file)) {
                 unlink($foxml_file);
             }
             $this->dom->save($foxml_file);
             if ($object = ingest_object_from_FOXML($this->dom)) {
                 $this->msg = "{$this->pid} successfully created.";
                 include_once drupal_get_path('module', 'apiary_project') . '/workflow/include/search.php';
                 $search_instance = new search();
                 $search_instance->index($this->pid);
                 return true;
             } else {
                 $this->msg = "Unable to ingest image FOXML dom document.";
                 return false;
             }
         } catch (exception $e) {
             drupal_set_message(t('Error Ingesting Image Object! ') . $e->getMessage(), 'error');
             watchdog(t("Fedora_Repository"), "Error Ingesting Image Object!" . $e->getMessage(), WATCHDOG_ERROR);
             return false;
         }
     } else {
         $this->msg = "Unable to start image FOXML file for create image object.";
         return false;
     }
     return true;
 }
Пример #2
0
 function createSpecimenObject($collector, $collection_number, $collection_date, $scientific_name, $obj_label)
 {
     $this->pid = $this->getNextSpecimenPid();
     if ($obj_label != null && $label != '') {
         $this->label = $obj_label;
     } else {
         $this->label = $this->pid;
         //We may use something other than the pid for the label eventually
     }
     //create relationships
     $this->pid_base = 'specimen';
     if ($this->startFOXML()) {
         if (!$this->addSpecimenRELS_EXT_datastream()) {
             echo 'Unable to addSpecimenRELS_EXT_datastream.<br>';
         }
         if (!$this->addDC_datastream()) {
             echo 'Unable to addDC_datastream.<br>';
         }
         if (!$this->addCoreSpecimenMetadata_datastream($collector, $collection_number, $collection_date, $scientific_name, $pid, $dom, $rootElement)) {
             echo 'Unable to addCoreSpecimenMetadata_datastream.<br>';
         }
         if (!$this->addSpecimenMetadata_datastream($pid, $dom, $rootElement)) {
             echo 'Unable to addCoreSpecimenMetadata_datastream.<br>';
         }
         $foxml_file = str_replace(':', '_', $this->pid);
         $foxml_file = '/var/www/drupal/sites/default/files/apiary_datastreams/' . $foxml_file . '.xml';
         if (file_exists($foxml_file)) {
             unlink($foxml_file);
         }
         $this->dom->save($foxml_file);
         if ($object = ingest_object_from_FOXML($this->dom)) {
             $this->msg = "{$this->pid} successfully created.";
             return true;
         } else {
             $this->msg = "Unable to ingest specimen FOXML dom document.";
             return false;
         }
     } else {
         $this->msg = "Unable to start specimen FOXML file for create specimen object.";
         return false;
     }
 }
Пример #3
0
 function createROIObject($obj_image_pid, $obj_sourceURL, $obj_roiURL, $obj_roiType, $obj_x1, $obj_y1, $obj_width, $obj_height, $obj_parent_image_width, $obj_parent_image_height, $obj_parent_image_display_width, $obj_parent_image_display_height, $obj_label)
 {
     $this->image_pid = $obj_image_pid;
     $this->sourceURL = $obj_sourceURL;
     $this->roiURL = $obj_roiURL;
     $this->roiType = $obj_roiType;
     $this->x1 = $obj_x1;
     $this->y1 = $obj_y1;
     $this->width = $obj_width;
     $this->height = $obj_height;
     $this->parent_image_width = $obj_parent_image_width;
     $this->parent_image_height = $obj_parent_image_height;
     $this->parent_image_display_width = $obj_parent_image_display_width;
     $this->parent_image_display_height = $obj_parent_image_display_height;
     $this->pid = $this->getNextROIPid();
     $this->status = "";
     if ($obj_label != null && $obj_label != '') {
         $this->label = $obj_label;
     } else {
         $this->label = $this->pid;
         //We may use something other than the pid for the label eventually
     }
     //create relationships
     $pid_base = 'roi';
     if ($this->startFOXML()) {
         if (!$this->addROI_RELS_EXT_datastream()) {
             $this->status .= 'Unable to addROI_RELS_EXT_datastream. ';
         }
         if (!$this->addDC_datastream()) {
             $this->status .= 'Unable to addDC_datastream. ';
         }
         if (!$this->addROIMetadata_datastream()) {
             $this->status .= 'Unable to addROIMetadata_datastream. ';
         }
         if (!$this->addJPEG_datastream()) {
             $this->status .= 'Unable to addJPEG_datastream. ';
         }
         try {
             $foxml_file = str_replace(':', '_', $this->pid) . '_' . date("YmdHis");
             $foxml_file = '/var/www/drupal/sites/default/files/apiary_datastreams/' . $foxml_file . '.xml';
             if (file_exists($foxml_file)) {
                 unlink($foxml_file);
             }
             $this->dom->save($foxml_file);
             if ($object = ingest_object_from_FOXML($this->dom)) {
                 $this->msg = "{$this->pid} successfully created.";
                 $this->status .= $this->msg;
                 return true;
             } else {
                 $this->msg = "Unable to ingest image FOXML dom document. ";
                 $this->status .= $this->msg;
                 return false;
             }
         } catch (exception $e) {
             drupal_set_message(t('Error Ingesting Image Object! ') . $e->getMessage(), 'error');
             watchdog(t("Fedora_Repository"), "Error Ingesting Image Object!" . $e->getMessage(), WATCHDOG_ERROR);
             return false;
         }
     } else {
         $this->msg = "Unable to start image FOXML file for create image object. ";
         $this->status .= $this->msg;
         return false;
     }
     return true;
 }