use of org.eol.globi.taxon.GlobalNamesService in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method lookupOTT.
@Test
public void lookupOTT() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService(GlobalNamesSources.OTT);
HashMap<String, String> props = new HashMap<>();
props.put(PropertyAndValueDictionary.NAME, "Arius felis");
Map<String, String> enrich = service.enrich(props);
assertThat(enrich.get(PropertyAndValueDictionary.EXTERNAL_ID), is("OTT:139650"));
assertThat(enrich.get(PropertyAndValueDictionary.NAME), is("Ariopsis felis"));
}
use of org.eol.globi.taxon.GlobalNamesService in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method lookupITISSynonymFails.
@Test
public void lookupITISSynonymFails() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService();
HashMap<String, String> props = new HashMap<String, String>();
props.put(PropertyAndValueDictionary.NAME, "Corizidae");
Map<String, String> enrich = service.enrich(props);
assertThat(enrich.get(PropertyAndValueDictionary.EXTERNAL_ID), is("ITIS:108477"));
}
use of org.eol.globi.taxon.GlobalNamesService in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method lookupNCBIPrune.
@Test
public void lookupNCBIPrune() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService(Arrays.asList(GlobalNamesSources.NCBI));
final List<Taxon> taxa = new ArrayList<>();
service.findTermsForNames(Collections.singletonList("Klebsiella pneumoniae"), new TermMatchListener() {
@Override
public void foundTaxonForName(Long nodeId, String name, Taxon taxon, NameType nameType) {
taxa.add(taxon);
assertThat(nameType, is(NameType.SAME_AS));
}
});
assertThat(taxa.size(), is(1));
assertThat(taxa.get(0).getPath(), endsWith("Klebsiella | Klebsiella pneumoniae"));
}
use of org.eol.globi.taxon.GlobalNamesService in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method lookupITIS.
@Test
public void lookupITIS() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService();
Map<String, String> props = assertHomoSapiens(service);
assertThat(props.get(PropertyAndValueDictionary.EXTERNAL_ID), is("ITIS:180092"));
}
use of org.eol.globi.taxon.GlobalNamesService in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method createTaxaListFromNameListNCBI.
@Test
public void createTaxaListFromNameListNCBI() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService(GlobalNamesSources.NCBI);
final List<Taxon> foundTaxa = new ArrayList<Taxon>();
service.findTermsForNames(Collections.singletonList("1|Prunus persica L."), new TermMatchListener() {
@Override
public void foundTaxonForName(Long nodeId, String name, Taxon taxon, NameType nameType) {
assertNotNull(nodeId);
foundTaxa.add(taxon);
}
});
assertThat(foundTaxa.size(), is(1));
assertThat(foundTaxa.get(0).getExternalId(), is(TaxonomyProvider.NCBI.getIdPrefix() + "3760"));
}
Aggregations