Skip to content

Commit

Permalink
start/endDayOfYear are now interpreted.
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBlissett committed Sep 19, 2023
1 parent dbbfd3b commit 1911143
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ private static Set<Term> termsSubjectToInterpretation() {
DwcTerm.year,
DwcTerm.month,
DwcTerm.day,
DwcTerm.startDayOfYear,
DwcTerm.endDayOfYear,
DwcTerm.minimumDepthInMeters,
DwcTerm.maximumDepthInMeters,
DwcTerm.minimumElevationInMeters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public enum EventEsField implements EsField {
DAY(new BaseEsField("event.day", DwcTerm.day)),
EVENT_DATE(new BaseEsField("event.eventDate", DwcTerm.eventDate)),
EVENT_DATE_INTERVAL(new BaseEsField("event.eventDateInterval", EsField.EVENT_DATE_INTERVAL)),
START_DAY_OF_YEAR(new BaseEsField("event.startDayOfYear", DwcTerm.startDayOfYear)),
END_DAY_OF_YEAR(new BaseEsField("event.endDayOfYear", DwcTerm.endDayOfYear)),

//Location
COORDINATE_SHAPE(new BaseEsField("event.scoordinates", null)),
Expand Down Expand Up @@ -191,8 +193,6 @@ public enum EventEsField implements EsField {
EXTENSIONS(new BaseEsField("event.extensions", GbifInternalTerm.dwcaExtension)),

//Event
START_DAY_OF_YEAR(new BaseEsField("event.startDayOfYear", DwcTerm.startDayOfYear)),
END_DAY_OF_YEAR(new BaseEsField("event.endDayOfYear", DwcTerm.startDayOfYear)),
EVENT_TYPE(new BaseEsField("event.eventType", DwcTerm.eventType)),
LOCATION_ID(new BaseEsField("event.locationID", DwcTerm.locationID)),
PARENTS_LINEAGE(new BaseEsField("event.parentsLineage", UnknownTerm.build("event.parentsLineage"))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ private void setTemporalFields(SearchHit hit, Event event) {
event.setEventDate(IsoDateInterval.fromString(m));
} catch (ParseException e) {}
});
getValue(hit, START_DAY_OF_YEAR, Integer::valueOf).ifPresent(event::setStartDayOfYear);
getValue(hit, END_DAY_OF_YEAR, Integer::valueOf).ifPresent(event::setEndDayOfYear);
}

private void setLocationFields(SearchHit hit, Event event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public enum OccurrenceEsField implements EsField {
DAY(new BaseEsField("day", DwcTerm.day)),
EVENT_DATE(new BaseEsField("eventDate", DwcTerm.eventDate)),
EVENT_DATE_INTERVAL(new BaseEsField("eventDateInterval", EsField.EVENT_DATE_INTERVAL)),
START_DAY_OF_YEAR(new BaseEsField("startDayOfYear", DwcTerm.startDayOfYear)),
END_DAY_OF_YEAR(new BaseEsField("endDayOfYear", DwcTerm.endDayOfYear)),

//Location
COORDINATE_SHAPE(new BaseEsField("scoordinates", null)),
Expand Down Expand Up @@ -186,8 +188,6 @@ public enum OccurrenceEsField implements EsField {
EXTENSIONS(new BaseEsField("extensions", GbifInternalTerm.dwcaExtension)),

//Event
START_DAY_OF_YEAR(new BaseEsField("startDayOfYear", DwcTerm.startDayOfYear)),
END_DAY_OF_YEAR(new BaseEsField("endDayOfYear", DwcTerm.endDayOfYear)),
EVENT_TYPE(new BaseEsField("eventType", DwcTerm.eventType)),
LOCATION_ID(new BaseEsField("locationID", DwcTerm.locationID)),
PARENTS_LINEAGE(new BaseEsField("parentsLineage", EsField.PARENTS_LINEAGE)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ private void setTemporalFields(SearchHit hit, Occurrence occ) {
occ.setEventDate(IsoDateInterval.fromString(m));
} catch (ParseException e) {}
});
getValue(hit, occurrenceBaseEsFieldMapper.getEsField(DwcTerm.startDayOfYear), Integer::valueOf).ifPresent(occ::setStartDayOfYear);
getValue(hit, occurrenceBaseEsFieldMapper.getEsField(DwcTerm.endDayOfYear), Integer::valueOf).ifPresent(occ::setEndDayOfYear);
}

private void setLocationFields(SearchHit hit, Occurrence occ) {
Expand Down

0 comments on commit 1911143

Please sign in to comment.