@Test public void getDOI_inInput_shouldWork() { String input = "{\"reference-count\":176,\"publisher\":\"IOP Publishing\",\"issue\":\"4\",\"content-domain\":{\"domain\":[],\"crossmark-restriction\":false},\"short-container-title\":[\"Russ. Chem. Rev.\"],\"published-print\":{\"date-parts\":[[1998,4,30]]},\"DOI\":\"10.1070/rc1998v067n04abeh000372\",\"type\":\"journal-article\",\"created\":{\"date-parts\":[[2002,8,24]],\"date-time\":\"2002-08-24T21:29:52Z\",\"timestamp\":{\"$numberLong\":\"1030224592000\"}},\"page\":\"279-293\",\"source\":\"Crossref\",\"is-referenced-by-count\":24,\"title\":[\"Haloalkenes activated by geminal groups in reactions with N-nucleophiles\"],\"prefix\":\"10.1070\",\"volume\":\"67\",\"author\":[{\"given\":\"Alexander Yu\",\"family\":\"Rulev\",\"sequence\":\"first\",\"affiliation\":[]}],\"member\":\"266\",\"published-online\":{\"date-parts\":[[2007,10,17]]},\"container-title\":[\"Russian Chemical Reviews\"],\"deposited\":{\"date-parts\":[[2017,11,23]],\"date-time\":\"2017-11-23T03:38:45Z\",\"timestamp\":{\"$numberLong\":\"1511408325000\"}},\"score\":1,\"issued\":{\"date-parts\":[[1998,4,30]]},\"references-count\":176,\"journal-issue\":{\"published-print\":{\"date-parts\":[[1998,4,30]]},\"issue\":\"4\"},\"URL\":\"http: String doi = "10.1070/rc1998v067n04abeh000372"; String output = target.fetchDOI(input); assertThat(output, is(doi)); }
public String fetchDOI(String input) { Matcher doiMatcher = DOIPattern.matcher(input); while (doiMatcher.find()) { if (doiMatcher.groupCount() == 1) { return doiMatcher.group(1); } } return null; }
LookupEngine { public String fetchDOI(String input) { Matcher doiMatcher = DOIPattern.matcher(input); while (doiMatcher.find()) { if (doiMatcher.groupCount() == 1) { return doiMatcher.group(1); } } return null; } }
LookupEngine { public String fetchDOI(String input) { Matcher doiMatcher = DOIPattern.matcher(input); while (doiMatcher.find()) { if (doiMatcher.groupCount() == 1) { return doiMatcher.group(1); } } return null; } LookupEngine();  LookupEngine(StorageEnvFactory storageFactory); }
LookupEngine { public String fetchDOI(String input) { Matcher doiMatcher = DOIPattern.matcher(input); while (doiMatcher.find()) { if (doiMatcher.groupCount() == 1) { return doiMatcher.group(1); } } return null; } LookupEngine();  LookupEngine(StorageEnvFactory storageFactory); String retrieveByArticleMetadata(String title, String firstAuthor, Boolean postValidate); void retrieveByArticleMetadataAsync(String title, String firstAuthor, Boolean postValidate, Consumer<MatchingDocument> callback); String retrieveByJournalMetadata(String title, String volume, String firstPage); void retrieveByJournalMetadataAsync(String jtitle, String volume, String firstPage, String atitle, String firstAuthor, Boolean postValidate, Consumer<MatchingDocument> callback); void retrieveByJournalMetadataAsync(String jtitle, String volume, String firstPage, Consumer<MatchingDocument> callback); String retrieveByJournalMetadata(String title, String volume, String firstPage, String firstAuthor); void retrieveByJournalMetadataAsync(String title, String volume, String firstPage, String firstAuthor,
                                               Consumer<MatchingDocument> callback); String retrieveByDoi(String doi, Boolean postValidate, String firstAuthor, String atitle); String retrieveByPmid(String pmid, Boolean postValidate, String firstAuthor, String atitle); String retrieveByPmc(String pmc, Boolean postValidate, String firstAuthor, String atitle); String retrieveByIstexid(String istexid, Boolean postValidate, String firstAuthor, String atitle); String retrieveByPii(String pii, Boolean postValidate, String firstAuthor, String atitle); PmidData retrievePMidsByDoi(String doi); PmidData retrievePMidsByPmid(String pmid); PmidData retrievePMidsByPmc(String pmc); IstexData retrieveIstexIdsByDoi(String doi); IstexData retrieveIstexIdsByIstexId(String istexId); String retrieveOAUrlByDoi(String doi); Pair<String,String> retrieveOaIstexUrlByDoi(String doi); String retrieveOAUrlByPmid(String pmid); Pair<String,String> retrieveOaIstexUrlByPmid(String pmid); String retrieveOAUrlByPmc(String pmc); Pair<String,String> retrieveOaIstexUrlByPmc(String pmc); String retrieveOAUrlByPii(String pii); Pair<String,String> retrieveOaIstexUrlByPii(String pii); String retrieveByBiblio(String biblio); void retrieveByBiblioAsync(String biblio, Boolean postValidate, String firstAuthor, String title, Boolean parseReference, Consumer<MatchingDocument> callback); void retrieveByBiblioAsync(String biblio, Consumer<MatchingDocument> callback); String fetchDOI(String input); void setMetadataMatching(MetadataMatching metadataMatching); void setOaDoiLookup(OALookup oaDoiLookup); void setIstexLookup(IstexIdsLookup istexLookup); void setMetadataLookup(MetadataLookup metadataLookup); void setPmidLookup(PMIdsLookup pmidLookup); void setGrobidClient(GrobidClient grobidClient); }
LookupEngine { public String fetchDOI(String input) { Matcher doiMatcher = DOIPattern.matcher(input); while (doiMatcher.find()) { if (doiMatcher.groupCount() == 1) { return doiMatcher.group(1); } } return null; } LookupEngine();  LookupEngine(StorageEnvFactory storageFactory); String retrieveByArticleMetadata(String title, String firstAuthor, Boolean postValidate); void retrieveByArticleMetadataAsync(String title, String firstAuthor, Boolean postValidate, Consumer<MatchingDocument> callback); String retrieveByJournalMetadata(String title, String volume, String firstPage); void retrieveByJournalMetadataAsync(String jtitle, String volume, String firstPage, String atitle, String firstAuthor, Boolean postValidate, Consumer<MatchingDocument> callback); void retrieveByJournalMetadataAsync(String jtitle, String volume, String firstPage, Consumer<MatchingDocument> callback); String retrieveByJournalMetadata(String title, String volume, String firstPage, String firstAuthor); void retrieveByJournalMetadataAsync(String title, String volume, String firstPage, String firstAuthor,
                                               Consumer<MatchingDocument> callback); String retrieveByDoi(String doi, Boolean postValidate, String firstAuthor, String atitle); String retrieveByPmid(String pmid, Boolean postValidate, String firstAuthor, String atitle); String retrieveByPmc(String pmc, Boolean postValidate, String firstAuthor, String atitle); String retrieveByIstexid(String istexid, Boolean postValidate, String firstAuthor, String atitle); String retrieveByPii(String pii, Boolean postValidate, String firstAuthor, String atitle); PmidData retrievePMidsByDoi(String doi); PmidData retrievePMidsByPmid(String pmid); PmidData retrievePMidsByPmc(String pmc); IstexData retrieveIstexIdsByDoi(String doi); IstexData retrieveIstexIdsByIstexId(String istexId); String retrieveOAUrlByDoi(String doi); Pair<String,String> retrieveOaIstexUrlByDoi(String doi); String retrieveOAUrlByPmid(String pmid); Pair<String,String> retrieveOaIstexUrlByPmid(String pmid); String retrieveOAUrlByPmc(String pmc); Pair<String,String> retrieveOaIstexUrlByPmc(String pmc); String retrieveOAUrlByPii(String pii); Pair<String,String> retrieveOaIstexUrlByPii(String pii); String retrieveByBiblio(String biblio); void retrieveByBiblioAsync(String biblio, Boolean postValidate, String firstAuthor, String title, Boolean parseReference, Consumer<MatchingDocument> callback); void retrieveByBiblioAsync(String biblio, Consumer<MatchingDocument> callback); String fetchDOI(String input); void setMetadataMatching(MetadataMatching metadataMatching); void setOaDoiLookup(OALookup oaDoiLookup); void setIstexLookup(IstexIdsLookup istexLookup); void setMetadataLookup(MetadataLookup metadataLookup); void setPmidLookup(PMIdsLookup pmidLookup); void setGrobidClient(GrobidClient grobidClient); static Pattern DOIPattern; }