Пример #1
0
        		}
        		*/
    }
    return $found;
}
// test
if (0) {
    $item = new stdClass();
    //search_cinii('', '0003-5092', 18, 185, 0, 1939, $item);
    //search_cinii('','1343-8786', 2, 439, 445, 1999, $item);
    // 1(2), June 25 1998: 233-239.
    // Entomological Science
    //search_cinii('','1343-8786', 1, 233, 239, 1998, $item);
    // ANNOTATIONES ZOOLOGICAE JAPONENSES
    //search_cinii('', '0003-5092', 56, 338, 350, 1983, $item);
    // Entomological REview
    //search_cinii('', '0286-9810', 58, 1, 6, 2003, $item);
    //search_cinii('', '0286-9810', 58, 1, 6, 2003, $item);
    //search_cinii('', '0286-9810', 61, 119, 126, 2006, $item);
    // new
    //search_cinii('', '0286-9810', 58, 1, $item);
    //search_cinii('', '0003-5092', 56, 338, $item);
    search_cinii('', '1343-8786', 2, 439, $item);
    print_r($item);
    if (find_in_cache($item)) {
        echo "already exists\n";
    } else {
        echo "store\n";
        store_in_cache($item);
    }
}
Пример #2
0
 function find_article_have_spage($values, &$item)
 {
     global $debug;
     global $error;
     $found = false;
     // Is it in our cache?
     $tmp_item = new stdClass();
     $tmp_item->issn = $values['issn'];
     $tmp_item->volume = $values['volume'];
     $tmp_item->spage = $values['spage'];
     $cache_id = find_in_cache($tmp_item);
     if ($cache_id != 0) {
         $item = retrieve_from_db($cache_id);
         $found = true;
     } else {
         // Off to the Cloud...
         $doi = search_for_doi($values['issn'], $values['volume'], $values['spage'], $values['genre'], $item);
         if ($doi != '') {
             $found = true;
             // flesh out with other identifiers (do this here as this is a freshly discovered DOI)
             $pmid = get_pubmed_from_doi($doi);
             if ($pmid != 0) {
                 $item->pmid = $pmid;
             }
         } else {
             $error = ERROR_NOT_FOUND_IN_CROSSREF;
             if ($debug) {
                 echo '<p>Not found in CrossRef</p>';
             }
         }
         if (!$found) {
             if (enough_for_jstor_lookup($values)) {
                 if ($debug) {
                     echo '<p>Trying JSTOR</p>';
                 }
                 // Make a simple SICI to search JSTOR
                 $sici = sici_from_meta($values);
                 $found = jstor_metadata($sici, $item);
                 if ($found) {
                     $error = ERROR_OK;
                 }
             } else {
                 $error = ERROR_NOT_ENOUGH_FOR_JSTOR_LOOKUP;
                 if ($debug) {
                     echo '<p>Not enough for lookup in JSTOR</p>';
                 }
             }
         }
         // Try CiNii
         if (!$found) {
             if ($debug) {
                 echo '<p>CiNii</p>';
             }
             $found = search_cinii($values['title'], $values['issn'], $values['volume'], $values['spage'], $item, $debug);
             if ($found) {
                 $error = ERROR_OK;
             }
         }
         if ($found) {
             if (find_in_cache($item) == 0) {
                 store_in_cache($item);
             }
         }
     }
     //echo $error;
     return $found;
 }