BiblioItem { public static void correct(BiblioItem bib, BiblioItem bibo) { if (bibo.getDOI() != null) bib.setDOI(bibo.getDOI()); if (bibo.getPMID() != null) bib.setPMID(bibo.getPMID()); if (bibo.getPMCID() != null) bib.setPMCID(bibo.getPMCID()); if (bibo.getPII() != null) bib.setPII(bibo.getPII()); if (bibo.getIstexId() != null) bib.setIstexId(bibo.getIstexId()); if (bibo.getArk() != null) bib.setArk(bibo.getArk()); if (bibo.getOAURL() != null) bib.setOAURL(bibo.getOAURL()); if (bibo.getJournal() != null) { bib.setJournal(bibo.getJournal()); if (bibo.getBookTitle() == null) { bib.setBookTitle(null); } } if (bibo.getAuthors() != null) bib.setAuthors(bibo.getAuthors()); if (bibo.getEditors() != null) bib.setEditors(bibo.getEditors()); if (bibo.getBookTitle() != null) { bib.setBookTitle(bibo.getBookTitle()); if (bibo.getJournal() == null) { bib.setJournal(null); } } if (bibo.getVolume() != null) bib.setVolume(bibo.getVolume()); if (bibo.getVolumeBlock() != null) bib.setVolumeBlock(bibo.getVolumeBlock(), false); if (bibo.getIssue() != null) bib.setIssue(bibo.getIssue()); if (bibo.getBeginPage() != -1) bib.setBeginPage(bibo.getBeginPage()); if (bibo.getEndPage() != -1) bib.setEndPage(bibo.getEndPage()); if (bibo.getPageRange() != null) bib.setPageRange(bibo.getPageRange()); if (bibo.getPublicationDate() != null) bib.setPublicationDate(bibo.getPublicationDate()); if (bibo.getSubmissionDate() != null) bib.setSubmissionDate(bibo.getSubmissionDate()); if (bibo.getDownloadDate() != null) bib.setDownloadDate(bibo.getDownloadDate()); if (bibo.getYear() != null) bib.setYear(bibo.getYear()); if (bibo.getNormalizedPublicationDate() != null) bib.setNormalizedPublicationDate(bibo.getNormalizedPublicationDate()); if (bibo.getMonth() != null) bib.setMonth(bibo.getMonth()); if (bibo.getDay() != null) bib.setDay(bibo.getDay()); if (bibo.getE_Year() != null) bib.setE_Year(bibo.getE_Year()); if (bibo.getE_Month() != null) bib.setE_Month(bibo.getE_Month()); if (bibo.getE_Day() != null) bib.setE_Day(bibo.getE_Day()); if (bibo.getA_Year() != null) bib.setA_Year(bibo.getA_Year()); if (bibo.getA_Month() != null) bib.setA_Month(bibo.getA_Month()); if (bibo.getA_Day() != null) bib.setA_Day(bibo.getA_Day()); if (bibo.getS_Year() != null) bib.setS_Year(bibo.getS_Year()); if (bibo.getS_Month() != null) bib.setS_Month(bibo.getS_Month()); if (bibo.getS_Day() != null) bib.setS_Day(bibo.getS_Day()); if (bibo.getD_Year() != null) bib.setD_Year(bibo.getD_Year()); if (bibo.getD_Month() != null) bib.setD_Month(bibo.getD_Month()); if (bibo.getD_Day() != null) bib.setD_Day(bibo.getD_Day()); if (bibo.getLocation() != null) bib.setLocation(bibo.getLocation()); if (bibo.getPublisher() != null) bib.setPublisher(bibo.getPublisher()); if (bibo.getTitle() != null) { bib.setTitle(bibo.getTitle()); } if (bibo.getArticleTitle() != null) { bib.setArticleTitle(bibo.getArticleTitle()); } if (bibo.getJournalAbbrev() != null) { bib.setJournalAbbrev(bibo.getJournalAbbrev()); } if (bibo.getISSN() != null) bib.setISSN(bibo.getISSN()); if (bibo.getISSNe() != null) bib.setISSNe(bibo.getISSNe()); if (bibo.getISBN10() != null) bib.setISBN10(bibo.getISBN10()); if (bibo.getISBN13() != null) bib.setISBN13(bibo.getISBN13()); if (bibo.getItem() != -1) { bib.setItem(bibo.getItem()); } if (bibo.getCollaboration() != null) { bib.setCollaboration(bibo.getCollaboration()); } if (!CollectionUtils.isEmpty(bibo.getFullAuthors())) { if (CollectionUtils.isEmpty(bib.getFullAuthors())) bib.setFullAuthors(bibo.getFullAuthors()); else if (bibo.getFullAuthors().size() == 1) { Person auto = (Person) bibo.getFullAuthors().get(0); List<Person> auts = bib.getFullAuthors(); if (auts != null) { for (Person aut : auts) { if (StringUtils.isNotBlank(aut.getLastName()) && StringUtils.isNotBlank(auto.getLastName())) { if (aut.getLastName().toLowerCase().equals(auto.getLastName().toLowerCase())) { if (StringUtils.isBlank(aut.getFirstName()) || (auto.getFirstName() != null && aut.getFirstName().length() <= auto.getFirstName().length() && auto.getFirstName().toLowerCase().startsWith(aut.getFirstName().toLowerCase()))) { aut.setFirstName(auto.getFirstName()); aut.setCorresp(true); if (StringUtils.isNotBlank(auto.getEmail())) aut.setEmail(auto.getEmail()); if (StringUtils.isNotBlank(auto.getMiddleName()) && (StringUtils.isBlank(aut.getMiddleName()))) aut.setMiddleName(auto.getMiddleName()); } } } } } } else if (bibo.getFullAuthors().size() > 1) { for (Person aut : bibo.getFullAuthors()) { for (Person aut2 : bib.getFullAuthors()) { if (StringUtils.isNotBlank(aut2.getLastName())) { String aut2_lastname = aut2.getLastName().toLowerCase(); if (StringUtils.isNotBlank(aut.getLastName())) { String aut_lastname = aut.getLastName().toLowerCase(); if (aut_lastname.equals(aut2_lastname)) { if ( StringUtils.isBlank(aut2.getFirstName()) || (StringUtils.isNotBlank(aut2.getFirstName()) && StringUtils.isNotBlank(aut.getFirstName())) ) { if ( StringUtils.isBlank(aut2.getFirstName()) || aut.getFirstName().equals(aut2.getFirstName()) || ( aut.getFirstName().length() == 1 && aut.getFirstName().equals(aut2.getFirstName().substring(0,1)) ) ) { if (StringUtils.isNotBlank(aut2.getFirstName()) && aut2.getFirstName().length() > aut.getFirstName().length()) aut.setFirstName(aut2.getFirstName()); if (StringUtils.isBlank(aut.getMiddleName())) aut.setMiddleName(aut2.getMiddleName()); if (StringUtils.isBlank(aut.getTitle())) aut.setTitle(aut2.getTitle()); if (StringUtils.isBlank(aut.getSuffix())) aut.setSuffix(aut2.getSuffix()); if (StringUtils.isBlank(aut.getORCID())) aut.setORCID(aut2.getORCID()); if (StringUtils.isBlank(aut.getEmail())) aut.setEmail(aut2.getEmail()); if(!CollectionUtils.isEmpty(aut2.getAffiliations())) aut.setAffiliations(aut2.getAffiliations()); if (!CollectionUtils.isEmpty(aut2.getAffiliationBlocks())) aut.setAffiliationBlocks(aut2.getAffiliationBlocks()); if (!CollectionUtils.isEmpty(aut2.getAffiliationMarkers())) aut.setAffiliationMarkers(aut2.getAffiliationMarkers()); if (!CollectionUtils.isEmpty(aut2.getMarkers())) aut.setMarkers(aut2.getMarkers()); if (!CollectionUtils.isEmpty(aut2.getLayoutTokens())) aut.setLayoutTokens(aut2.getLayoutTokens()); break; } } } } } } } bib.setFullAuthors(bibo.getFullAuthors()); } } } BiblioItem(); @Override String toString(); void setParentItem(BiblioItem bi); BiblioItem getParentItem(); int getItem(); void setItem(int type); String getISBN13(); String getISBN10(); String getTitle(); String getPublisher(); String getEdition(); String getLanguage(); String getSubtitle(); String getPublicationDate(); Date getNormalizedPublicationDate(); String getEditors(); String getPublisherWebsite(); String getSerie(); String getISSN(); String getISSNe(); String getVolume(); String getNumber(); String getMonth(); String getSupportType(); String getVersion(); String getSmallImageURL(); String getLargeImageURL(); String getPublisherPlace(); String getReview(); List<String> getCategories(); int getNbPages(); String getType(); String getTypeDescription(); String getBookType(); String getDOI(); String getArk(); String getIstexId(); String getInDOI(); String getArXivId(); String getPMID(); String getPMCID(); String getPII(); String getArticleTitle(); int getBeginPage(); int getEndPage(); String getYear(); String getAbstract(); String getLabeledAbstract(); String getEmail(); String getPubnum(); String getCollaboration(); String getSerieTitle(); String getURL(); String getOAURL(); String getURI(); String getConfidence(); String getAuthors(); String getLocation(); String getBookTitle(); String getPageRange(); String getJournal(); String getVolumeBlock(); String getInstitution(); String getNote(); String getAffiliation(); String getAddress(); String getCountry(); String getTown(); String getKeyword(); List<Keyword> getKeywords(); List<String> getSubjects(); String getPhone(); String getDegree(); String getWeb(); String getIssue(); String getJournalAbbrev(); String getEvent(); boolean getError(); String getAbstractHeader(); String getDay(); String getLocationPublisher(); String getAuthorString(); String getE_Year(); String getE_Month(); String getE_Day(); String getS_Year(); String getS_Month(); String getS_Day(); String getA_Year(); String getA_Month(); String getA_Day(); String getD_Year(); String getD_Month(); String getD_Day(); String getDedication(); String getSubmission(); String getEnglishTitle(); String getSubmissionDate(); Date getNormalizedSubmissionDate(); String getDownloadDate(); Date getNormalizedDownloadDate(); String getServerDate(); Date getNormalizedServerDate(); String getOriginalAffiliation(); String getOriginalAbstract(); String getOriginalAuthors(); String getOriginalEditors(); String getOriginalTitle(); String getOriginalAddress(); String getOriginalNote(); String getOriginalKeyword(); String getOriginalVolumeBlock(); String getOriginalJournal(); List<org.grobid.core.data.Person> getFullAuthors(); List<org.grobid.core.data.Person> getFullEditors(); List<org.grobid.core.data.Affiliation> getFullAffiliations(); String getReference(); String getCopyright(); String getFunding(); String getWorkingGroup(); String getDocumentType(); void setISBN13(String isbn); void setISBN10(String isbn); void setTitle(String theTitle); void setPublisher(String thePublisher); void setEdition(String theEdition); void setLanguage(String theLanguage); void setSubtitle(String theSubtitle); void setPublicationDate(String theDate); void setNormalizedPublicationDate(Date theDate); void setEditors(String theEditors); void setPublisherWebsite(String theWebsite); void setSerie(String theSerie); void setISSN(String theISSN); void setISSNe(String theISSN); void setVolume(String theVolume); void setNumber(String theNumber); void setMonth(String theMonth); void setSupportType(String theType); void setVersion(String theVersion); void setSmallImageURL(String url); void setLargeImageURL(String url); void setPublisherPlace(String p); void setCategories(List<String> cat); void addCategory(String cat); void setNbPages(int nb); void setReview(String rev); void setType(String t); void setTypeDescription(String t); void setBookType(String bt); void setDOI(String id); void setInDOI(String id); void setArXivId(String id); void setPMID(String id); void setPMCID(String id); void setPII(String id); void setIstexId(String id); void setArk(String id); void setArticleTitle(String ti); void setBeginPage(int p); void setEndPage(int p); void setYear(String y); void setAbstract(String a); void setLabeledAbstract(String labeledAbstract); void setLocationPublisher(String s); void setSerieTitle(String s); void setAuthorString(String s); void setURL(String s); void setOAURL(String s); void setURI(String s); void setConfidence(String s); void setConf(double b); void setFullAuthors(List<org.grobid.core.data.Person> full); void setFullEditors(List<org.grobid.core.data.Person> full); void setFullAffiliations(List<org.grobid.core.data.Affiliation> full); void setWorkingGroup(String wg); void setDocumentType(String doctype); void setAuthors(String aut); BiblioItem addAuthorsToken(LayoutToken lt); List<LayoutToken> getAuthorsTokens(); void addAuthor(String aut); void addFullAuthor(Person aut); void addFullEditor(Person aut); void addEditor(String aut); void setLocation(String loc); void setBookTitle(String book); void setPageRange(String pages); void setJournal(String jour); void setVolumeBlock(String vol, boolean postProcess); void setInstitution(String inst); void setNote(String not); void setAffiliation(String a); void setAddress(String a); void setCountry(String a); void setTown(String a); void setEmail(String e); void setPubnum(String p); void setKeyword(String k); void addKeyword(String k); void setKeywords(List<Keyword> k); void addSubject(String k); void setSubjects(List<String> k); void setPhone(String p); void setDegree(String d); void setWeb(String w); void setCollaboration(String collab); void setIssue(String i); void setJournalAbbrev(String j); void setEvent(String e); void setError(boolean e); void setAbstractHeader(String a); void setPath(String p); void setDay(String d); void setE_Year(String d); void setE_Month(String d); void setE_Day(String d); void setA_Year(String d); void setA_Month(String d); void setA_Day(String d); void setS_Year(String d); void setS_Month(String d); void setS_Day(String d); void setD_Year(String d); void setD_Month(String d); void setD_Day(String d); void setDedication(String d); void setSubmission(String s); void setEnglishTitle(String d); void setSubmissionDate(String d); void setNormalizedSubmissionDate(Date d); void setDownloadDate(String d); void setNormalizedDownloadDate(Date d); void setServerDate(String d); void setNormalizedServerDate(Date d); void setOriginalAffiliation(String original); void setOriginalAbstract(String original); void setOriginalAuthors(String original); void setOriginalEditors(String original); void setOriginalTitle(String original); void setOriginalAddress(String original); void setOriginalNote(String original); void setOriginalKeyword(String original); void setOriginalVolumeBlock(String original); void setOriginalJournal(String original); void setReference(String ref); void setCopyright(String cop); void setFunding(String gra); String getMeeting(); void setMeeting(String meet); static String cleanSQLString(String str); static String cleanISBNString(String str); void reset(); String postProcessVolumeBlock(); String cleanAbstract(String string); static List<LayoutToken> cleanAbstractLayoutTokens(List<LayoutToken> tokens); static void cleanTitles(BiblioItem bibl); static String cleanKeywords(String string); static List<Keyword> segmentKeywords(String string); String toBibTeX(); String toBibTeX(String id); String toBibTeX(String id, GrobidAnalysisConfig config); void checkIdentifier(); String toTEI(int n); String toTEI(int n, GrobidAnalysisConfig config); String toTEI(int n, int indent); String toTEI(int n, int indent, GrobidAnalysisConfig config); void buildBiblioSet(BiblioSet bs, String path0); String toTEI2(BiblioSet bs); String toOpenURL(String authors); String toCOinS(); String toFullOpenURL(String linkResolver, String imageLinkResolver); void setFirstAuthorSurname(String firstAuthorSurname); String getFirstAuthorSurname(); void attachEmails(); void attachEmails(List<Person> folks); void attachAuthorEmails(); void attachEditorEmails(); void attachAffiliations(); String toTEIAuthorBlock(int nbTag); String toTEIAuthorBlock(int nbTag, GrobidAnalysisConfig config); void postProcessPages(); static void injectDOI(BiblioItem bib, BiblioItem bibo); static void correct(BiblioItem bib, BiblioItem bibo); boolean rejectAsReference(); String getTeiId(); int getOrdinal(); void setOrdinal(int ordinal); void setCoordinates(List<BoundingBox> coordinates); List<BoundingBox> getCoordinates(); Map<String, List<LayoutToken>> getLabeledTokens(); void setLabeledTokens(Map<String, List<LayoutToken>> labeledTokens); List<LayoutToken> getLayoutTokens(TaggingLabel headerLabel); void setLayoutTokensForLabel(List<LayoutToken> tokens, TaggingLabel headerLabel); void generalResultMapping(Document doc, String labeledResult, List<LayoutToken> tokenizations); void addTitleTokens(List<LayoutToken> layoutTokens); void addAuthorsTokens(List<LayoutToken> layoutTokens); void addAbstractTokens(List<LayoutToken> layoutTokens); List<LayoutToken> getAbstractTokens(); public int item; static final int Book; static final int Periodical; static final int Digital_support; static final int Article; static final int Unknown; static final int InBook; static final int InProceedings; static final int InCollection; static final int Manual; static final int TechReport; static final int MasterThesis; static final int PhdThesis; static final int Unpublished; static final int Proceedings; static final int Serie; public String affiliationAddressBlock; static final List<String> confPrefixes; static final String[] ABSTRACT_PREFIXES; }
@Test public void correct_empty_shouldNotFail() { BiblioItem.correct(new BiblioItem(), new BiblioItem()); }