Search in sources :

Example 1 with GeoNamesServiceImpl

use of org.eol.globi.service.GeoNamesServiceImpl in project eol-globi-data by jhpoelen.

the class StudyImporterForRaymondIT method importStudy.

@Test
public void importStudy() throws StudyImporterException {
    StudyImporterForRaymond importer = new StudyImporterForRaymond(new ParserFactoryLocal(), nodeFactory);
    importer.setGeoNamesService(new GeoNamesService() {

        @Override
        public boolean hasTermForLocale(String locality) {
            return true;
        }

        @Override
        public LatLng findLatLng(String locality) throws IOException {
            return new LatLng(0, 0);
        }
    });
    importer.setDataset(new DatasetLocal());
    importStudy(importer);
    importer.setGeoNamesService(new GeoNamesServiceImpl());
    Collection<String> unmappedLocations = new HashSet<String>();
    for (String location : importer.getLocations()) {
        if (!importer.getGeoNamesService().hasTermForLocale(location)) {
            unmappedLocations.add(location);
        }
    }
    assertThat(unmappedLocations, containsInAnyOrder("Not described", "South African waters", "Ocean location", "subantarctic waters", "oceanic habitat in Southern Ocean. 68� 07\u0019 S & 70�13\u0019 S", "Subantarctic Pacific Ocean"));
}
Also used : GeoNamesServiceImpl(org.eol.globi.service.GeoNamesServiceImpl) GeoNamesService(org.eol.globi.service.GeoNamesService) IOException(java.io.IOException) LatLng(org.eol.globi.geo.LatLng) DatasetLocal(org.eol.globi.service.DatasetLocal) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with GeoNamesServiceImpl

use of org.eol.globi.service.GeoNamesServiceImpl in project eol-globi-data by jhpoelen.

the class StudyImporterForSPIRETest method importStudy.

@Test
public void importStudy() throws IOException, StudyImporterException {
    RDFDefaultErrorHandler.silent = true;
    StudyImporterForSPIRE importer = createImporter();
    TestInteractionListener listener = new TestInteractionListener();
    importer.setInteractionListener(listener);
    importStudy(importer);
    assertGAZMapping(listener);
    GeoNamesServiceImpl geoNamesServiceImpl = new GeoNamesServiceImpl();
    for (String locality : listener.localities) {
        assertThat(geoNamesServiceImpl.hasTermForLocale(locality), is(true));
    }
    assertThat(listener.getCount(), is(30196));
    assertThat(listener.descriptions, not(hasItem("http://spire.umbc.edu/ontologies/SpireEcoConcepts.owl#")));
    assertThat(listener.titles, not(hasItem("http://spire.umbc.edu/")));
    assertThat(listener.environments, not(hasItem("http://spire.umbc.edu/ontologies/SpireEcoConcepts.owl#")));
    assertThat(listener.invalidInteractions.size(), is(greaterThan(0)));
}
Also used : GeoNamesServiceImpl(org.eol.globi.service.GeoNamesServiceImpl) Test(org.junit.Test)

Aggregations

GeoNamesServiceImpl (org.eol.globi.service.GeoNamesServiceImpl)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 LatLng (org.eol.globi.geo.LatLng)1 DatasetLocal (org.eol.globi.service.DatasetLocal)1 GeoNamesService (org.eol.globi.service.GeoNamesService)1