Exemple #1
0
  private Optional<BibEntry> createNewEntry() {
    // Find out what type is desired
    EntryTypeDialog etd = new EntryTypeDialog(frame);
    // We want to center the dialog, to make it look nicer.
    etd.setLocationRelativeTo(frame);
    etd.setVisible(true);
    EntryType type = etd.getChoice();

    if (type != null) { // Only if the dialog was not canceled.
      String id = IdGenerator.next();
      final BibEntry bibEntry = new BibEntry(id, type.getName());
      try {
        panel.getDatabase().insertEntry(bibEntry);

        // Set owner/timestamp if options are enabled:
        List<BibEntry> list = new ArrayList<>();
        list.add(bibEntry);
        UpdateField.setAutomaticFields(list, true, true, Globals.prefs.getUpdateFieldPreferences());

        // Create an UndoableInsertEntry object.
        panel
            .getUndoManager()
            .addEdit(new UndoableInsertEntry(panel.getDatabase(), bibEntry, panel));
        panel.output(
            Localization.lang("Added new")
                + " '"
                + type.getName().toLowerCase()
                + "' "
                + Localization.lang("entry")
                + ".");

        // We are going to select the new entry. Before that, make sure that we are in
        // show-entry mode. If we aren't already in that mode, enter the WILL_SHOW_EDITOR
        // mode which makes sure the selection will trigger display of the entry editor
        // and adjustment of the splitter.
        if (panel.getMode() != BasePanelMode.SHOWING_EDITOR) {
          panel.setMode(BasePanelMode.WILL_SHOW_EDITOR);
        }

        SwingUtilities.invokeLater(() -> panel.showEntry(bibEntry));

        // The database just changed.
        panel.markBaseChanged();

        return Optional.of(bibEntry);
      } catch (KeyCollisionException ex) {
        LOGGER.info("Key collision occurred", ex);
      }
    }
    return Optional.empty();
  }
Exemple #2
0
  private BibtexString parseString() throws IOException {
    skipWhitespace();
    consume('{', '(');
    skipWhitespace();
    LOGGER.debug("Parsing string name");
    String name = parseTextToken();
    LOGGER.debug("Parsed string name");
    skipWhitespace();
    LOGGER.debug("Now the contents");
    consume('=');
    String content = parseFieldContent(name);
    LOGGER.debug("Now I'm going to consume a }");
    consume('}', ')');
    // Consume new line which signals end of entry
    skipOneNewline();
    LOGGER.debug("Finished string parsing.");

    String id = IdGenerator.next();
    return new BibtexString(id, name, content);
  }
