use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIReferenceExtractor method on.
@Override
public void on(Map<String, String> interaction) throws StudyImporterException {
Map<String, String> emittingInteraction = interaction;
if (!interaction.containsKey(DatasetImporterForTSV.REFERENCE_DOI) && !interaction.containsKey(DatasetImporterForTSV.REFERENCE_URL) && interaction.containsKey(DatasetImporterForTSV.REFERENCE_CITATION)) {
String referenceCitation = interaction.get(DatasetImporterForTSV.REFERENCE_CITATION);
if (StringUtils.isNoneBlank(referenceCitation)) {
Matcher matcher = Pattern.compile(".*(doi:)([ ]*)(10[.])(.*)/([^ ]+)").matcher(referenceCitation);
if (matcher.matches()) {
String registrant = matcher.group(4);
String suffix = matcher.group(5);
try {
DOI doi = new DOI(registrant, suffix);
emittingInteraction = new TreeMap<String, String>(interaction) {
{
put(DatasetImporterForTSV.REFERENCE_DOI, doi.toString());
}
};
} catch (IllegalArgumentException ex) {
// ignore
}
}
}
}
emit(emittingInteraction);
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplIT method resolveDOIByReferenceURL.
@Test
@Ignore
public void resolveDOIByReferenceURL() throws IOException {
DOI doi = new DOIResolverImpl().resolveDoiFor("http://www.ncbi.nlm.nih.gov/nuccore/7109271");
assertThat(doi, is("10.1002/bimj.4710230217"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplIT method resolveDOIByReferenceTamarins.
@Test
public void resolveDOIByReferenceTamarins() throws IOException {
DOI doi = new DOIResolverImpl().resolveDoiFor("Raboy, Becky E., and James M. Dietz. Diet, Foraging, and Use of Space in Wild Golden-headed Lion Tamarins. American Journal of Primatology, 63(1):, 2004, 1-15. Accessed April 20, 2015. http://hdl.handle.net/10088/4251.");
assertThat(doi.toString(), is("10.1002/ajp.20032"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplIT method resolveDOIByReferenceMatch3.
@Test
public void resolveDOIByReferenceMatch3() throws IOException {
DOI doi = new DOIResolverImpl().resolveDoiFor(HOCKING);
assertThat(doi.toString(), is(HOCKING_DOI.toString()));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplIT method resolveDOIByReferenceMatch8.
@Test
public void resolveDOIByReferenceMatch8() throws IOException {
DOI doi = new DOIResolverImpl().resolveDoiFor("Tutin, C.E.G., Ham, R.M., White, L.J.T., Harrison, M.J.S. 1997. The primate community of the Lopé Reserve, Gabon: diets, responses to fruit scarcity, and effects on biomass. American Journal of Primatology, 42: 1-24.");
assertThat(doi.toString(), is("10.1002/(sici)1098-2345(1997)42:1<1::aid-ajp1>3.0.co;2-0"));
}
Aggregations