/* connector for INBio Partner provides DWC-A file estimated execution time: 18 minutes */ include_once dirname(__FILE__) . "/../../config/environment.php"; $timestart = time_elapsed(); require_library('connectors/INBioAPI'); $resource_id = 276; // $dwca_file = "http://localhost/~eolit/dwca-inbio-eol.zip"; //zip extracts directly to temp_dir // $dwca_file = "http://localhost/~eolit/dwca_inbio.zip"; //zip extracts it within a folder inside temp_dir // $dwca_file = "http://localhost/~eolit/dwca_inbio_small.zip"; // $dwca_file = "http://localhost/~eolit/dwca.tar.gz"; $dwca_file = "http://dl.dropbox.com/u/7597512/INBIO/dwca_inbio.zip"; $func = new INBioAPI(); if ($taxa = $func->get_all_taxa($dwca_file)) { $xml = \SchemaDocument::get_taxon_xml($taxa); $xml = $func->assign_eol_subjects($xml); $resource_path = CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml"; if (!($OUT = fopen($resource_path, "w"))) { debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $resource_path); return; } fwrite($OUT, $xml); fclose($OUT); Functions::set_resource_status_to_force_harvest($resource_id); } $elapsed_time_sec = time_elapsed() - $timestart; echo "\nelapsed time = " . $elapsed_time_sec . " seconds"; echo "\nelapsed time = " . $elapsed_time_sec / 60 . " minutes"; echo "\nDone processing.";
/* connector for National Museum of Natural History Image Collection estimated execution time: 1.5 mins. Connector reads the XML provided by partner and - sets the image rating. - If needed ingests TypeInformation text dataObjects */ include_once dirname(__FILE__) . "/../../config/environment.php"; require_library('ResourceDataObjectElementsSetting'); $timestart = time_elapsed(); $resource_id = 120; $resource_path = "http://collections.mnh.si.edu/services/eol/nmnh-iz-response.xml.gz"; //NMNH Invertebrate Zoology resource $result = $GLOBALS['db_connection']->select("SELECT accesspoint_url FROM resources WHERE id={$resource_id}"); $row = $result->fetch_row(); $new_resource_path = $row[0]; if ($resource_path != $new_resource_path && $new_resource_path != '') { $resource_path = $new_resource_path; } echo "\n processing resource:\n {$resource_path} \n\n"; $nmnh = new ResourceDataObjectElementsSetting($resource_id, $resource_path, 'http://purl.org/dc/dcmitype/StillImage', 2); $xml = $nmnh->set_data_object_rating_on_xml_document(); require_library('connectors/INBioAPI'); $xml = INBioAPI::assign_eol_subjects($xml); $nmnh->save_resource_document($xml); Functions::set_resource_status_to_force_harvest($resource_id); $elapsed_time_sec = time_elapsed() - $timestart; echo "\n"; echo "elapsed time = {$elapsed_time_sec} seconds \n"; echo "elapsed time = " . $elapsed_time_sec / 60 . " minutes \n"; echo "elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours \n"; echo "\n\n Done processing.";