Exemple #3
0
  private BibEntry parseEntry(String entryType) throws IOException {
    String id = IdGenerator.next();
    BibEntry result = new BibEntry(id, entryType);
    skipWhitespace();
    consume('{', '(');
    int character = peek();
    if ((character != '\n') && (character != '\r')) {
      skipWhitespace();
    }
    String key = parseKey();
    result.setCiteKey(key);
    skipWhitespace();

    while (true) {
      character = peek();
      if ((character == '}') || (character == ')')) {
        break;
      }

      if (character == ',') {
        consume(',');
      }

      skipWhitespace();

      character = peek();
      if ((character == '}') || (character == ')')) {
        break;
      }
      parseField(result);
    }

    consume('}', ')');

    // Consume new line which signals end of entry
    skipOneNewline();

    return result;
  }
  @Override
  public void endElement(String uri, String localName, String qName) {
    if ("PubmedArticle".equals(localName)) {
      // bibitems.add( new Bibitem(null, makeBibtexString(), Globals.nextKey(),"-1" )	 );
      // check if year ="" then give medline date instead
      if ("".equals(year)) {
        if (!"".equals(MedlineDate)) {
          // multi-year date format
          // System.out.println(MedlineDate);
          year = MedlineDate.substring(0, 4);
          // Matcher m = Pattern.compile("\\b[0-9]{4}\\b").matcher(MedlineDate);
          // if(m.matches())
          // year = m.group();
        }
      }

      // Build a string from the collected keywords:
      StringBuilder sb = new StringBuilder();
      for (Iterator<String> iterator = descriptors.iterator(); iterator.hasNext(); ) {
        String s = iterator.next();
        sb.append(s);
        if (iterator.hasNext()) {
          sb.append(MedlineHandler.KEYWORD_SEPARATOR);
        }
      }
      String keywords = sb.toString();

      BibEntry b =
          new BibEntry(
              IdGenerator.next(), // Globals.DEFAULT_BIBTEXENTRY_ID,
              EntryTypes.getTypeOrDefault(
                  "article")); // id assumes an existing database so don't create one here
      if (!"".equals(author)) {
        b.setField(
            "author",
            MedlineHandler.htmlConverter.formatUnicode(
                ImportFormatReader.expandAuthorInitials(author)));
        // b.setField("author",Util.replaceSpecialCharacters(ImportFormatReader.expandAuthorInitials(author)));
        author = "";
      }
      if (!"".equals(title)) {
        b.setField("title", MedlineHandler.htmlConverter.formatUnicode(title));
      }
      // if (!title.equals("")) b.setField("title",Util.replaceSpecialCharacters(title));
      if (!"".equals(journal)) {
        b.setField("journal", journal);
      }
      if (!"".equals(year)) {
        b.setField("year", year);
      }
      // PENDING [email protected] 2005-05-27 : added call to fixPageRange
      if (!"".equals(page)) {
        b.setField("pages", fixPageRange(page));
      }
      if (!"".equals(volume)) {
        b.setField("volume", volume);
      }
      if (!"".equals(language)) {
        b.setField("language", language);
      }
      if (!"".equals(pst)) {
        b.setField("medline-pst", pst);
      }
      if (!"".equals(abstractText)) {
        b.setField("abstract", abstractText.replaceAll("%", "\\\\%"));
      }
      if (!"".equals(keywords)) {
        b.setField("keywords", keywords);
      }
      if (!"".equals(month)) {
        b.setField("month", month);
      }
      // if (!url.equals("")) b.setField("url",url);
      if (!"".equals(number)) {
        b.setField("number", number);
      }

      if (!"".equals(doi)) {
        b.setField("doi", doi);
        b.setField("url", "http://dx.doi.org/" + doi);
      }
      if (!"".equals(pii)) {
        b.setField("pii", pii);
      }
      if (!"".equals(pmc)) {
        b.setField("pmc", pmc);
      }
      if (!"".equals(affiliation)) {
        b.setField("institution", affiliation.replaceAll("#", "\\\\#"));
      }

      // PENDING [email protected] 2005-05-27 : added "pmid" bibtex field
      // Older references do not have doi entries, but every
      // medline entry has a unique pubmed ID (aka primary ID).
      // Add a bibtex field for the pubmed ID for future use.
      if (!"".equals(pubmedid)) {
        b.setField("pmid", pubmedid);
      }

      bibitems.add(b);

      abstractText = "";
      author = "";
      title = "";
      journal = "";
      keywords = "";
      doi = "";
      pii = "";
      pmc = "";
      year = "";
      forename = "";
      lastName = "";
      suffix = "";
      abstractText = "";
      affiliation = "";
      pubmedid = "";
      majorTopic = "";
      minorTopics = "";
      month = "";
      volume = "";
      language = "";
      pst = "";
      lastname = "";
      suffix = "";
      initials = "";
      number = "";
      page = "";
      String medlineID = "";
      String url = "";
      MedlineDate = "";
      descriptors.clear();
    } else if ("ArticleTitle".equals(localName)) {
      inTitle = false;
    } else if ("PubDate".equals(localName)) {
      inPubDate = false;
    } else if ("Year".equals(localName)) {
      inYear = false;
    } else if ("PMID".equals(localName)) {
      inPubMedID = false;
    } else if ("MedlineDate".equals(localName)) {
      inMedlineDate = false;
    } else if ("MedlineTA".equals(localName)) {
      inJournal = false;
    } // journal name
    else if ("Month".equals(localName)) {
      inMonth = false;
    } else if ("Volume".equals(localName)) {
      inVolume = false;
    } else if ("Language".equals(localName)) {
      inLanguage = false;
    } else if ("PublicationStatus".equals(localName)) {
      inPst = false;
    } else if ("AuthorList".equals(localName)) {
      author = join(authors.toArray(), " and ");
      inAuthorList = false;
    } else if ("Author".equals(localName)) {
      // forename sometimes has initials with " " in middle: is pattern [A-Z] [A-Z]
      // when above is the case replace it with initials
      if ((forename.length() == 3) && (forename.charAt(1) == ' ')) {
        forename = initials;
      }

      // Put together name with last name first, and enter suffix in between if present:
      if (lastname.indexOf(" ") > 0) {
        author = "{" + lastname + "}";
      } else {
        author = lastname;
      }

      if (!suffix.isEmpty()) {
        author = author + ", " + suffix;
      }
      if (!forename.isEmpty()) {
        author = author + ", " + forename;
      }

      // author = initials + " " + lastname;
      authors.add(author);
      inAuthor = false;
      forename = "";
      initials = "";
      lastname = "";
      suffix = "";
    } else if ("DescriptorName".equals(localName)) {
      inDescriptorName = false;
    } else if ("QualifierName".equals(localName)) {
      inQualifierName = false;
    } else if ("MeshHeading".equals(localName)) {
      inMeshHeader = false;
      if ("".equals(minorTopics)) {
        descriptors.add(majorTopic);
      } else {
        descriptors.add(majorTopic + ", " + minorTopics);
      }
    } else if ("LastName".equals(localName)) {
      inLastName = false;
    } else if ("Suffix".equals(localName)) {
      inSuffix = false;
    } else if ("ForeName".equals(localName) || "FirstName".equals(localName)) {
      inForename = false;
    } else if ("Issue".equals(localName)) {
      inIssue = false;
    } else if ("MedlinePgn".equals(localName)) {
      inMedlinePgn = false;
    } // pagenumber
    else if ("URL".equals(localName)) {
      inUrl = false;
    } else if ("Initials".equals(localName)) {
      // initials= '.' + initials + '.';
      inInitials = false;
    } else if ("AbstractText".equals(localName)) {
      inAbstractText = false;
    } else if ("Affiliation".equals(localName)) {
      inAffiliation = false;
    } else if ("ArticleId".equals(localName)) {
      if (inDoi) {
        inDoi = false;
      } else if (inPii) {
        inPii = false;
      } else if (inPmc) {
        inPmc = false;
      }
    }
  }
