Search in sources :

Example 36 with LocationImpl

use of org.eol.globi.domain.LocationImpl in project eol-globi-data by jhpoelen.

the class StudyImporterForINaturalist method parseLocation.

private Location parseLocation(JsonNode observation) throws NodeFactoryException {
    Location location = null;
    String latitudeString = observation.get("latitude").getTextValue();
    String longitudeString = observation.get("longitude").getTextValue();
    if (latitudeString != null && longitudeString != null) {
        double latitude = Double.parseDouble(latitudeString);
        double longitude = Double.parseDouble(longitudeString);
        location = nodeFactory.getOrCreateLocation(new LocationImpl(latitude, longitude, null, null));
    }
    return location;
}
Also used : LocationImpl(org.eol.globi.domain.LocationImpl) Location(org.eol.globi.domain.Location)

Example 37 with LocationImpl

use of org.eol.globi.domain.LocationImpl in project eol-globi-data by jhpoelen.

the class ExporterAssociationsTest method createTestData.

private void createTestData(Double length) throws NodeFactoryException, ParseException {
    Study myStudy = nodeFactory.getOrCreateStudy(new StudyImpl("myStudy", "data\tsource description", null, ExternalIdUtil.toCitation("contributor", "description", "pubYear")));
    Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl("Homo sapiens", "EOL:123"));
    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()));
    eats(specimen, "Canis lupus", "EOL:456", myStudy);
    eats(specimen, "Felis whateverus", PropertyAndValueDictionary.NO_MATCH, myStudy);
    if (null != length) {
        specimen.setLengthInMm(length);
    }
    Location location = nodeFactory.getOrCreateLocation(new LocationImpl(13.0, 45.9, -60.0, null));
    specimen.caughtIn(location);
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) LocationImpl(org.eol.globi.domain.LocationImpl) Date(java.util.Date) TermImpl(org.eol.globi.domain.TermImpl) Location(org.eol.globi.domain.Location)

Example 38 with LocationImpl

use of org.eol.globi.domain.LocationImpl in project eol-globi-data by jhpoelen.

the class ExportFlatInteractionsTest method specimenEatCatAndDog.

private void specimenEatCatAndDog(Double length, Study myStudy, String scientificName, String externalId) throws NodeFactoryException {
    Specimen specimen = collectSpecimen(myStudy, scientificName, externalId);
    eatPrey(specimen, "Canis lupus", "EOL:555", myStudy);
    eatPrey(specimen, "Felis domesticus", "EOL:666", myStudy);
    eatPrey(specimen, "Blah blahuuuu", PropertyAndValueDictionary.NO_MATCH, myStudy);
    if (null != length) {
        specimen.setLengthInMm(length);
    }
    LocationImpl location1 = new LocationImpl(12.0, -45.9, -60.0, null);
    location1.setLocality("some locale");
    location1.setLocalityId("some:localeid");
    Location location = factory.getOrCreateLocation(location1);
    specimen.caughtIn(location);
}
Also used : Specimen(org.eol.globi.domain.Specimen) LocationImpl(org.eol.globi.domain.LocationImpl) Location(org.eol.globi.domain.Location)

Example 39 with LocationImpl

use of org.eol.globi.domain.LocationImpl in project eol-globi-data by jhpoelen.

the class ExporterMeasurementOrFactTest method createTestData.

private void createTestData(Double length, String targetTaxonName, String sourceTaxonName) throws NodeFactoryException, ParseException {
    Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
    Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(sourceTaxonName, "externalId1"));
    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());
    Specimen otherSpecimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(targetTaxonName, "externalId2"));
    otherSpecimen.setVolumeInMilliLiter(124.0);
    specimen.ate(otherSpecimen);
    otherSpecimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(targetTaxonName, "externalId2"));
    otherSpecimen.setVolumeInMilliLiter(18.0);
    specimen.ate(otherSpecimen);
    if (null != length) {
        specimen.setLengthInMm(length);
    }
    Location location = nodeFactory.getOrCreateLocation(new LocationImpl(22.0, 129.9, -60.0, null));
    specimen.caughtIn(location);
    resolveNames();
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) LocationImpl(org.eol.globi.domain.LocationImpl) TermImpl(org.eol.globi.domain.TermImpl) Location(org.eol.globi.domain.Location)

Example 40 with LocationImpl

use of org.eol.globi.domain.LocationImpl in project eol-globi-data by jhpoelen.

the class ExporterOccurrenceAggregatesTest method specimenEatCatAndDog.

private void specimenEatCatAndDog(Double length, Study myStudy, String scientificName, String externalId) throws NodeFactoryException {
    Specimen specimen = collectSpecimen(myStudy, scientificName, externalId);
    eatPrey(specimen, "Canis lupus", "EOL:555", myStudy);
    eatPrey(specimen, "Felis domesticus", "EOL:666", myStudy);
    eatPrey(specimen, "Blah blahuuuu", PropertyAndValueDictionary.NO_MATCH, myStudy);
    if (null != length) {
        specimen.setLengthInMm(length);
    }
    Location location = nodeFactory.getOrCreateLocation(new LocationImpl(12.0, -45.9, -60.0, null));
    specimen.caughtIn(location);
}
Also used : Specimen(org.eol.globi.domain.Specimen) LocationImpl(org.eol.globi.domain.LocationImpl) Location(org.eol.globi.domain.Location)

Aggregations

LocationImpl (org.eol.globi.domain.LocationImpl)40 Location (org.eol.globi.domain.Location)32 Specimen (org.eol.globi.domain.Specimen)22 Study (org.eol.globi.domain.Study)20 TaxonImpl (org.eol.globi.domain.TaxonImpl)15 StudyImpl (org.eol.globi.domain.StudyImpl)13 IOException (java.io.IOException)10 LatLng (org.eol.globi.geo.LatLng)9 LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)8 Date (java.util.Date)8 Relationship (org.neo4j.graphdb.Relationship)7 HashMap (java.util.HashMap)6 Taxon (org.eol.globi.domain.Taxon)6 TermImpl (org.eol.globi.domain.TermImpl)6 Test (org.junit.Test)6 Node (org.neo4j.graphdb.Node)6 ArrayList (java.util.ArrayList)5 SpecimenNode (org.eol.globi.domain.SpecimenNode)3 List (java.util.List)2 Map (java.util.Map)2