Search in sources :

Example 1 with DateRevised

use of org.jabref.logic.importer.fileformat.medline.DateRevised in project jabref by JabRef.

the class MedlineImporter method parseArticle.

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.getPubmedData().getArticleIdList() != null) {
                ArticleIdList articleIdList = article.getPubmedData().getArticleIdList();
                addArticleIdList(fields, articleIdList);
            }
        }
    }
    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(FieldName.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("article");
    entry.setField(fields);
    bibItems.add(entry);
}
Also used : MedlineCitation(org.jabref.logic.importer.fileformat.medline.MedlineCitation) MedlineJournalInfo(org.jabref.logic.importer.fileformat.medline.MedlineJournalInfo) BibEntry(org.jabref.model.entry.BibEntry) HashMap(java.util.HashMap) DateCompleted(org.jabref.logic.importer.fileformat.medline.DateCompleted) DateCreated(org.jabref.logic.importer.fileformat.medline.DateCreated) DateRevised(org.jabref.logic.importer.fileformat.medline.DateRevised) ArticleIdList(org.jabref.logic.importer.fileformat.medline.ArticleIdList)

Example 2 with DateRevised

use of org.jabref.logic.importer.fileformat.medline.DateRevised in project jabref by JabRef.

the class MedlineImporter method parseBookArticle.

private void parseBookArticle(PubmedBookArticle currentArticle, List<BibEntry> bibItems) {
    Map<String, String> fields = new HashMap<>();
    if (currentArticle.getBookDocument() != null) {
        BookDocument bookDocument = currentArticle.getBookDocument();
        fields.put(FieldName.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("article");
    entry.setField(fields);
    bibItems.add(entry);
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) Serializable(java.io.Serializable) HashMap(java.util.HashMap) Abstract(org.jabref.logic.importer.fileformat.medline.Abstract) PublicationType(org.jabref.logic.importer.fileformat.medline.PublicationType) ArrayList(java.util.ArrayList) ArticleTitle(org.jabref.logic.importer.fileformat.medline.ArticleTitle) DateRevised(org.jabref.logic.importer.fileformat.medline.DateRevised) Section(org.jabref.logic.importer.fileformat.medline.Section) Pagination(org.jabref.logic.importer.fileformat.medline.Pagination) Sections(org.jabref.logic.importer.fileformat.medline.Sections) PubmedBookData(org.jabref.logic.importer.fileformat.medline.PubmedBookData) BookDocument(org.jabref.logic.importer.fileformat.medline.BookDocument)

Aggregations

HashMap (java.util.HashMap)2 DateRevised (org.jabref.logic.importer.fileformat.medline.DateRevised)2 BibEntry (org.jabref.model.entry.BibEntry)2 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 Abstract (org.jabref.logic.importer.fileformat.medline.Abstract)1 ArticleIdList (org.jabref.logic.importer.fileformat.medline.ArticleIdList)1 ArticleTitle (org.jabref.logic.importer.fileformat.medline.ArticleTitle)1 BookDocument (org.jabref.logic.importer.fileformat.medline.BookDocument)1 DateCompleted (org.jabref.logic.importer.fileformat.medline.DateCompleted)1 DateCreated (org.jabref.logic.importer.fileformat.medline.DateCreated)1 MedlineCitation (org.jabref.logic.importer.fileformat.medline.MedlineCitation)1 MedlineJournalInfo (org.jabref.logic.importer.fileformat.medline.MedlineJournalInfo)1 Pagination (org.jabref.logic.importer.fileformat.medline.Pagination)1 PublicationType (org.jabref.logic.importer.fileformat.medline.PublicationType)1 PubmedBookData (org.jabref.logic.importer.fileformat.medline.PubmedBookData)1 Section (org.jabref.logic.importer.fileformat.medline.Section)1 Sections (org.jabref.logic.importer.fileformat.medline.Sections)1