Exemple #5
0
  private BibEntry parseEntry(Element e) {
    String author = null;
    String editor = null;
    String title = null;
    String publisher = null;
    String year = null;
    String address = null;
    String series = null;
    String edition = null;
    String isbn = null;
    String issn = null;
    String number = null;
    String pagetotal = null;
    String volume = null;
    String pages = null;
    String journal = null;
    String ppn = null;
    String booktitle = null;
    String url = null;
    String note = null;

    String quelle = "";
    String mak = "";
    String subtitle = "";

    String entryType = "book"; // Default

    // Alle relevanten Informationen einsammeln

    List<Element> datafields = getChildren("datafield", e);
    for (Element datafield : datafields) {
      String tag = datafield.getAttribute("tag");
      LOGGER.debug("tag: " + tag);

      // mak
      if ("002@".equals(tag)) {
        mak = getSubfield("0", datafield);
        if (mak == null) {
          mak = "";
        }
      }

      // ppn
      if ("003@".equals(tag)) {
        ppn = getSubfield("0", datafield);
      }

      // author
      if ("028A".equals(tag)) {
        String vorname = getSubfield("d", datafield);
        String nachname = getSubfield("a", datafield);

        if (author == null) {
          author = "";
        } else {
          author = author.concat(" and ");
        }
        author = author.concat(vorname + " " + nachname);
      }
      // author (weiterer)
      if ("028B".equals(tag)) {
        String vorname = getSubfield("d", datafield);
        String nachname = getSubfield("a", datafield);

        if (author == null) {
          author = "";
        } else {
          author = author.concat(" and ");
        }
        author = author.concat(vorname + " " + nachname);
      }

      // editor
      if ("028C".equals(tag)) {
        String vorname = getSubfield("d", datafield);
        String nachname = getSubfield("a", datafield);

        if (editor == null) {
          editor = "";
        } else {
          editor = editor.concat(" and ");
        }
        editor = editor.concat(vorname + " " + nachname);
      }

      // title and subtitle
      if ("021A".equals(tag)) {
        title = getSubfield("a", datafield);
        subtitle = getSubfield("d", datafield);
      }

      // publisher and address
      if ("033A".equals(tag)) {
        publisher = getSubfield("n", datafield);
        address = getSubfield("p", datafield);
      }

      // year
      if ("011@".equals(tag)) {
        year = getSubfield("a", datafield);
      }

      // year, volume, number, pages (year bei Zeitschriften (evtl. redundant mit 011@))
      if ("031A".equals(tag)) {
        year = getSubfield("j", datafield);

        volume = getSubfield("e", datafield);
        number = getSubfield("a", datafield);
        pages = getSubfield("h", datafield);
      }

      // 036D seems to contain more information than the other fields
      // overwrite information using that field
      // 036D also contains information normally found in 036E
      if ("036D".equals(tag)) {
        // 021 might have been present
        if (title != null) {
          // convert old title (contained in "a" of 021A) to volume
          if (title.startsWith("@")) {
            // "@" indicates a number
            title = title.substring(1);
          } else {
            // we nevertheless keep the old title data
          }
          number = title;
        }
        // title and subtitle
        title = getSubfield("a", datafield);
        subtitle = getSubfield("d", datafield);
        volume = getSubfield("l", datafield);
      }

      // series and number
      if ("036E".equals(tag)) {
        series = getSubfield("a", datafield);
        number = getSubfield("l", datafield);
        String kor = getSubfield("b", datafield);

        if (kor != null) {
          series = series + " / " + kor;
        }
      }

      // note
      if ("037A".equals(tag)) {
        note = getSubfield("a", datafield);
      }

      // edition
      if ("032@".equals(tag)) {
        edition = getSubfield("a", datafield);
      }

      // isbn
      if ("004A".equals(tag)) {
        final String isbn10 = getSubfield("0", datafield);
        final String isbn13 = getSubfield("A", datafield);

        if (isbn10 != null) {
          isbn = isbn10;
        }

        if (isbn13 != null) {
          isbn = isbn13;
        }
      }

      // Hochschulschriftenvermerk
      // Bei einer Verlagsdissertation ist der Ort schon eingetragen
      if ("037C".equals(tag)) {
        if (address == null) {
          address = getSubfield("b", datafield);
          if (address != null) {
            address = removeSortCharacters(address);
          }
        }

        String st = getSubfield("a", datafield);
        if ((st != null) && st.contains("Diss")) {
          entryType = "phdthesis";
        }
      }

      // journal oder booktitle

      /* Problematiken hier: Sowohl für Artikel in
       * Zeitschriften als für Beiträge in Büchern
       * wird 027D verwendet. Der Titel muß je nach
       * Fall booktitle oder journal zugeordnet
       * werden. Auch bei Zeitschriften werden hier
       * ggf. Verlag und Ort angegeben (sind dann
       * eigentlich überflüssig), während bei
       * Buchbeiträgen Verlag und Ort wichtig sind
       * (sonst in Kategorie 033A).
       */
      if ("027D".equals(tag)) {
        journal = getSubfield("a", datafield);
        booktitle = getSubfield("a", datafield);
        address = getSubfield("p", datafield);
        publisher = getSubfield("n", datafield);
      }

      // pagetotal
      if ("034D".equals(tag)) {
        pagetotal = getSubfield("a", datafield);

        if (pagetotal != null) {
          // S, S. etc. entfernen
          pagetotal = pagetotal.replaceAll(" S\\.?$", "");
        }
      }

      // Behandlung von Konferenzen
      if ("030F".equals(tag)) {
        address = getSubfield("k", datafield);

        if (!"proceedings".equals(entryType)) {
          subtitle = getSubfield("a", datafield);
        }

        entryType = "proceedings";
      }

      // Wenn eine Verlagsdiss vorliegt
      if ("phdthesis".equals(entryType) && (isbn != null)) {
        entryType = "book";
      }

      // Hilfskategorien zur Entscheidung @article
      // oder @incollection; hier könnte man auch die
      // ISBN herausparsen als Erleichterung für das
      // Auffinden der Quelle, die über die
      // SRU-Schnittstelle gelieferten Daten zur
      // Quelle unvollständig sind (z.B. nicht Serie
      // und Nummer angegeben werden)
      if ("039B".equals(tag)) {
        quelle = getSubfield("8", datafield);
      }
      if ("046R".equals(tag) && ((quelle == null) || quelle.isEmpty())) {
        quelle = getSubfield("a", datafield);
      }

      // URLs behandeln
      if ("009P".equals(tag)
          && ("03".equals(datafield.getAttribute("occurrence"))
              || "05".equals(datafield.getAttribute("occurrence")))
          && (url == null)) {
        url = getSubfield("a", datafield);
      }
    }

    // Abfangen von Nulleintraegen
    if (quelle == null) {
      quelle = "";
    }

    // Nichtsortierzeichen entfernen
    if (author != null) {
      author = removeSortCharacters(author);
    }
    if (editor != null) {
      editor = removeSortCharacters(editor);
    }
    if (title != null) {
      title = removeSortCharacters(title);
    }
    if (subtitle != null) {
      subtitle = removeSortCharacters(subtitle);
    }

    // Dokumenttyp bestimmen und Eintrag anlegen

    if (mak.startsWith("As")) {
      entryType = BibEntry.DEFAULT_TYPE;

      if (quelle.contains("ISBN")) {
        entryType = "incollection";
      }
      if (quelle.contains("ZDB-ID")) {
        entryType = "article";
      }
    } else if (mak.isEmpty()) {
      entryType = BibEntry.DEFAULT_TYPE;
    } else if (mak.startsWith("O")) {
      entryType = BibEntry.DEFAULT_TYPE;
      // FIXME: online only available in Biblatex
      // entryType = "online";
    }

    /*
     * Wahrscheinlichkeit, dass ZDB-ID
     * vorhanden ist, ist größer als ISBN bei
     * Buchbeiträgen. Daher bei As?-Sätzen am besten immer
     * dann @incollection annehmen, wenn weder ISBN noch
     * ZDB-ID vorhanden sind.
     */
    BibEntry result = new BibEntry(IdGenerator.next(), entryType);

    // Zuordnung der Felder in Abhängigkeit vom Dokumenttyp
    if (author != null) {
      result.setField(FieldName.AUTHOR, author);
    }
    if (editor != null) {
      result.setField(FieldName.EDITOR, editor);
    }
    if (title != null) {
      result.setField(FieldName.TITLE, title);
    }
    if (!Strings.isNullOrEmpty(subtitle)) {
      // ensure that first letter is an upper case letter
      // there could be the edge case that the string is only one character long, therefore, this
      // special treatment
      // this is Apache commons lang StringUtils.capitalize
      // (https://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/StringUtils.html#capitalize%28java.lang.String%29), but we don't want to add an additional dependency  ('org.apache.commons:commons-lang3:3.4')
      StringBuilder newSubtitle =
          new StringBuilder(Character.toString(Character.toUpperCase(subtitle.charAt(0))));
      if (subtitle.length() > 1) {
        newSubtitle.append(subtitle.substring(1));
      }
      result.setField(FieldName.SUBTITLE, newSubtitle.toString());
    }
    if (publisher != null) {
      result.setField(FieldName.PUBLISHER, publisher);
    }
    if (year != null) {
      result.setField(FieldName.YEAR, year);
    }
    if (address != null) {
      result.setField(FieldName.ADDRESS, address);
    }
    if (series != null) {
      result.setField(FieldName.SERIES, series);
    }
    if (edition != null) {
      result.setField(FieldName.EDITION, edition);
    }
    if (isbn != null) {
      result.setField(FieldName.ISBN, isbn);
    }
    if (issn != null) {
      result.setField(FieldName.ISSN, issn);
    }
    if (number != null) {
      result.setField(FieldName.NUMBER, number);
    }
    if (pagetotal != null) {
      result.setField(FieldName.PAGETOTAL, pagetotal);
    }
    if (pages != null) {
      result.setField(FieldName.PAGES, pages);
    }
    if (volume != null) {
      result.setField(FieldName.VOLUME, volume);
    }
    if (journal != null) {
      result.setField(FieldName.JOURNAL, journal);
    }
    if (ppn != null) {
      result.setField("ppn_GVK", ppn);
    }
    if (url != null) {
      result.setField(FieldName.URL, url);
    }
    if (note != null) {
      result.setField(FieldName.NOTE, note);
    }

    if ("article".equals(entryType) && (journal != null)) {
      result.setField(FieldName.JOURNAL, journal);
    } else if ("incollection".equals(entryType) && (booktitle != null)) {
      result.setField(FieldName.BOOKTITLE, booktitle);
    }

    return result;
  }
