001/*
002 * Licensed under the Apache License, Version 2.0 (the "License");
003 * you may not use this file except in compliance with the License.
004 * You may obtain a copy of the License at
005 *
006 *     http://www.apache.org/licenses/LICENSE-2.0
007 *
008 * Unless required by applicable law or agreed to in writing, software
009 * distributed under the License is distributed on an "AS IS" BASIS,
010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011 * See the License for the specific language governing permissions and
012 * limitations under the License.
013 */
014package org.gbif.api.model.occurrence;
015
016import lombok.Getter;
017
018import lombok.Setter;
019
020import org.gbif.api.annotation.Experimental;
021import org.gbif.api.model.common.Classification;
022import org.gbif.api.model.common.Identifier;
023import org.gbif.api.model.common.LinneanClassification;
024import org.gbif.api.model.common.LinneanClassificationKeys;
025import org.gbif.api.model.common.MediaObject;
026import org.gbif.api.util.ClassificationUtils;
027import org.gbif.api.util.IsoDateInterval;
028import org.gbif.api.vocabulary.BasisOfRecord;
029import org.gbif.api.vocabulary.Continent;
030import org.gbif.api.vocabulary.Country;
031import org.gbif.api.vocabulary.GbifRegion;
032import org.gbif.api.vocabulary.License;
033import org.gbif.api.vocabulary.OccurrenceIssue;
034import org.gbif.api.vocabulary.OccurrenceStatus;
035import org.gbif.api.vocabulary.Rank;
036import org.gbif.api.vocabulary.Sex;
037import org.gbif.api.vocabulary.TaxonomicStatus;
038import org.gbif.dwc.terms.DwcTerm;
039import org.gbif.dwc.terms.GbifTerm;
040import org.gbif.dwc.terms.Term;
041import org.gbif.dwc.terms.UnknownTerm;
042
043import java.lang.reflect.Field;
044import java.lang.reflect.Modifier;
045import java.net.URI;
046import java.util.ArrayList;
047import java.util.Arrays;
048import java.util.Collections;
049import java.util.Date;
050import java.util.EnumSet;
051import java.util.HashMap;
052import java.util.List;
053import java.util.Map;
054import java.util.Objects;
055import java.util.Optional;
056import java.util.Set;
057import java.util.UUID;
058import java.util.stream.Collectors;
059import java.util.stream.Stream;
060
061import jakarta.annotation.Nullable;
062import jakarta.validation.constraints.Max;
063import jakarta.validation.constraints.Min;
064import jakarta.validation.constraints.NotNull;
065
066import com.fasterxml.jackson.annotation.JsonAnyGetter;
067import com.fasterxml.jackson.annotation.JsonIgnore;
068import com.fasterxml.jackson.annotation.JsonProperty;
069import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
070import com.fasterxml.jackson.databind.annotation.JsonSerialize;
071
072import io.swagger.v3.oas.annotations.ExternalDocumentation;
073import io.swagger.v3.oas.annotations.media.Schema;
074import lombok.EqualsAndHashCode;
075import lombok.ToString;
076
077/**
078 * Represents an Occurrence as interpreted by GBIF, adding typed properties on top of the verbatim ones.
079 */
080@EqualsAndHashCode
081@ToString
082@SuppressWarnings("unused")
083public class Occurrence extends VerbatimOccurrence implements LinneanClassification, LinneanClassificationKeys {
084
085  public static final String GEO_DATUM = "WGS84";
086  // keep names of ALL properties of this class in a set for jackson serialization, see #properties()
087  private static final Set<String> PROPERTIES = Collections.unmodifiableSet(
088    Stream.concat(
089      // we need to these JSON properties manually because we have a fixed getter but no field for it
090      Stream.of(DwcTerm.geodeticDatum.simpleName(), "class", DwcTerm.countryCode.simpleName(), GbifTerm.gbifRegion.simpleName(), GbifTerm.publishedByGbifRegion.simpleName()),
091      Stream.concat(Arrays.stream(Occurrence.class.getDeclaredFields()),
092        Arrays.stream(VerbatimOccurrence.class.getDeclaredFields()))
093        .filter(field -> !Modifier.isStatic(field.getModifiers()))
094        .map(Field::getName)).collect(Collectors.toSet()));
095
096  // occurrence fields
097
098  // OpenAPI documentation comes from the enumeration.
099  private BasisOfRecord basisOfRecord;
100
101  @Schema(
102    description = "The number of individuals present at the time of the Occurrence.",
103    externalDocs = @ExternalDocumentation(
104      description = "Darwin Core definition",
105      url = "https://rs.tdwg.org/dwc/terms/individualCount"
106    )
107  )
108  private Integer individualCount;
109
110  // OpenAPI documentation comes from the enumeration.
111  private OccurrenceStatus occurrenceStatus;
112
113  // OpenAPI documentation comes from the enumeration.
114  private String sex;
115
116  @Schema(
117    description = "The age class or life stage of the Organism(s) at the time the Occurrence was recorded.\n\n" +
118      "Values are aligned to the [GBIF LifeStage vocabulary](https://registry.gbif.org/vocabulary/LifeStage/concepts)",
119    externalDocs = @ExternalDocumentation(
120      description = "Darwin Core definition",
121      url = "https://rs.tdwg.org/dwc/terms/lifeStage"
122    )
123  )
124  private String lifeStage;
125
126  @Schema(
127    description = "Statement about whether an organism or organisms have been introduced to a given place and time " +
128      "through the direct or indirect activity of modern humans.\n\n" +
129      "Values are aligned to the [GBIF EstablishmentMeans vocabulary](https://registry.gbif.org/vocabulary/EstablishmentMeans/concepts), " +
130      "which is derived from the [Darwin Core EstablishmentMeans vocabulary](https://dwc.tdwg.org/em/).",
131    externalDocs = @ExternalDocumentation(
132      description = "Darwin Core definition",
133      url = "https://rs.tdwg.org/dwc/terms/establishmentMeans"
134    )
135  )
136  private String establishmentMeans;
137
138  @Schema(
139    description = "The degree to which an Organism survives, reproduces, and expands its range at the given " +
140      "place and time.\n\n" +
141      "Values are aligned to the [GBIF DegreeOfEstablishment vocabulary](https://registry.gbif.org/vocabulary/DegreeOfEstablishment/concepts), " +
142      "which is derived from the [Darwin Core DegreeOfEstablishment vocabulary](https://dwc.tdwg.org/doe/).",
143    externalDocs = @ExternalDocumentation(
144      description = "Darwin Core definition",
145      url = "https://rs.tdwg.org/dwc/terms/degreeOfEstablishment"
146    )
147  )
148  private String degreeOfEstablishment;
149
150  @Schema(
151    description = "The process by which an Organism came to be in a given place at a given time.\n\n" +
152    "Values are aligned to the [GBIF Pathway vocabulary](https://registry.gbif.org/vocabulary/Pathway/concepts), " +
153    "which is derived from the [Darwin Core Pathway vocabulary](https://dwc.tdwg.org/pw/).",
154    externalDocs = @ExternalDocumentation(
155      description = "Darwin Core definition",
156      url = "https://rs.tdwg.org/dwc/terms/pathway"
157    )
158  )
159  private String pathway;
160
161
162  @Schema(
163    description = "The map of classifications associated with this occurrence keyed by checklistKey.",
164    externalDocs = @ExternalDocumentation(
165      description = "Darwin Core definition",
166      url = "https://rs.tdwg.org/dwc/terms/"
167    )
168  )
169  private Map<String, Classification> classifications;
170
171  @Schema(
172    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the most specific " +
173      "(lowest rank) taxon for this occurrence.  This could be a synonym, see `acceptedTaxonKey`.",
174    externalDocs = @ExternalDocumentation(
175      description = "Darwin Core definition",
176      url = "https://rs.tdwg.org/dwc/terms/"
177    )
178  )
179  @Deprecated
180  private Integer taxonKey;
181
182  @Schema(
183    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the kingdom of this occurrence.",
184    externalDocs = @ExternalDocumentation(
185      description = "Darwin Core definition",
186      url = "https://rs.tdwg.org/dwc/terms/"
187    )
188  )
189  @Deprecated
190  private Integer kingdomKey;
191
192  @Schema(
193    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the phylum of this occurrence.",
194    externalDocs = @ExternalDocumentation(
195      description = "Darwin Core definition",
196      url = "https://rs.tdwg.org/dwc/terms/"
197    )
198  )
199  @Deprecated
200  private Integer phylumKey;
201
202  @Schema(
203    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the class of this" +
204      "occurrence.",
205    externalDocs = @ExternalDocumentation(
206      description = "Darwin Core definition",
207      url = "https://rs.tdwg.org/dwc/terms/"
208    )
209  )
210  @Deprecated
211  private Integer classKey;
212
213  @Schema(
214    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the order of this" +
215      "occurrence.",
216    externalDocs = @ExternalDocumentation(
217      description = "Darwin Core definition",
218      url = "https://rs.tdwg.org/dwc/terms/"
219    )
220  )
221  @Deprecated
222  private Integer orderKey;
223
224  @Schema(
225    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the family of this" +
226      "occurrence.",
227    externalDocs = @ExternalDocumentation(
228      description = "Darwin Core definition",
229      url = "https://rs.tdwg.org/dwc/terms/"
230    )
231  )
232  @Deprecated
233  private Integer familyKey;
234
235  @Schema(
236    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the genus of this" +
237      "occurrence.",
238    externalDocs = @ExternalDocumentation(
239      description = "Darwin Core definition",
240      url = "https://rs.tdwg.org/dwc/terms/"
241    )
242  )
243  @Deprecated
244  private Integer genusKey;
245
246  @Schema(
247    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the subgenus of this" +
248      "occurrence.",
249    externalDocs = @ExternalDocumentation(
250      description = "Darwin Core definition",
251      url = "https://rs.tdwg.org/dwc/terms/"
252    )
253  )
254  @Deprecated
255  private Integer subgenusKey;
256
257  @Schema(
258    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the species of this" +
259      "occurrence.",
260    externalDocs = @ExternalDocumentation(
261      description = "Darwin Core definition",
262      url = "https://rs.tdwg.org/dwc/terms/"
263    )
264  )
265  @Deprecated
266  private Integer speciesKey;
267
268  @Schema(
269    description = "A taxon key from the selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) for the accepted taxon of " +
270      "this occurrence.",
271    externalDocs = @ExternalDocumentation(
272      description = "Darwin Core definition",
273      url = "https://rs.tdwg.org/dwc/terms/"
274    )
275  )
276  @Deprecated
277  private Integer acceptedTaxonKey;
278
279  // taxonomy as name strings → LinneanClassification
280
281  @Schema(
282    description = "The scientific name (including authorship) for the taxon from the " +
283      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.  This could be a synonym, see " +
284      "also `acceptedScientificName`.",
285    externalDocs = @ExternalDocumentation(
286      description = "Darwin Core definition",
287      url = "https://rs.tdwg.org/dwc/terms/"
288    )
289  )
290  private String scientificName;  // the interpreted name matching taxonKey
291
292  @Schema(
293    description = "The scientific name authorship for the taxon from the " +
294      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.  This could be a synonym, see " +
295      "also `acceptedScientificName`.",
296    externalDocs = @ExternalDocumentation(
297      description = "Darwin Core definition",
298      url = "https://rs.tdwg.org/dwc/terms/"
299    )
300  )
301  private String scientificNameAuthorship;
302
303  @Schema(
304    description = "The accepted scientific name (including authorship) for the taxon from the " +
305      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
306    externalDocs = @ExternalDocumentation(
307      description = "Darwin Core definition",
308      url = "https://rs.tdwg.org/dwc/terms/"
309    )
310  )
311  private String acceptedScientificName;
312
313  @Schema(
314    description = "The kingdom name (excluding authorship) for the kingdom from the " +
315      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
316    externalDocs = @ExternalDocumentation(
317      description = "Darwin Core definition",
318      url = "https://rs.tdwg.org/dwc/terms/"
319    )
320  )
321  private String kingdom;
322
323  @Schema(
324    description = "The phylum name (excluding authorship) for the phylum from the " +
325      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
326    externalDocs = @ExternalDocumentation(
327      description = "Darwin Core definition",
328      url = "https://rs.tdwg.org/dwc/terms/"
329    )
330  )
331  private String phylum;
332
333  @Schema(
334    description = "The class name (excluding authorship) for the class from the " +
335      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
336    externalDocs = @ExternalDocumentation(
337      description = "Darwin Core definition",
338      url = "https://rs.tdwg.org/dwc/terms/"
339    )
340  )
341  @JsonProperty("class")
342  private String clazz;
343
344  @Schema(
345    description = "The order name (excluding authorship) for the order from the " +
346      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
347    externalDocs = @ExternalDocumentation(
348      description = "Darwin Core definition",
349      url = "https://rs.tdwg.org/dwc/terms/"
350    )
351  )
352  private String order;
353
354  @Schema(
355    description = "The family name (excluding authorship) for the family from the " +
356      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
357    externalDocs = @ExternalDocumentation(
358      description = "Darwin Core definition",
359      url = "https://rs.tdwg.org/dwc/terms/"
360    )
361  )
362  private String family;
363
364  @Schema(
365    description = "The genus name (excluding authorship) for the genus from the " +
366      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
367    externalDocs = @ExternalDocumentation(
368      description = "Darwin Core definition",
369      url = "https://rs.tdwg.org/dwc/terms/"
370    )
371  )
372  private String genus;
373
374  @Schema(
375    description = "The subgenus name (excluding authorship) for the subgenus from the " +
376      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
377    externalDocs = @ExternalDocumentation(
378      description = "Darwin Core definition",
379      url = "https://rs.tdwg.org/dwc/terms/"
380    )
381  )
382  private String subgenus;
383
384  @Schema(
385    description = "The species name (excluding authorship) for the species from the " +
386      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
387    externalDocs = @ExternalDocumentation(
388      description = "Darwin Core definition",
389      url = "https://rs.tdwg.org/dwc/terms/"
390    )
391  )
392  private String species;
393
394  // atomised scientific name
395
396  @Schema(
397    description = "The genus name part of the species name from the " +
398      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
399    externalDocs = @ExternalDocumentation(
400      description = "Darwin Core definition",
401      url = "https://rs.tdwg.org/dwc/terms/genericName"
402    )
403  )
404  private String genericName;
405
406  @Schema(
407    description = "The specific name part of the species name from the " +
408      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
409    externalDocs = @ExternalDocumentation(
410      description = "Darwin Core definition",
411      url = "https://rs.tdwg.org/dwc/terms/specificEpithet"
412    )
413  )
414  private String specificEpithet;
415
416  @Schema(
417    description = "The infraspecific name part of the species name from the " +
418      "selected taxonomy (e.g. Catalogue of Life, GBIF Backbone) matched to this occurrence.",
419    externalDocs = @ExternalDocumentation(
420      description = "Darwin Core definition",
421      url = "https://rs.tdwg.org/dwc/terms/infraspecificEpithet"
422    )
423  )
424  private String infraspecificEpithet;
425
426  @Schema(
427    description = "The taxonomic rank of the most specific name in the scientificName.",
428    externalDocs = @ExternalDocumentation(
429      description = "Darwin Core definition",
430      url = "https://rs.tdwg.org/dwc/terms/taxonRank"
431    )
432  )
433  private Rank taxonRank;
434
435  @Schema(
436    description = "The status of the use of the scientificName as a label for a taxon.",
437    externalDocs = @ExternalDocumentation(
438      description = "Darwin Core definition",
439      url = "https://rs.tdwg.org/dwc/terms/taxonomicStatus"
440    )
441  )
442  private TaxonomicStatus taxonomicStatus;
443
444  @Schema(
445    description = "The IUCN Red List Category of the taxon of this occurrence.\n\n" +
446      "See the [GBIF vocabulary](https://rs.gbif.org/vocabulary/iucn/threat_status/) for the values and their " +
447      "definitions, and the [IUCN Red List of Threatened Species dataset in GBIF](https://doi.org/10.15468/0qnb58) " +
448      "for the version of the Red List GBIF's interpretation procedures are using.",
449    externalDocs = @ExternalDocumentation(
450      description = "GBIF vocabulary",
451      url = "https://rs.gbif.org/vocabulary/iucn/threat_status/"
452    )
453  )
454  private String iucnRedListCategory;
455
456  // identification
457
458  @Schema(
459    description = "The date on which the subject was determined as representing the Taxon.",
460    externalDocs = @ExternalDocumentation(
461      description = "Darwin Core definition",
462      url = "https://rs.tdwg.org/dwc/terms/dateIdentified"
463    )
464  )
465  private Date dateIdentified;
466
467  // location
468
469  @Schema(
470    description = "The geographic latitude (in decimal degrees, using the WGS84 datum) of the geographic centre " +
471      "of the location of the occurrence.",
472    externalDocs = @ExternalDocumentation(
473      description = "Darwin Core definition",
474      url = "https://rs.tdwg.org/dwc/terms/decimalLatitude"
475    )
476  )
477  private Double decimalLatitude;
478
479  @Schema(
480    description = "The geographic longitude (in decimal degrees, using the WGS84 datum) of the geographic centre " +
481      "of the location of the occurrence.",
482    externalDocs = @ExternalDocumentation(
483      description = "Darwin Core definition",
484      url = "https://rs.tdwg.org/dwc/terms/decimalLongitude"
485    )
486  )
487  private Double decimalLongitude;
488
489  //coordinatePrecision and coordinateUncertaintyInMeters should be BigDecimal see POR-2795
490
491  @Schema(
492    description = "A decimal representation of the precision of the coordinates given in the decimalLatitude and decimalLongitude.",
493    externalDocs = @ExternalDocumentation(
494      description = "Darwin Core definition",
495      url = "https://rs.tdwg.org/dwc/terms/coordinatePrecision"
496    )
497  )
498  private Double coordinatePrecision;
499
500  @Schema(
501    description = "The horizontal distance (in metres) from the given decimalLatitude and decimalLongitude " +
502      "describing the smallest circle containing the whole of the Location.",
503    externalDocs = @ExternalDocumentation(
504      description = "Darwin Core definition",
505      url = "https://rs.tdwg.org/dwc/terms/coordinateUncertaintyInMeters"
506    )
507  )
508  private Double coordinateUncertaintyInMeters;
509
510  @Schema(
511    description = "**Deprecated.**  This value is always null.  It is an obsolete Darwin Core term.",
512    externalDocs = @ExternalDocumentation(
513      description = "Darwin Core definition",
514      url = "https://rs.tdwg.org/dwc/terms/"
515    )
516  )
517  @Deprecated //see getter
518  private Double coordinateAccuracy;
519
520  @Schema(
521    description = "Elevation (altitude) in metres above sea level.  This is not a current Darwin Core term."
522  )
523  private Double elevation;
524
525  @Schema(
526    description = "The value of the potential error associated with the elevation.  This is not a current Darwin Core term."
527  )
528  private Double elevationAccuracy;
529
530  @Schema(
531    description = "Depth in metres below sea level.  This is not a current Darwin Core term."
532  )
533  private Double depth;
534
535  @Schema(
536    description = "The value of the potential error associated with the depth.  This is not a current Darwin Core term."
537  )
538  private Double depthAccuracy;
539
540  // OpenAPI documentation from enumeration
541  private Continent continent;
542
543  @JsonSerialize(using = Country.IsoSerializer.class)
544  @JsonDeserialize(using = Country.IsoDeserializer.class)
545  private Country country;
546
547  @Schema(
548    description = "The name of the next-smaller administrative region than country (state, province, canton, " +
549      "department, region, etc.) in which the occurrence occurs.\n\n" +
550      "This value is unaltered by GBIF's processing; see also the GADM fields.",
551    externalDocs = @ExternalDocumentation(
552      description = "Darwin Core definition",
553      url = "https://rs.tdwg.org/dwc/terms/stateProvince"
554    )
555  )
556  private String stateProvince;
557
558  @Schema(
559    description = "The administrative divisions according to the [GADM database](https://gadm.org/).\n\n" +
560      "This value is applied by GBIF's processing without consideration of the `stateProvince`, `county` or `locality` fields."
561  )
562  private Gadm gadm = new Gadm();
563
564  @Schema(
565    description = "The name of the water body in which the Location occurs.",
566    externalDocs = @ExternalDocumentation(
567      description = "Darwin Core definition",
568      url = "https://rs.tdwg.org/dwc/terms/waterBody"
569    )
570  )
571  private String waterBody;
572
573  @Schema(
574    description = "The distance in metres of the occurrence from a centroid known to be applied to occurrences " +
575      "during georeferencing.  This can potentially indicate low-precision georeferencing, check the values of " +
576      "`coordinateUncertaintyInMeters` and `georeferenceRemarks`."
577  )
578  private Double distanceFromCentroidInMeters;
579
580  @Schema(
581    description = "A list (concatenated and separated) of geographic names less specific than the information captured in the dwc:locality term.",
582    externalDocs = @ExternalDocumentation(
583      description = "Darwin Core definition",
584      url = "https://rs.tdwg.org/dwc/terms/higherGeography"
585    )
586  )
587  private String higherGeography;
588
589  @Schema(
590    description = "A list (concatenated and separated) of names of people, groups, or organizations who determined the georeference (spatial representation) for the dcterms:Location.",
591    externalDocs = @ExternalDocumentation(
592      description = "Darwin Core definition",
593      url = "https://rs.tdwg.org/dwc/terms/georeferencedBy"
594    )
595  )
596  private String georeferencedBy;
597
598  // recording event
599
600  @Schema(
601    description = "The four-digit year in which the event occurred, according to the Common Era calendar.",
602    externalDocs = @ExternalDocumentation(
603      description = "Darwin Core definition",
604      url = "https://rs.tdwg.org/dwc/terms/year"
605    )
606  )
607  private Integer year;
608
609  @Schema(
610    description = "The integer month in which the Event occurred.",
611    externalDocs = @ExternalDocumentation(
612      description = "Darwin Core definition",
613      url = "https://rs.tdwg.org/dwc/terms/month"
614    )
615  )
616  private Integer month;
617
618  @Schema(
619    description = "The integer day of the month on which the Event occurred.",
620    externalDocs = @ExternalDocumentation(
621      description = "Darwin Core definition",
622      url = "https://rs.tdwg.org/dwc/terms/day"
623    )
624  )
625  private Integer day;
626
627  @Schema(
628    description = "The date-time during which an Event occurred. For occurrences, this is the date-time when the " +
629      "event was recorded. Not suitable for a time in a geological context.",
630    externalDocs = @ExternalDocumentation(
631      description = "Darwin Core definition",
632      url = "https://rs.tdwg.org/dwc/terms/eventDate"
633    )
634  )
635  private IsoDateInterval eventDate;
636
637  @Schema(
638    description = "The latest integer day of the year on which the Event occurred (1 for 1 January, 365 for " +
639      "31 December, except in a leap year, in which case it is 366).",
640    externalDocs = @ExternalDocumentation(
641      description = "Darwin Core definition",
642      url = "https://rs.tdwg.org/dwc/terms/endDayOfYear"
643    )
644  )
645  private Integer startDayOfYear;
646
647  @Schema(
648    description = "The earliest integer day of the year on which the Event occurred (1 for 1 January, 365 for " +
649      "31 December, except in a leap year, in which case it is 366).",
650    externalDocs = @ExternalDocumentation(
651      description = "Darwin Core definition",
652      url = "https://rs.tdwg.org/dwc/terms/startDayOfYear"
653    )
654  )
655  private Integer endDayOfYear;
656
657  @Schema(
658    description = "A list (concatenated and separated) of nomenclatural types (type status, typified scientific name, " +
659      "publication) applied to the occurrence.",
660    externalDocs = @ExternalDocumentation(
661      description = "Darwin Core definition",
662      url = "https://rs.tdwg.org/dwc/terms/typeStatus"
663    )
664  )
665  private String typeStatus;
666
667  // extracted from type status, but we should propose a new dwc term for this!
668  // for example: "Paratype of Taeniopteryx metequi Ricker & Ross" is status=Paratype, typifiedName=Taeniopteryx metequi Ricker & Ross
669  @Schema(
670    description = "The scientific name that is based on the type specimen.\n\n" +
671      "This is not yet a Darwin Core term, see the [proposal to add it](https://github.com/tdwg/dwc/issues/28)."
672  )
673  private String typifiedName; // missing from DwC
674
675  @Schema(
676    description = "A specific interpretation issue found during processing and interpretation of the record.\n\n" +
677      "See the https://links.gbif.org/occurrence-issues[list of occurrence issues] and the " +
678      "https://gbif.github.io/gbif-api/apidocs/org/gbif/api/vocabulary/OccurrenceIssue.html[OccurrenceIssue enumeration] " +
679      "for possible values and definitions."
680  )
681  private Set<OccurrenceIssue> issues = EnumSet.noneOf(OccurrenceIssue.class);
682
683  // record level
684
685  @Schema(
686    description = "The most recent date-time on which the occurrence was changed, according to the publisher.",
687    externalDocs = @ExternalDocumentation(
688      description = "Dublin Core definition",
689      url = "https://purl.org/dc/terms/modified"
690    )
691  )
692  private Date modified;  // interpreted dc:modified, i.e. date changed in source
693
694  @Schema(
695    description = "The time this occurrence was last processed by GBIF's interpretation system “Pipelines”.\n\n" +
696      "This is the time the record was last changed in GBIF, **not** the time the record was last changed by the " +
697      "publisher.  Data is also reprocessed when we changed the taxonomic backbone, geographic data sources or " +
698      "other interpretation procedures.\n\n" +
699      "An earlier interpretation system distinguished between “parsing” and “interpretation”, but in the current " +
700      "system there is only one process — the two dates will always be the same."
701  )
702  private Date lastInterpreted;
703
704  @Schema(
705    description = "A related resource that is referenced, cited, or otherwise pointed to by the described resource.",
706    externalDocs = @ExternalDocumentation(
707      description = "Dublin Core definition",
708      url = "https://purl.org/dc/terms/references"
709    )
710  )
711  private URI references;
712
713  @Schema(
714    description = "A legal document giving official permission to do something with the occurrence.",
715    externalDocs = @ExternalDocumentation(
716      description = "Dublin Core definition",
717      url = "https://purl.org/dc/terms/license"
718    )
719  )
720  private License license;
721
722  @Schema(
723    description = "A number or enumeration value for the quantity of organisms.",
724    externalDocs = @ExternalDocumentation(
725      description = "Darwin Core definition",
726      url = "https://rs.tdwg.org/dwc/terms/organismQuantity"
727    )
728  )
729  private Double organismQuantity;
730
731  @Schema(
732    description = "The type of quantification system used for the quantity of organisms.",
733    externalDocs = @ExternalDocumentation(
734      description = "Darwin Core definition",
735      url = "https://rs.tdwg.org/dwc/terms/organismQuantityType"
736    )
737  )
738  private String organismQuantityType;
739
740  @Schema(
741    description = "The unit of measurement of the size (time duration, length, area, or volume) of a sample in a sampling event.",
742    externalDocs = @ExternalDocumentation(
743      description = "Darwin Core definition",
744      url = "https://rs.tdwg.org/dwc/terms/sampleSizeUnit"
745    )
746  )
747  private String sampleSizeUnit;
748
749  @Schema(
750    description = "A numeric value for a measurement of the size (time duration, length, area, or volume) of a sample in a sampling event.",
751    externalDocs = @ExternalDocumentation(
752      description = "Darwin Core definition",
753      url = "https://rs.tdwg.org/dwc/terms/sampleSizeValue"
754    )
755  )
756  private Double sampleSizeValue;
757
758  @Schema(
759    description = "The relative measurement of the quantity of the organism (i.e. without absolute units)."
760  )
761  private Double relativeOrganismQuantity;
762
763  @Schema(
764    description = "Flag occurrence when associatedSequences/extension exists"
765  )
766  private boolean isSequenced;
767
768  @Schema(
769      description = "A list (concatenated and separated) of identifiers (publication, global unique identifier, URI) "
770        + "of genetic sequence information associated with the material entity.",
771      externalDocs =
772          @ExternalDocumentation(
773              description = "Darwin Core definition",
774              url = "https://rs.tdwg.org/dwc/terms/associatedSequences"))
775  private String associatedSequences;
776
777  // interpreted extension data
778
779  @Schema(
780    description = "Alternative identifiers for the occurrence.",
781    externalDocs = @ExternalDocumentation(
782      description = "GBIF Alternative Identifiers extension",
783      url = "https://rs.gbif.org/terms/1.0/Identifier"
784    )
785  )
786  private List<Identifier> identifiers = new ArrayList<>();
787
788  @Schema(
789    description = "Multimedia related to te occurrence.",
790    externalDocs = @ExternalDocumentation(
791      description = "GBIF Multimedia extension",
792      url = "https://rs.gbif.org/terms/1.0/Multimedia"
793    )
794  )
795  private List<MediaObject> media = new ArrayList<>();
796
797  @Schema(
798    description = "Measurements or facts about the the occurrence.",
799    externalDocs = @ExternalDocumentation(
800      description = "Darwin Core definition",
801      url = "https://rs.tdwg.org/dwc/terms/MeasurementOrFact"
802    )
803  )
804  private List<MeasurementOrFact> facts = new ArrayList<>();
805
806  @Schema(
807    description = "Relationships between occurrences.",
808    externalDocs = @ExternalDocumentation(
809      description = "Darwin Core definition",
810      url = "https://rs.tdwg.org/dwc/terms/ResourceRelationship"
811    )
812  )
813  private List<OccurrenceRelation> relations = new ArrayList<>();
814
815  @Schema(
816    description = "A list of the globally unique identifiers for the person, people, groups, or organizations " +
817      "responsible for recording the original Occurrence.",
818    externalDocs = @ExternalDocumentation(
819      description = "Darwin Core definition",
820      url = "https://rs.tdwg.org/dwc/terms/recordedByID"
821    )
822  )
823  @JsonProperty("recordedByIDs")
824  private List<AgentIdentifier> recordedByIds = new ArrayList<>();
825
826  @Schema(
827    description = "A list of the globally unique identifiers for the person, people, groups, or organizations " +
828      "responsible for assigning the Taxon to the occurrence.",
829    externalDocs = @ExternalDocumentation(
830      description = "Darwin Core definition",
831      url = "https://rs.tdwg.org/dwc/terms/identifiedByID"
832    )
833  )
834  @JsonProperty("identifiedByIDs")
835  private List<AgentIdentifier> identifiedByIds = new ArrayList<>();
836
837  @Schema(
838    description = "The UUID of the institution holding the specimen occurrence, from GRSciColl."
839  )
840  private UUID institutionKey;
841
842  @Schema(
843    description = "The UUID of the collection containing the specimen occurrence, from GRSciColl."
844  )
845  private UUID collectionKey;
846
847  @Schema(
848    description = "**Experimental.**  Whether the occurrence belongs to a machine-calculated cluster of probable " +
849      "duplicate occurrences.",
850    externalDocs = @ExternalDocumentation(
851      description = "GBIF Data Blog",
852      url = "https://data-blog.gbif.org/post/clustering-occurrences/"
853    )
854  )
855  @Experimental
856  private boolean isInCluster;
857
858  @Schema(
859    description = "An identifier for the set of data. May be a global unique identifier or an identifier specific to " +
860      "a collection or institution.",
861    externalDocs = @ExternalDocumentation(
862      description = "Darwin Core definition",
863      url = "https://rs.tdwg.org/dwc/terms/datasetID"
864    )
865  )
866  private String datasetID;
867
868  @Schema(
869    description = "The name identifying the data set from which the record was derived.",
870    externalDocs = @ExternalDocumentation(
871      description = "Darwin Core definition",
872      url = "https://rs.tdwg.org/dwc/terms/"
873    )
874  )
875  private String datasetName;
876
877  @Schema(
878    description = "A list (concatenated and separated) of previous or alternate fully qualified catalogue numbers " +
879      "or other human-used identifiers for the same occurrence, whether in the current or any other data set or collection.",
880    externalDocs = @ExternalDocumentation(
881      description = "Darwin Core definition",
882      url = "https://rs.tdwg.org/dwc/terms/otherCatalogNumbers"
883    )
884  )
885  private String otherCatalogNumbers;
886
887  @Schema(
888    description = "The full name of the earliest possible geochronologic eon or lowest chrono-stratigraphic eonothem or the informal name (\"Precambrian\") attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
889    externalDocs = @ExternalDocumentation(
890      description = "Darwin Core definition",
891      url = "https://rs.tdwg.org/dwc/terms/earliestEonOrLowestEonothem"
892    )
893  )
894  private String earliestEonOrLowestEonothem;
895
896  @Schema(
897    description = "The full name of the latest possible geochronologic eon or highest chrono-stratigraphic eonothem or the informal name (\"Precambrian\") attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
898    externalDocs = @ExternalDocumentation(
899      description = "Darwin Core definition",
900      url = "https://rs.tdwg.org/dwc/terms/latestEonOrHighestEonothem"
901    )
902  )
903  private String latestEonOrHighestEonothem;
904
905  @Schema(
906    description = "The full name of the earliest possible geochronologic era or lowest chronostratigraphic erathem attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
907    externalDocs = @ExternalDocumentation(
908      description = "Darwin Core definition",
909      url = "https://rs.tdwg.org/dwc/terms/earliestEraOrLowestErathem"
910    )
911  )
912  private String earliestEraOrLowestErathem;
913
914  @Schema(
915    description = "The full name of the latest possible geochronologic era or highest chronostratigraphic erathem attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
916    externalDocs = @ExternalDocumentation(
917      description = "Darwin Core definition",
918      url = "https://rs.tdwg.org/dwc/terms/latestEraOrHighestErathem"
919    )
920  )
921  private String latestEraOrHighestErathem;
922
923  @Schema(
924    description = "The full name of the earliest possible geochronologic period or lowest chronostratigraphic system attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
925    externalDocs = @ExternalDocumentation(
926      description = "Darwin Core definition",
927      url = "https://rs.tdwg.org/dwc/terms/earliestPeriodOrLowestSystem"
928    )
929  )
930  private String earliestPeriodOrLowestSystem;
931
932  @Schema(
933    description = "The full name of the latest possible geochronologic period or highest chronostratigraphic system attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
934    externalDocs = @ExternalDocumentation(
935      description = "Darwin Core definition",
936      url = "https://rs.tdwg.org/dwc/terms/latestPeriodOrHighestSystem"
937    )
938  )
939  private String latestPeriodOrHighestSystem;
940
941  @Schema(
942    description = "The full name of the earliest possible geochronologic epoch or lowest chronostratigraphic series attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
943    externalDocs = @ExternalDocumentation(
944      description = "Darwin Core definition",
945      url = "https://rs.tdwg.org/dwc/terms/earliestEpochOrLowestSeries"
946    )
947  )
948  private String earliestEpochOrLowestSeries;
949
950  @Schema(
951    description = "The full name of the latest possible geochronologic epoch or highest chronostratigraphic series attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
952    externalDocs = @ExternalDocumentation(
953      description = "Darwin Core definition",
954      url = "https://rs.tdwg.org/dwc/terms/latestEpochOrHighestSeries"
955    )
956  )
957  private String latestEpochOrHighestSeries;
958
959  @Schema(
960    description = "The full name of the earliest possible geochronologic age or lowest chronostratigraphic stage attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
961    externalDocs = @ExternalDocumentation(
962      description = "Darwin Core definition",
963      url = "https://rs.tdwg.org/dwc/terms/earliestAgeOrLowestStage"
964    )
965  )
966  private String earliestAgeOrLowestStage;
967
968  @Schema(
969    description = "The full name of the latest possible geochronologic age or highest chronostratigraphic stage attributable to the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
970    externalDocs = @ExternalDocumentation(
971      description = "Darwin Core definition",
972      url = "https://rs.tdwg.org/dwc/terms/latestAgeOrHighestStage"
973    )
974  )
975  private String latestAgeOrHighestStage;
976
977  @Schema(
978    description = "The full name of the lowest possible geological biostratigraphic zone of the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
979    externalDocs = @ExternalDocumentation(
980      description = "Darwin Core definition",
981      url = "https://rs.tdwg.org/dwc/terms/lowestBiostratigraphicZone"
982    )
983  )
984  private String lowestBiostratigraphicZone;
985
986  @Schema(
987    description = "The full name of the highest possible geological biostratigraphic zone of the stratigraphic horizon from which the dwc:MaterialEntity was collected.",
988    externalDocs = @ExternalDocumentation(
989      description = "Darwin Core definition",
990      url = "https://rs.tdwg.org/dwc/terms/highestBiostratigraphicZone"
991    )
992  )
993  private String highestBiostratigraphicZone;
994
995  @Schema(
996    description = "The full name of the lithostratigraphic group from which the dwc:MaterialEntity was collected.",
997    externalDocs = @ExternalDocumentation(
998      description = "Darwin Core definition",
999      url = "https://rs.tdwg.org/dwc/terms/group"
1000    )
1001  )
1002  private String group;
1003
1004  @Schema(
1005    description = "The full name of the lithostratigraphic formation from which the dwc:MaterialEntity was collected.",
1006    externalDocs = @ExternalDocumentation(
1007      description = "Darwin Core definition",
1008      url = "https://rs.tdwg.org/dwc/terms/formation"
1009    )
1010  )
1011  private String formation;
1012
1013  @Schema(
1014    description = "The full name of the lithostratigraphic member from which the dwc:MaterialEntity was collected.",
1015    externalDocs = @ExternalDocumentation(
1016      description = "Darwin Core definition",
1017      url = "https://rs.tdwg.org/dwc/terms/member"
1018    )
1019  )
1020  private String member;
1021
1022  @Schema(
1023    description = "The full name of the lithostratigraphic bed from which the dwc:MaterialEntity was collected.",
1024    externalDocs = @ExternalDocumentation(
1025      description = "Darwin Core definition",
1026      url = "https://rs.tdwg.org/dwc/terms/bed"
1027    )
1028  )
1029  private String bed;
1030
1031
1032  @Schema(
1033    description = "A person, group, or organization responsible for recording the original occurrence.",
1034    externalDocs = @ExternalDocumentation(
1035      description = "Darwin Core definition",
1036      url = "https://rs.tdwg.org/dwc/terms/recordedBy"
1037    )
1038  )
1039  private String recordedBy;
1040
1041  @Schema(
1042    description = "A list (concatenated and separated) of names of people, groups, or organizations who assigned the " +
1043      "Taxon to the occurrence.",
1044    externalDocs = @ExternalDocumentation(
1045      description = "Darwin Core definition",
1046      url = "https://rs.tdwg.org/dwc/terms/identifiedBy"
1047    )
1048  )
1049  private String identifiedBy;
1050
1051  @Schema(
1052    description = "A preparation or preservation method for a specimen.",
1053    externalDocs = @ExternalDocumentation(
1054      description = "Darwin Core definition",
1055      url = "https://rs.tdwg.org/dwc/terms/preparations"
1056    )
1057  )
1058  private String preparations;
1059
1060  @Schema(
1061    description = "The methods or protocols used during an Event, denoted by an IRI.",
1062    externalDocs = @ExternalDocumentation(
1063      description = "Darwin Core definition",
1064      url = "https://rs.tdwg.org/dwc/terms/samplingProtocol"
1065    )
1066  )
1067  private String samplingProtocol;
1068
1069  @Schema(
1070    description = "**Deprecated: use the nucleotideSequence instead.**  The DNA sequence ID of an occurrence."
1071  )
1072  @Deprecated
1073  private List<String> dnaSequenceID = new ArrayList<>();
1074
1075  @Schema(description = "Nucleotide Sequence objects of an occurrence.")
1076  @Getter
1077  @Setter
1078  private List<NucleotideSequence> nucleotideSequence = new ArrayList<>();
1079
1080  public Occurrence() {
1081
1082  }
1083
1084  /**
1085   * Create occurrence instance from existing verbatim one, copying over all data.
1086   */
1087  public Occurrence(@Nullable VerbatimOccurrence verbatim) {
1088    if (verbatim != null) {
1089      setKey(verbatim.getKey());
1090      setDatasetKey(verbatim.getDatasetKey());
1091      setPublishingOrgKey(verbatim.getPublishingOrgKey());
1092      setPublishingCountry(verbatim.getPublishingCountry());
1093      setProtocol(verbatim.getProtocol());
1094      setCrawlId(verbatim.getCrawlId());
1095      if (verbatim.getLastCrawled() != null) {
1096        setLastCrawled(new Date(verbatim.getLastCrawled().getTime()));
1097      }
1098      if (verbatim.getVerbatimFields() != null) {
1099        getVerbatimFields().putAll(verbatim.getVerbatimFields());
1100      }
1101      if (verbatim.getLastParsed() != null) {
1102        setLastParsed(verbatim.getLastParsed());
1103      }
1104      setExtensions(verbatim.getExtensions());
1105    }
1106  }
1107
1108  @Nullable
1109  public BasisOfRecord getBasisOfRecord() {
1110    return basisOfRecord;
1111  }
1112
1113  public void setBasisOfRecord(BasisOfRecord basisOfRecord) {
1114    this.basisOfRecord = basisOfRecord;
1115  }
1116
1117  @Nullable
1118  public Integer getIndividualCount() {
1119    return individualCount;
1120  }
1121
1122  public void setIndividualCount(Integer individualCount) {
1123    this.individualCount = individualCount;
1124  }
1125
1126  @Nullable
1127  public OccurrenceStatus getOccurrenceStatus() {
1128    return occurrenceStatus;
1129  }
1130
1131  public void setOccurrenceStatus(OccurrenceStatus occurrenceStatus) {
1132    this.occurrenceStatus = occurrenceStatus;
1133  }
1134
1135  @Nullable
1136  public String getSex() {
1137    return sex;
1138  }
1139
1140  public void setSex(String sex) {
1141    this.sex = sex;
1142  }
1143
1144  @Nullable
1145  public String getLifeStage() {
1146    return lifeStage;
1147  }
1148
1149  public void setLifeStage(String lifeStage) {
1150    this.lifeStage = lifeStage;
1151  }
1152
1153  @Nullable
1154  public String getEstablishmentMeans() {
1155    return establishmentMeans;
1156  }
1157
1158  public void setEstablishmentMeans(String establishmentMeans) {
1159    this.establishmentMeans = establishmentMeans;
1160  }
1161
1162  /**
1163   * The best matching, accepted name usage representing this occurrence.
1164   * In case the verbatim scientific name and its classification can only be matched to a higher rank this will
1165   * represent the lowest matching rank. In the worst case this could just be for example Animalia.
1166   */
1167  @Nullable
1168  public Integer getTaxonKey() {
1169    return taxonKey;
1170  }
1171
1172  public void setTaxonKey(Integer taxonKey) {
1173    this.taxonKey = taxonKey;
1174  }
1175
1176  @Nullable
1177  @Override
1178  public Integer getKingdomKey() {
1179    return kingdomKey;
1180  }
1181
1182  @Override
1183  public void setKingdomKey(@Nullable Integer kingdomKey) {
1184    this.kingdomKey = kingdomKey;
1185  }
1186
1187  @Nullable
1188  @Override
1189  public Integer getPhylumKey() {
1190    return phylumKey;
1191  }
1192
1193  @Override
1194  public void setPhylumKey(@Nullable Integer phylumKey) {
1195    this.phylumKey = phylumKey;
1196  }
1197
1198  @Nullable
1199  @Override
1200  public Integer getClassKey() {
1201    return classKey;
1202  }
1203
1204  @Override
1205  public void setClassKey(@Nullable Integer classKey) {
1206    this.classKey = classKey;
1207  }
1208
1209  @Nullable
1210  @Override
1211  public Integer getOrderKey() {
1212    return orderKey;
1213  }
1214
1215  @Override
1216  public void setOrderKey(@Nullable Integer orderKey) {
1217    this.orderKey = orderKey;
1218  }
1219
1220  @Nullable
1221  @Override
1222  public Integer getFamilyKey() {
1223    return familyKey;
1224  }
1225
1226  @Override
1227  public void setFamilyKey(@Nullable Integer familyKey) {
1228    this.familyKey = familyKey;
1229  }
1230
1231  @Nullable
1232  @Override
1233  public Integer getGenusKey() {
1234    return genusKey;
1235  }
1236
1237  @Override
1238  public void setGenusKey(@Nullable Integer genusKey) {
1239    this.genusKey = genusKey;
1240  }
1241
1242  @Nullable
1243  @Override
1244  public Integer getSubgenusKey() {
1245    return subgenusKey;
1246  }
1247
1248  @Override
1249  public void setSubgenusKey(@Nullable Integer subgenusKey) {
1250    this.subgenusKey = subgenusKey;
1251  }
1252
1253  @Nullable
1254  @Override
1255  public Integer getHigherRankKey(Rank rank) {
1256    return ClassificationUtils.getHigherRankKey(this, rank);
1257  }
1258
1259  /**
1260   * An ordered map with entries for all higher Linnean ranks excluding the taxonKey itself.
1261   * The map starts with the highest rank, e.g. the kingdom and maps the name usage key to its canonical name.
1262   *
1263   * @return map of higher ranks
1264   */
1265  @NotNull
1266  @JsonIgnore
1267  public Map<Integer, String> getHigherClassificationMap() {
1268    return taxonKey == null ? ClassificationUtils.getHigherClassificationMap(this)
1269      : ClassificationUtils.getHigherClassificationMap(this, taxonKey, null, null);
1270  }
1271
1272  /**
1273   * The accepted species for this occurrence. In case the taxonKey is of a higher rank than species (e.g. genus)
1274   * speciesKey is null. In case taxonKey represents an infraspecific taxon the speciesKey points to the species
1275   * the infraspecies is classified as. In case of taxonKey being a species the speciesKey is the same.
1276   */
1277  @Nullable
1278  @Override
1279  public Integer getSpeciesKey() {
1280    return speciesKey;
1281  }
1282
1283  @Override
1284  public void setSpeciesKey(@Nullable Integer speciesKey) {
1285    this.speciesKey = speciesKey;
1286  }
1287
1288  /**
1289   * The accepted taxon key from the selected taxonomy.
1290   */
1291  @Nullable
1292  public Integer getAcceptedTaxonKey() {
1293    return acceptedTaxonKey;
1294  }
1295
1296  public void setAcceptedTaxonKey(Integer acceptedTaxonKey) {
1297    this.acceptedTaxonKey = acceptedTaxonKey;
1298  }
1299
1300  @Nullable
1301  public String getSpecificEpithet() {
1302    return specificEpithet;
1303  }
1304
1305  public void setSpecificEpithet(String specificEpithet) {
1306    this.specificEpithet = specificEpithet;
1307  }
1308
1309  @Nullable
1310  public String getInfraspecificEpithet() {
1311    return infraspecificEpithet;
1312  }
1313
1314  public void setInfraspecificEpithet(String infraspecificEpithet) {
1315    this.infraspecificEpithet = infraspecificEpithet;
1316  }
1317
1318  @Nullable
1319  public Rank getTaxonRank() {
1320    return taxonRank;
1321  }
1322
1323  public void setTaxonRank(Rank taxonRank) {
1324    this.taxonRank = taxonRank;
1325  }
1326
1327  /**
1328   * The status of the use of the scientificName as a label for a taxon.
1329   * The GBIF recommended controlled value vocabulary can be found at <a href="http://rs.gbif.org/vocabulary/gbif/taxonomic_status.xml">http://rs.gbif.org/vocabulary/gbif/taxonomic_status.xm</a>.
1330   */
1331  @Nullable
1332  public TaxonomicStatus getTaxonomicStatus() {
1333    return taxonomicStatus;
1334  }
1335
1336  public void setTaxonomicStatus(TaxonomicStatus taxonomicStatus) {
1337    this.taxonomicStatus = taxonomicStatus;
1338  }
1339
1340  /**
1341   * The IUCN Red List Category.
1342   */
1343  @Nullable
1344  public String getIucnRedListCategory() {
1345    return iucnRedListCategory;
1346  }
1347
1348  public void setIucnRedListCategory(String iucnRedListCategory) {
1349    this.iucnRedListCategory = iucnRedListCategory;
1350  }
1351
1352  /**
1353   * The scientific name for taxonKey from the selected taxonomy.
1354   */
1355  @Nullable
1356  public String getScientificName() {
1357    return scientificName;
1358  }
1359
1360  public void setScientificName(@Nullable String scientificName) {
1361    this.scientificName = scientificName;
1362  }
1363
1364  /**
1365   * The scientific name authorship for taxonKey from the selected taxonomy.
1366   */
1367  @Nullable
1368  public String getScientificNameAuthorship() {
1369    return scientificNameAuthorship;
1370  }
1371
1372  public void setScientificNameAuthorship(String scientificNameAuthorship) {
1373    this.scientificNameAuthorship = scientificNameAuthorship;
1374  }
1375
1376  /**
1377   * The verbatim scientific name as provided by the source.
1378   */
1379  @Nullable
1380  @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
1381  public String getVerbatimScientificName() {
1382    return getVerbatimField(DwcTerm.scientificName);
1383  }
1384
1385  public void setVerbatimScientificName(String scientificName) {
1386    //DO NOTHING
1387  }
1388
1389  /**
1390   * The accepted scientific name for the acceptedTaxonKey from the selected taxonomy.
1391   */
1392  @Nullable
1393  public String getAcceptedScientificName() {
1394    return acceptedScientificName;
1395  }
1396
1397  public void setAcceptedScientificName(String acceptedScientificName) {
1398    this.acceptedScientificName = acceptedScientificName;
1399  }
1400
1401  @Nullable
1402  @Override
1403  public String getKingdom() {
1404    return kingdom;
1405  }
1406
1407  @Override
1408  public void setKingdom(@Nullable String kingdom) {
1409    this.kingdom = kingdom;
1410  }
1411
1412  @Nullable
1413  @Override
1414  public String getPhylum() {
1415    return phylum;
1416  }
1417
1418  @Override
1419  public void setPhylum(@Nullable String phylum) {
1420    this.phylum = phylum;
1421  }
1422
1423  @Nullable
1424  @Override
1425  public String getClazz() {
1426    return clazz;
1427  }
1428
1429  @Override
1430  public void setClazz(@Nullable String clazz) {
1431    this.clazz = clazz;
1432  }
1433
1434  @Nullable
1435  @Override
1436  public String getOrder() {
1437    return order;
1438  }
1439
1440  @Override
1441  public void setOrder(@Nullable String order) {
1442    this.order = order;
1443  }
1444
1445  @Nullable
1446  @Override
1447  public String getFamily() {
1448    return family;
1449  }
1450
1451  @Override
1452  public void setFamily(@Nullable String family) {
1453    this.family = family;
1454  }
1455
1456  @Nullable
1457  @Override
1458  public String getGenus() {
1459    return genus;
1460  }
1461
1462  @Override
1463  public void setGenus(@Nullable String genus) {
1464    this.genus = genus;
1465  }
1466
1467  @Nullable
1468  public String getGenericName() {
1469    return genericName;
1470  }
1471
1472  public void setGenericName(String genericName) {
1473    this.genericName = genericName;
1474  }
1475
1476  @Nullable
1477  @Override
1478  public String getSubgenus() {
1479    return subgenus;
1480  }
1481
1482  @Override
1483  public void setSubgenus(@Nullable String subgenus) {
1484    this.subgenus = subgenus;
1485  }
1486
1487  @Nullable
1488  @Override
1489  public String getHigherRank(Rank rank) {
1490    return ClassificationUtils.getHigherRank(this, rank);
1491  }
1492
1493  /**
1494   * The corresponding scientific name of the speciesKey from the selected taxonomy.
1495   */
1496  @Nullable
1497  @Override
1498  public String getSpecies() {
1499    return species;
1500  }
1501
1502  @Override
1503  public void setSpecies(@Nullable String species) {
1504    this.species = species;
1505  }
1506
1507  @Nullable
1508  public Date getDateIdentified() {
1509    return dateIdentified == null ? null : new Date(dateIdentified.getTime());
1510  }
1511
1512  public void setDateIdentified(@Nullable Date dateIdentified) {
1513    this.dateIdentified = dateIdentified == null ? null : new Date(dateIdentified.getTime());
1514  }
1515
1516  /**
1517   * The decimalLongitude in decimal degrees always for the WGS84 datum. If a different geodetic datum was given the verbatim
1518   * coordinates are transformed into WGS84 values.
1519   */
1520  @Nullable
1521  public Double getDecimalLongitude() {
1522    return decimalLongitude;
1523  }
1524
1525  public void setDecimalLongitude(@Nullable Double decimalLongitude) {
1526    this.decimalLongitude = decimalLongitude;
1527  }
1528
1529  @Nullable
1530  public Double getDecimalLatitude() {
1531    return decimalLatitude;
1532  }
1533
1534  public void setDecimalLatitude(@Nullable Double decimalLatitude) {
1535    this.decimalLatitude = decimalLatitude;
1536  }
1537
1538  /**
1539   * The uncertainty radius for lat/lon in meters.
1540   */
1541  @Nullable
1542  public Double getCoordinateUncertaintyInMeters() {
1543    return coordinateUncertaintyInMeters;
1544  }
1545
1546  public void setCoordinateUncertaintyInMeters(@Nullable Double coordinateUncertaintyInMeters) {
1547    this.coordinateUncertaintyInMeters = coordinateUncertaintyInMeters;
1548  }
1549
1550  @Nullable
1551  public Double getCoordinatePrecision() {
1552    return coordinatePrecision;
1553  }
1554
1555  public void setCoordinatePrecision(Double coordinatePrecision) {
1556    this.coordinatePrecision = coordinatePrecision;
1557  }
1558
1559  /**
1560   * @deprecated to be removed in the public v2 of the API (see POR-3061)
1561   * The uncertainty for latitude in decimal degrees.
1562   * Note that the longitude degrees have a different accuracy in degrees which changes with latitude and is largest at the poles.
1563   */
1564  @Nullable
1565  @Deprecated
1566  public Double getCoordinateAccuracy() {
1567    return coordinateAccuracy;
1568  }
1569
1570  public void setCoordinateAccuracy(@Nullable Double coordinateAccuracy) {
1571    this.coordinateAccuracy = coordinateAccuracy;
1572  }
1573
1574  /**
1575   * The geodetic datum for the interpreted decimal coordinates.
1576   * This is always WGS84 if a coordinate exists as we reproject other datums into WGS84.
1577   */
1578  @Schema(
1579    description = "The geodetic datum for the interpreted decimal coordinates.\n\n" +
1580      "Coordinates are reprojected to WGS84 if they exist, so this field is either null or `WGS84`."
1581  )
1582  @Nullable
1583  public String getGeodeticDatum() {
1584    if (decimalLatitude != null) {
1585      return GEO_DATUM;
1586    }
1587    return null;
1588  }
1589
1590  /**
1591   * This private method is needed for jackson deserialization only.
1592   */
1593  private void setGeodeticDatum(String datum) {
1594    // ignore, we have a static WGS84 value
1595  }
1596
1597  /**
1598   * Elevation in meters usually above sea level (altitude).
1599   * </br>
1600   * The elevation is calculated using the equation: (minimumElevationInMeters + maximumElevationInMeters) / 2.
1601   */
1602  @Nullable
1603  public Double getElevation() {
1604    return elevation;
1605  }
1606
1607  public void setElevation(@Nullable Double elevation) {
1608    this.elevation = elevation;
1609  }
1610
1611  /**
1612   * Elevation accuracy is the uncertainty for the elevation in meters.
1613   * </br>
1614   * The elevation accuracy is calculated using the equation: (maximumElevationInMeters - minimumElevationInMeters) / 2
1615   */
1616  @Nullable
1617  public Double getElevationAccuracy() {
1618    return elevationAccuracy;
1619  }
1620
1621  public void setElevationAccuracy(@Nullable Double elevationAccuracy) {
1622    this.elevationAccuracy = elevationAccuracy;
1623  }
1624
1625  /**
1626   * Depth in meters below the surface. Complimentary to elevation, the depth can be 10 meters below the surface of a
1627   * lake in 1100m (=elevation).
1628   * </br>
1629   * The depth is calculated using the equation: (minimumDepthInMeters + maximumDepthInMeters) / 2.
1630   */
1631  @Nullable
1632  public Double getDepth() {
1633    return depth;
1634  }
1635
1636  public void setDepth(@Nullable Double depth) {
1637    this.depth = depth;
1638  }
1639
1640  /**
1641   * Depth accuracy is the uncertainty for the depth in meters.
1642   * </br>
1643   * The depth accuracy is calculated using the equation: (maximumDepthInMeters - minimumDepthInMeters) / 2
1644   */
1645  @Nullable
1646  public Double getDepthAccuracy() {
1647    return depthAccuracy;
1648  }
1649
1650  public void setDepthAccuracy(@Nullable Double depthAccuracy) {
1651    this.depthAccuracy = depthAccuracy;
1652  }
1653
1654  @Nullable
1655  public Continent getContinent() {
1656    return continent;
1657  }
1658
1659  public void setContinent(@Nullable Continent continent) {
1660    this.continent = continent;
1661  }
1662
1663  @Schema(
1664    description = "The 2-letter country code (as per ISO-3166-1) of the country, territory or area in which the " +
1665      "occurrence was recorded.",
1666    externalDocs = @ExternalDocumentation(
1667      description = "Darwin Core definition",
1668      url = "https://rs.tdwg.org/dwc/terms/countryCode"
1669    )
1670  )
1671  @Nullable
1672  @JsonProperty("countryCode")
1673  public Country getCountry() {
1674    return country;
1675  }
1676
1677  public void setCountry(@Nullable Country country) {
1678    this.country = country;
1679  }
1680
1681  @Nullable
1682  @JsonProperty("gbifRegion")
1683  public GbifRegion getGbifRegion() {
1684    return Optional.ofNullable(country).map(Country::getGbifRegion).orElse(null);
1685  }
1686
1687  private void setGbifRegion(String gbifRegion) {
1688    // ignore, setter only to avoid JSON being written into the fields map
1689  }
1690
1691  /**
1692   * Renders the country title as a JSON property country in addition to the ISO 3166 2 letter countryCode being
1693   * serialized by the regular country Java property.
1694   * Made private to use it only for JSON serialization and not within Java code.
1695   */
1696  @Schema(
1697    description = "The title (as per ISO-3166-1) of the country, territory or area in which the " +
1698      "occurrence was recorded.",
1699    externalDocs = @ExternalDocumentation(
1700      description = "Darwin Core definition",
1701      url = "https://rs.tdwg.org/dwc/terms/country"
1702    )
1703  )
1704  @Nullable
1705  @JsonProperty("country")
1706  private String getCountryTitle() {
1707    return country == null ? null : country.getTitle();
1708  }
1709
1710  private void setCountryTitle(String country) {
1711    // ignore, setter only to avoid JSON being written into the fields map
1712  }
1713
1714  @Nullable
1715  public String getStateProvince() {
1716    return stateProvince;
1717  }
1718
1719  public void setStateProvince(@Nullable String stateProvince) {
1720    this.stateProvince = stateProvince;
1721  }
1722
1723  @Nullable
1724  public String getWaterBody() {
1725    return waterBody;
1726  }
1727
1728  public void setWaterBody(@Nullable String waterBody) {
1729    this.waterBody = waterBody;
1730  }
1731
1732  /**
1733   * The distance in metres from a known centroid, e.g. a country centroid.
1734   */
1735  public Double getDistanceFromCentroidInMeters() {
1736    return distanceFromCentroidInMeters;
1737  }
1738
1739  public void setDistanceFromCentroidInMeters(Double distanceFromCentroidInMeters) {
1740    this.distanceFromCentroidInMeters = distanceFromCentroidInMeters;
1741  }
1742
1743  @Nullable
1744  public String getHigherGeography() {
1745    return higherGeography;
1746  }
1747
1748  public void setHigherGeography(String higherGeography) {
1749    this.higherGeography = higherGeography;
1750  }
1751
1752  @Nullable
1753  public String getGeoreferencedBy() {
1754    return georeferencedBy;
1755  }
1756
1757  public void setGeoreferencedBy(String georeferencedBy) {
1758    this.georeferencedBy = georeferencedBy;
1759  }
1760
1761  /**
1762   * The full year of the event date.
1763   *
1764   * @return the year of the event date
1765   */
1766  @Min(1500)
1767  @Max(2030)
1768  @Nullable
1769  public Integer getYear() {
1770    return year;
1771  }
1772
1773  public void setYear(@Nullable Integer year) {
1774    this.year = year;
1775  }
1776
1777  /**
1778   * The month of the year of the event date starting with zero for january following {@link Date}.
1779   *
1780   * @return the month of the event date
1781   */
1782  @Min(1)
1783  @Max(12)
1784  @Nullable
1785  public Integer getMonth() {
1786    return month;
1787  }
1788
1789  public void setMonth(@Nullable Integer month) {
1790    this.month = month;
1791  }
1792
1793  /**
1794   * The day of the month of the event date.
1795   *
1796   * @return the day of the event date
1797   */
1798  @Min(1)
1799  @Max(31)
1800  @Nullable
1801  public Integer getDay() {
1802    return day;
1803  }
1804
1805  public void setDay(@Nullable Integer day) {
1806    this.day = day;
1807  }
1808
1809  /**
1810   * The date the occurrence was recorded or collected.
1811   */
1812  @Nullable
1813  public IsoDateInterval getEventDate() {
1814    return eventDate == null ? null : new IsoDateInterval(eventDate.getFrom(), eventDate.getTo());
1815  }
1816
1817  public void setEventDate(@Nullable IsoDateInterval eventDate) {
1818    this.eventDate = eventDate == null ? null : new IsoDateInterval(eventDate.getFrom(), eventDate.getTo());
1819  }
1820
1821  /**
1822   * The earliest integer day of the year of the event.
1823   *
1824   * @return the earliest integer day of the event date
1825   */
1826  @Min(1)
1827  @Max(366)
1828  @Nullable
1829  public Integer getStartDayOfYear() {
1830    return startDayOfYear;
1831  }
1832
1833  public void setStartDayOfYear(@Nullable Integer startDayOfYear) {
1834    this.startDayOfYear = startDayOfYear;
1835  }
1836
1837  /**
1838   * The latest integer day of the year of the event.
1839   *
1840   * @return the latest integer day of the event date
1841   */
1842  @Min(1)
1843  @Max(366)
1844  @Nullable
1845  public Integer getEndDayOfYear() {
1846    return endDayOfYear;
1847  }
1848
1849  public void setEndDayOfYear(@Nullable Integer endDayOfYear) {
1850    this.endDayOfYear = endDayOfYear;
1851  }
1852
1853  @Nullable
1854  public String getTypeStatus() {
1855    return typeStatus;
1856  }
1857
1858  public void setTypeStatus(@Nullable String typeStatus) {
1859    this.typeStatus = typeStatus;
1860  }
1861
1862  /**
1863   * The scientific name the type status of this specimen applies to.
1864   */
1865  @Nullable
1866  public String getTypifiedName() {
1867    return typifiedName;
1868  }
1869
1870  public void setTypifiedName(@Nullable String typifiedName) {
1871    this.typifiedName = typifiedName;
1872  }
1873
1874  /**
1875   * A set of issues found for this occurrence.
1876   */
1877  @NotNull
1878  public Set<OccurrenceIssue> getIssues() {
1879    return issues;
1880  }
1881
1882  public void setIssues(Set<OccurrenceIssue> issues) {
1883    Objects.requireNonNull(issues, "Issues cannot be null");
1884    EnumSet<OccurrenceIssue> set = EnumSet.noneOf(OccurrenceIssue.class);
1885    set.addAll(issues);
1886    this.issues = set;
1887  }
1888
1889  public void addIssue(OccurrenceIssue issue) {
1890    Objects.requireNonNull(issue, "Issue needs to be specified");
1891    issues.add(issue);
1892  }
1893
1894  /**
1895   * The interpreted dc:modified from the verbatim source data.
1896   * Ideally indicating when a record was last modified in the source.
1897   */
1898  @Nullable
1899  public Date getModified() {
1900    return modified == null ? null : new Date(modified.getTime());
1901  }
1902
1903  public void setModified(@Nullable Date modified) {
1904    this.modified = modified == null ? null : new Date(modified.getTime());
1905  }
1906
1907  /**
1908   * The date this occurrence last went through the interpretation phase of the GBIF indexing.
1909   */
1910  @Nullable
1911  public Date getLastInterpreted() {
1912    return lastInterpreted == null ? null : new Date(lastInterpreted.getTime());
1913  }
1914
1915  public void setLastInterpreted(@Nullable Date lastInterpreted) {
1916    this.lastInterpreted = lastInterpreted == null ? null : new Date(lastInterpreted.getTime());
1917  }
1918
1919  /**
1920   * An external link to more details, the records "homepage".
1921   */
1922  @Nullable
1923  public URI getReferences() {
1924    return references;
1925  }
1926
1927  public void setReferences(URI references) {
1928    this.references = references;
1929  }
1930
1931  /**
1932   * A number or enumeration value for the quantity of organisms.
1933   */
1934  @Nullable
1935  public Double getOrganismQuantity() {
1936    return organismQuantity;
1937  }
1938
1939  public void setOrganismQuantity(@Nullable Double organismQuantity) {
1940    this.organismQuantity = organismQuantity;
1941  }
1942
1943  /**
1944   * The type of quantification system used for the quantity of organisms.
1945   */
1946  @Nullable
1947  public String getOrganismQuantityType() {
1948    return organismQuantityType;
1949  }
1950
1951  public void setOrganismQuantityType(@Nullable String organismQuantityType) {
1952    this.organismQuantityType = organismQuantityType;
1953  }
1954
1955  /**
1956   * The unit of measurement of the size (time duration, length, area, or volume) of a sample in a sampling event.
1957   */
1958  @Nullable
1959  public String getSampleSizeUnit() {
1960    return sampleSizeUnit;
1961  }
1962
1963  public void setSampleSizeUnit(@Nullable String sampleSizeUnit) {
1964    this.sampleSizeUnit = sampleSizeUnit;
1965  }
1966
1967  /**
1968   * A numeric value for a measurement of the size (time duration, length, area, or volume) of a sample in a sampling event.
1969   */
1970  @Nullable
1971  public Double getSampleSizeValue() {
1972    return sampleSizeValue;
1973  }
1974
1975  public void setSampleSizeValue(@Nullable Double sampleSizeValue) {
1976    this.sampleSizeValue = sampleSizeValue;
1977  }
1978
1979  /**
1980   * Calculated filed organismQuantity / sampleSizeValue, if the type is identical
1981   */
1982  @Nullable
1983  public Double getRelativeOrganismQuantity() {
1984    return relativeOrganismQuantity;
1985  }
1986
1987  public void setRelativeOrganismQuantity(@Nullable Double relativeOrganismQuantity) {
1988    this.relativeOrganismQuantity = relativeOrganismQuantity;
1989  }
1990
1991  /**
1992   * Flag occurrence when associatedSequences/extension exists
1993   */
1994  public boolean getIsSequenced() {
1995    return isSequenced;
1996  }
1997
1998  public void setIsSequenced(boolean isSequenced) {
1999    this.isSequenced = isSequenced;
2000  }
2001
2002  /**
2003   * A list (concatenated and separated) of identifiers (publication, global unique identifier, URI) of genetic
2004   * sequence information associated with the material entity.
2005   */
2006  @Nullable
2007  public String getAssociatedSequences() {
2008    return associatedSequences;
2009  }
2010
2011  public void setAssociatedSequences(String associatedSequences) {
2012    this.associatedSequences = associatedSequences;
2013  }
2014
2015  /**
2016   * Applied license to the occurrence record or dataset to which this record belongs to.
2017   */
2018  @NotNull
2019  public License getLicense() {
2020    return license;
2021  }
2022
2023  public void setLicense(License license) {
2024    this.license = license;
2025  }
2026
2027  @NotNull
2028  public List<Identifier> getIdentifiers() {
2029    return identifiers;
2030  }
2031
2032  public void setIdentifiers(List<Identifier> identifiers) {
2033    this.identifiers = identifiers;
2034  }
2035
2036  @NotNull
2037  public List<MediaObject> getMedia() {
2038    return media;
2039  }
2040
2041  public void setMedia(List<MediaObject> media) {
2042    this.media = media;
2043  }
2044
2045  @NotNull
2046  public List<MeasurementOrFact> getFacts() {
2047    return facts;
2048  }
2049
2050  public void setFacts(List<MeasurementOrFact> facts) {
2051    this.facts = facts;
2052  }
2053
2054  @NotNull
2055  public List<OccurrenceRelation> getRelations() {
2056    return relations;
2057  }
2058
2059  public void setRelations(List<OccurrenceRelation> relations) {
2060    this.relations = relations;
2061  }
2062
2063  @NotNull
2064  public List<AgentIdentifier> getRecordedByIds() {
2065    return recordedByIds;
2066  }
2067
2068  public void setRecordedByIds(List<AgentIdentifier> recordedByIds) {
2069    this.recordedByIds = recordedByIds;
2070  }
2071
2072  @NotNull
2073  public List<AgentIdentifier> getIdentifiedByIds() {
2074    return identifiedByIds;
2075  }
2076
2077  public void setIdentifiedByIds(List<AgentIdentifier> identifiedByIds) {
2078    this.identifiedByIds = identifiedByIds;
2079  }
2080
2081  @NotNull
2082  public Gadm getGadm() {
2083    return gadm;
2084  }
2085
2086  public void setGadm(Gadm gadm) {
2087    this.gadm = gadm;
2088  }
2089
2090  @Nullable
2091  public UUID getInstitutionKey() {
2092    return institutionKey;
2093  }
2094
2095  public void setInstitutionKey(UUID institutionKey) {
2096    this.institutionKey = institutionKey;
2097  }
2098
2099  @Nullable
2100  public UUID getCollectionKey() {
2101    return collectionKey;
2102  }
2103
2104  public void setCollectionKey(UUID collectionKey) {
2105    this.collectionKey = collectionKey;
2106  }
2107
2108  public boolean getIsInCluster() {
2109    return isInCluster;
2110  }
2111
2112  public void setIsInCluster(boolean isInCluster) {
2113    this.isInCluster = isInCluster;
2114  }
2115
2116  @Nullable
2117  public String getDegreeOfEstablishment() {
2118    return degreeOfEstablishment;
2119  }
2120
2121  public void setDegreeOfEstablishment(String degreeOfEstablishment) {
2122    this.degreeOfEstablishment = degreeOfEstablishment;
2123  }
2124
2125  @Nullable
2126  public String getPathway() {
2127    return pathway;
2128  }
2129
2130  public void setPathway(String pathway) {
2131    this.pathway = pathway;
2132  }
2133
2134  public String getDatasetID() {
2135    return datasetID;
2136  }
2137
2138  public void setDatasetID(String datasetID) {
2139    this.datasetID = datasetID;
2140  }
2141
2142  public String getDatasetName() {
2143    return datasetName;
2144  }
2145
2146  public void setDatasetName(String datasetName) {
2147    this.datasetName = datasetName;
2148  }
2149
2150  public String getOtherCatalogNumbers() {
2151    return otherCatalogNumbers;
2152  }
2153
2154  public void setOtherCatalogNumbers(String otherCatalogNumbers) {
2155    this.otherCatalogNumbers = otherCatalogNumbers;
2156  }
2157
2158  @Nullable
2159  public String getEarliestEonOrLowestEonothem() {
2160    return earliestEonOrLowestEonothem;
2161  }
2162
2163  public void setEarliestEonOrLowestEonothem(String earliestEonOrLowestEonothem) {
2164    this.earliestEonOrLowestEonothem = earliestEonOrLowestEonothem;
2165  }
2166
2167  @Nullable
2168  public String getLatestEonOrHighestEonothem() {
2169    return latestEonOrHighestEonothem;
2170  }
2171
2172  public void setLatestEonOrHighestEonothem(String latestEonOrHighestEonothem) {
2173    this.latestEonOrHighestEonothem = latestEonOrHighestEonothem;
2174  }
2175
2176  @Nullable
2177  public String getEarliestEraOrLowestErathem() {
2178    return earliestEraOrLowestErathem;
2179  }
2180
2181  public void setEarliestEraOrLowestErathem(String earliestEraOrLowestErathem) {
2182    this.earliestEraOrLowestErathem = earliestEraOrLowestErathem;
2183  }
2184
2185  @Nullable
2186  public String getLatestEraOrHighestErathem() {
2187    return latestEraOrHighestErathem;
2188  }
2189
2190  public void setLatestEraOrHighestErathem(String latestEraOrHighestErathem) {
2191    this.latestEraOrHighestErathem = latestEraOrHighestErathem;
2192  }
2193
2194  @Nullable
2195  public String getEarliestPeriodOrLowestSystem() {
2196    return earliestPeriodOrLowestSystem;
2197  }
2198
2199  public void setEarliestPeriodOrLowestSystem(String earliestPeriodOrLowestSystem) {
2200    this.earliestPeriodOrLowestSystem = earliestPeriodOrLowestSystem;
2201  }
2202
2203  @Nullable
2204  public String getLatestPeriodOrHighestSystem() {
2205    return latestPeriodOrHighestSystem;
2206  }
2207
2208  public void setLatestPeriodOrHighestSystem(String latestPeriodOrHighestSystem) {
2209    this.latestPeriodOrHighestSystem = latestPeriodOrHighestSystem;
2210  }
2211
2212  @Nullable
2213  public String getEarliestEpochOrLowestSeries() {
2214    return earliestEpochOrLowestSeries;
2215  }
2216
2217  public void setEarliestEpochOrLowestSeries(String earliestEpochOrLowestSeries) {
2218    this.earliestEpochOrLowestSeries = earliestEpochOrLowestSeries;
2219  }
2220
2221  @Nullable
2222  public String getLatestEpochOrHighestSeries() {
2223    return latestEpochOrHighestSeries;
2224  }
2225
2226  public void setLatestEpochOrHighestSeries(String latestEpochOrHighestSeries) {
2227    this.latestEpochOrHighestSeries = latestEpochOrHighestSeries;
2228  }
2229
2230  @Nullable
2231  public String getEarliestAgeOrLowestStage() {
2232    return earliestAgeOrLowestStage;
2233  }
2234
2235  public void setEarliestAgeOrLowestStage(String earliestAgeOrLowestStage) {
2236    this.earliestAgeOrLowestStage = earliestAgeOrLowestStage;
2237  }
2238
2239  @Nullable
2240  public String getLatestAgeOrHighestStage() {
2241    return latestAgeOrHighestStage;
2242  }
2243
2244  public void setLatestAgeOrHighestStage(String latestAgeOrHighestStage) {
2245    this.latestAgeOrHighestStage = latestAgeOrHighestStage;
2246  }
2247
2248  @Nullable
2249  public String getLowestBiostratigraphicZone() {
2250    return lowestBiostratigraphicZone;
2251  }
2252
2253  public void setLowestBiostratigraphicZone(String lowestBiostratigraphicZone) {
2254    this.lowestBiostratigraphicZone = lowestBiostratigraphicZone;
2255  }
2256
2257  @Nullable
2258  public String getHighestBiostratigraphicZone() {
2259    return highestBiostratigraphicZone;
2260  }
2261
2262  public void setHighestBiostratigraphicZone(String highestBiostratigraphicZone) {
2263    this.highestBiostratigraphicZone = highestBiostratigraphicZone;
2264  }
2265
2266  @Nullable
2267  public String getGroup() {
2268    return group;
2269  }
2270
2271  public void setGroup(String group) {
2272    this.group = group;
2273  }
2274
2275  @Nullable
2276  public String getFormation() {
2277    return formation;
2278  }
2279
2280  public void setFormation(String formation) {
2281    this.formation = formation;
2282  }
2283
2284  @Nullable
2285  public String getMember() {
2286    return member;
2287  }
2288
2289  public void setMember(String member) {
2290    this.member = member;
2291  }
2292
2293  @Nullable
2294  public String getBed() {
2295    return bed;
2296  }
2297
2298  public void setBed(String bed) {
2299    this.bed = bed;
2300  }
2301
2302  public String getRecordedBy() {
2303    return recordedBy;
2304  }
2305
2306  public void setRecordedBy(String recordedBy) {
2307    this.recordedBy = recordedBy;
2308  }
2309
2310  public String getIdentifiedBy() {
2311    return identifiedBy;
2312  }
2313
2314  public void setIdentifiedBy(String identifiedBy) {
2315    this.identifiedBy = identifiedBy;
2316  }
2317
2318  public String getPreparations() {
2319    return preparations;
2320  }
2321
2322  public void setPreparations(String preparations) {
2323    this.preparations = preparations;
2324  }
2325
2326  public String getSamplingProtocol() {
2327    return samplingProtocol;
2328  }
2329
2330  public void setSamplingProtocol(String samplingProtocol) {
2331    this.samplingProtocol = samplingProtocol;
2332  }
2333
2334  @Deprecated
2335  public List<String> getDnaSequenceID() {
2336    return dnaSequenceID;
2337  }
2338
2339  @Deprecated
2340  public void setDnaSequenceID(List<String> dnaSequenceID) {
2341    this.dnaSequenceID = dnaSequenceID;
2342  }
2343
2344  public Map<String, Classification> getClassifications() {
2345    return classifications;
2346  }
2347
2348  public void setClassifications(Map<String, Classification> classifications) {
2349    this.classifications = classifications;
2350  }
2351
2352  /**
2353   * Convenience method checking if any spatial validation rule has not passed.
2354   * Primarily used to indicate that the record should not be displayed on a map.
2355   */
2356  @JsonIgnore
2357  public boolean hasSpatialIssue() {
2358    for (OccurrenceIssue rule : OccurrenceIssue.GEOSPATIAL_RULES) {
2359      if (issues.contains(rule)) {
2360        return true;
2361      }
2362    }
2363    return false;
2364  }
2365
2366  /**
2367   * This private method is only for serialization via jackson and not exposed anywhere else!
2368   * It maps the verbatimField terms into properties with their simple name or qualified names for UnknownTerms.
2369   */
2370  @JsonAnyGetter
2371  private Map<String, String> jsonVerbatimFields() {
2372    Map<String, String> extendedProps = new HashMap<>();
2373    for (Map.Entry<Term, String> prop : getVerbatimFields().entrySet()) {
2374      Term t = prop.getKey();
2375      if (t instanceof UnknownTerm || PROPERTIES.contains(t.simpleName())) {
2376        extendedProps.put(t.qualifiedName(), prop.getValue());
2377      } else {
2378        // render all terms in controlled enumerations as simple names only - unless we have a property of that name already!
2379        extendedProps.put(t.simpleName(), prop.getValue());
2380      }
2381    }
2382    return extendedProps;
2383  }
2384}