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.vocabulary; 015 016import org.gbif.api.util.VocabularyUtils; 017 018import java.util.Arrays; 019import java.util.Collections; 020import java.util.HashSet; 021import java.util.Set; 022 023/** 024 * Enumeration for all possible dataset subtypes. 025 */ 026public enum DatasetSubtype { 027 /** 028 * A taxonomic checklist that is authoritative in its classification and synonymy. 029 */ 030 TAXONOMIC_AUTHORITY, 031 /** 032 * A nomenclatoral checklist that is authoritative in the pure names and publication information. 033 */ 034 NOMENCLATOR_AUTHORITY, 035 /** 036 * A thematic checklist that has a theme for grouping names, e.g. parasites of elephants. 037 */ 038 INVENTORY_THEMATIC, 039 /** 040 * A regional checklist that has a regional commonality in grouping names, e.g. species in a protected area. 041 */ 042 INVENTORY_REGIONAL, 043 /** 044 * A taxonomic checklist with a global, spatial coverage. 045 * This subtype is used in particular by the catalogue of life to assemble its aggregated checklist. 046 */ 047 GLOBAL_SPECIES_DATASET, 048 /** 049 * A taxonomic checklist that has been derived from data that was originally occurrence data. 050 */ 051 DERIVED_FROM_OCCURRENCE, 052 /** 053 * Specimen data. Possible museum collection. 054 */ 055 SPECIMEN, 056 /** 057 * Observation data. Possible monitoring and field observations. 058 */ 059 OBSERVATION; 060 061 /** 062 * A set of all DatasetSubtype that belong to DatasetType OCCURRENCE. 063 * 064 * @see DatasetType#OCCURRENCE 065 */ 066 public static final Set<DatasetSubtype> OCCURRENCE_DATASET_SUBTYPES = 067 Collections.unmodifiableSet( 068 new HashSet<>(Arrays.asList(SPECIMEN, OBSERVATION))); 069 070 /** 071 * A set of all DatasetSubtype that belong to DatasetType SAMPLING_EVENT. 072 * 073 * @see DatasetType#SAMPLING_EVENT 074 */ 075 public static final Set<DatasetSubtype> SAMPLING_EVENT_DATASET_SUBTYPES = 076 Collections.unmodifiableSet( 077 new HashSet<>(Arrays.asList(SPECIMEN, OBSERVATION))); 078 079 /** 080 * A set of all DatasetSubtype that belong to DatasetType CHECKLIST. 081 * 082 * @see DatasetType#CHECKLIST 083 */ 084 public static final Set<DatasetSubtype> CHECKLIST_DATASET_SUBTYPES = 085 Collections.unmodifiableSet( 086 new HashSet<>(Arrays.asList(TAXONOMIC_AUTHORITY, NOMENCLATOR_AUTHORITY, INVENTORY_THEMATIC, 087 INVENTORY_REGIONAL, GLOBAL_SPECIES_DATASET, DERIVED_FROM_OCCURRENCE))); 088 089 /** 090 * @return the matching DatasetSubtype or null 091 */ 092 public static DatasetSubtype fromString(String datasetSubType) { 093 return VocabularyUtils.lookupEnum(datasetSubType, DatasetSubtype.class); 094 } 095}