Exemple #6
0
  private void parseArticle(PubmedArticle article, List<BibEntry> bibItems) {
    Map<String, String> fields = new HashMap<>();

    if (article.getPubmedData() != null) {
      if (article.getMedlineCitation().getDateRevised() != null) {
        DateRevised dateRevised = article.getMedlineCitation().getDateRevised();
        addDateRevised(fields, dateRevised);
        putIfValueNotNull(fields, "pubstatus", article.getPubmedData().getPublicationStatus());
      }
    }
    if (article.getMedlineCitation() != null) {
      MedlineCitation medlineCitation = article.getMedlineCitation();

      fields.put("status", medlineCitation.getStatus());
      DateCreated dateCreated = medlineCitation.getDateCreated();
      fields.put(
          "created",
          convertToDateFormat(dateCreated.getYear(), dateCreated.getMonth(), dateCreated.getDay()));
      fields.put("pubmodel", medlineCitation.getArticle().getPubModel());

      if (medlineCitation.getDateCompleted() != null) {
        DateCompleted dateCompleted = medlineCitation.getDateCompleted();
        fields.put(
            "completed",
            convertToDateFormat(
                dateCompleted.getYear(), dateCompleted.getMonth(), dateCompleted.getDay()));
      }

      fields.put("pmid", medlineCitation.getPMID().getContent());
      fields.put(FieldName.OWNER, medlineCitation.getOwner());

      addArticleInformation(fields, medlineCitation.getArticle().getContent());

      MedlineJournalInfo medlineJournalInfo = medlineCitation.getMedlineJournalInfo();
      putIfValueNotNull(fields, "country", medlineJournalInfo.getCountry());
      putIfValueNotNull(fields, "journal-abbreviation", medlineJournalInfo.getMedlineTA());
      putIfValueNotNull(fields, "nlm-id", medlineJournalInfo.getNlmUniqueID());
      putIfValueNotNull(fields, "issn-linking", medlineJournalInfo.getISSNLinking());
      if (medlineCitation.getChemicalList() != null) {
        if (medlineCitation.getChemicalList().getChemical() != null) {
          addChemicals(fields, medlineCitation.getChemicalList().getChemical());
        }
      }
      if (medlineCitation.getCitationSubset() != null) {
        fields.put("citation-subset", join(medlineCitation.getCitationSubset(), ", "));
      }
      if (medlineCitation.getGeneSymbolList() != null) {
        addGeneSymbols(fields, medlineCitation.getGeneSymbolList());
      }
      if (medlineCitation.getMeshHeadingList() != null) {
        addMeashHeading(fields, medlineCitation.getMeshHeadingList());
      }
      putIfValueNotNull(fields, "references", medlineCitation.getNumberOfReferences());
      if (medlineCitation.getPersonalNameSubjectList() != null) {
        addPersonalNames(fields, medlineCitation.getPersonalNameSubjectList());
      }
      if (medlineCitation.getOtherID() != null) {
        addOtherId(fields, medlineCitation.getOtherID());
      }
      if (medlineCitation.getKeywordList() != null) {
        addKeyWords(fields, medlineCitation.getKeywordList());
      }
      if (medlineCitation.getSpaceFlightMission() != null) {
        fields.put("space-flight-mission", join(medlineCitation.getSpaceFlightMission(), ", "));
      }
      if (medlineCitation.getInvestigatorList() != null) {
        addInvestigators(fields, medlineCitation.getInvestigatorList());
      }
      if (medlineCitation.getGeneralNote() != null) {
        addNotes(fields, medlineCitation.getGeneralNote());
      }
    }

    BibEntry entry = new BibEntry(IdGenerator.next(), "article");
    entry.setField(fields);

    bibItems.add(entry);
  }
