function tripal_pub_PMID_parse_publication_type

2.x tripal_pub.PMID.inc tripal_pub_PMID_parse_publication_type($xml, &$pub)
3.x tripal_chado.pub_importer_PMID.inc tripal_pub_PMID_parse_publication_type($xml, &$pub)
1.x PMID.inc tripal_pub_PMID_parse_publication_type($xml, &$pub)
1 call to tripal_pub_PMID_parse_publication_type()
tripal_pub_PMID_parse_article in tripal_pub/includes/importers/PMID.inc

File

tripal_pub/includes/importers/PMID.inc, line 531
Tripal Pub PubMed Interface

Code

function tripal_pub_PMID_parse_publication_type($xml, &$pub) {

  while ($xml->read()) {
    $element = $xml->name;

    if ($xml->nodeType == XMLReader::END_ELEMENT and $element == 'PublicationTypeList') {
      // we've reached the </PublicationTypeList> element so we're done.
      return;
    }
    if ($xml->nodeType == XMLReader::ELEMENT) {
      switch ($element) {
        case 'PublicationType':
          $xml->read();
          $value = $xml->value;
          $pub_cvterm = tripal_cv_get_cvterm_by_name($value, NULL, 'tripal_pub');
          if (!$pub_cvterm) {
            // see if this we can find the name using a synonym
            $pub_cvterm = tripal_cv_get_cvterm_by_synonym($value, NULL, 'tripal_pub');
            if (!$pub_cvterm) {
              watchdog('tpub_pubmed', 'Cannot find a valid vocabulary term for the publication type: "%term".', 
              array('%term' => $value), WATCHDOG_ERROR);
            }
          }
          else {
            $pub['Publication Type'][] = $pub_cvterm->name;
          }
          break;
        default:
          break;
      }
    }
  }
}