use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.
the class GeoNamesServiceImpl method getCentroidForLocale.
private LatLng getCentroidForLocale(String locale) throws IOException {
LatLng point = null;
TermImpl term = LOCALE_TO_GEONAMES.get(locale);
// see https://github.com/jhpoelen/eol-globi-data/issues/39
if (term != null && !term.equals(GEO_TERM_EARTH)) {
String geoNamesTerm = term.getId();
if (LOCALE_TO_GEONAMES.containsKey(locale)) {
point = getCentroidForGeoNameTerm(geoNamesTerm);
}
if (point != null) {
pointCache.put(geoNamesTerm, point);
}
}
return point;
}
use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.
the class StudyImporterNodesAndLinks method parseLocality.
private static TermImpl parseLocality(JsonNode desc) {
TermImpl locality = null;
JsonNode location = desc.get("location");
if (location != null) {
JsonNode locale = location.get("locality");
if (locale != null) {
JsonNode id = locale.get("id");
JsonNode name = locale.get("name");
if (id != null && name != null) {
locality = new TermImpl(id.asText(), name.asText());
}
}
}
return locality;
}
use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.
the class ExporterOccurrenceAggregatesTest method collectSpecimen.
private Specimen collectSpecimen(Study myStudy, String scientificName, String externalId) throws NodeFactoryException {
Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(scientificName, externalId));
specimen.setStomachVolumeInMilliLiter(666.0);
specimen.setLifeStage(new TermImpl("GLOBI:JUVENILE", "JUVENILE"));
specimen.setPhysiologicalState(new TermImpl("GLOBI:DIGESTATE", "DIGESTATE"));
specimen.setBodyPart(new TermImpl("GLOBI:BONE", "BONE"));
nodeFactory.setUnixEpochProperty(specimen, new Date(ExportTestUtil.utcTestTime()));
return specimen;
}
use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.
the class ExporterOccurrencesTest method dontExportToCSVSpecimenEmptyStomach.
@Test
public void dontExportToCSVSpecimenEmptyStomach() throws NodeFactoryException, IOException {
Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl("Homo sapiens", "EOL:123"));
specimen.setBasisOfRecord(new TermImpl("test:123", "aBasisOfRecord"));
resolveNames();
StringWriter row = new StringWriter();
exportOccurrences().exportStudy(myStudy, row, true);
String expected = "";
expected += getExpectedHeader();
expected += "\nglobi:occur:2\tEOL:123\t\t\t\t\t\t\t\t\t\t\t\t\taBasisOfRecord\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
assertThat(row.getBuffer().toString(), equalTo(expected));
}
use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.
the class ExporterOccurrencesTest method createTestData.
private void createTestData(Double length) throws NodeFactoryException, ParseException {
Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl("Homo sapiens", "EOL:327955"));
specimen.setStomachVolumeInMilliLiter(666.0);
specimen.setLifeStage(new TermImpl("GLOBI:JUVENILE", "JUVENILE"));
specimen.setPhysiologicalState(new TermImpl("GLOBI:DIGESTATE", "DIGESTATE"));
specimen.setBodyPart(new TermImpl("GLOBI:BONE", "BONE"));
nodeFactory.setUnixEpochProperty(specimen, ExportTestUtil.utcTestDate());
if (null != length) {
specimen.setLengthInMm(length);
}
Location location = nodeFactory.getOrCreateLocation(new LocationImpl(12.0, -1.0, -60.0, null));
specimen.caughtIn(location);
Specimen wolf1 = eatWolf(specimen, myStudy);
wolf1.caughtIn(location);
Specimen wolf2 = eatWolf(specimen, myStudy);
wolf2.caughtIn(location);
}
Aggregations