Exemple #7
0
  private void parseBookArticle(PubmedBookArticle currentArticle, List<BibEntry> bibItems) {
    Map<String, String> fields = new HashMap<>();
    if (currentArticle.getBookDocument() != null) {
      BookDocument bookDocument = currentArticle.getBookDocument();
      fields.put("pmid", bookDocument.getPMID().getContent());
      if (bookDocument.getDateRevised() != null) {
        DateRevised dateRevised = bookDocument.getDateRevised();
        addDateRevised(fields, dateRevised);
      }
      if (bookDocument.getAbstract() != null) {
        Abstract abs = bookDocument.getAbstract();
        addAbstract(fields, abs);
      }
      if (bookDocument.getPagination() != null) {
        Pagination pagination = bookDocument.getPagination();
        addPagination(fields, pagination);
      }
      if (bookDocument.getSections() != null) {
        ArrayList<String> result = new ArrayList<>();
        Sections sections = bookDocument.getSections();
        for (Section section : sections.getSection()) {
          for (Serializable content : section.getSectionTitle().getContent()) {
            if (content instanceof String) {
              result.add((String) content);
            }
          }
        }
        fields.put("sections", join(result, "; "));
      }
      if (bookDocument.getKeywordList() != null) {
        addKeyWords(fields, bookDocument.getKeywordList());
      }
      if (bookDocument.getContributionDate() != null) {
        addContributionDate(fields, bookDocument.getContributionDate());
      }
      if (bookDocument.getPublicationType() != null) {
        List<String> result = new ArrayList<>();
        for (PublicationType type : bookDocument.getPublicationType()) {
          if (type.getContent() != null) {
            result.add(type.getContent());
          }
        }
        fields.put("pubtype", join(result, ", "));
      }
      if (bookDocument.getArticleTitle() != null) {
        ArticleTitle articleTitle = bookDocument.getArticleTitle();
        ArrayList<String> titles = new ArrayList<>();
        for (Serializable content : articleTitle.getContent()) {
          if (content instanceof String) {
            titles.add((String) content);
          }
        }
        fields.put("article", join(titles, ", "));
      }
      if (bookDocument.getBook() != null) {
        addBookInformation(fields, bookDocument.getBook());
      }
    }

    if (currentArticle.getPubmedBookData() != null) {
      PubmedBookData bookData = currentArticle.getPubmedBookData();
      putIfValueNotNull(fields, "pubstatus", bookData.getPublicationStatus());
    }

    BibEntry entry = new BibEntry(IdGenerator.next(), "article");
    entry.setField(fields);

    bibItems.add(entry);
  }