001/*
002 * Copyright 2013 Global Biodiversity Information Facility (GBIF)
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 * http://www.apache.org/licenses/LICENSE-2.0
007 * Unless required by applicable law or agreed to in writing, software
008 * distributed under the License is distributed on an "AS IS" BASIS,
009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010 * See the License for the specific language governing permissions and
011 * limitations under the License.
012 */
013package org.gbif.api.vocabulary;
014
015import org.gbif.api.util.VocabularyUtils;
016
017import java.util.Set;
018
019import com.google.common.collect.ImmutableSet;
020
021/**
022 * Enumeration for all possible dataset subtypes.
023 */
024public enum DatasetSubtype {
025  /**
026   * A taxonomic checklist that is authoritative in its classification and synonymy.
027   */
028  TAXONOMIC_AUTHORITY,
029  /**
030   * A nomenclatoral checklist that is authoritative in the pure names and publication information.
031   */
032  NOMENCLATOR_AUTHORITY,
033  /**
034   * A thematic checklist that has a theme for grouping names, e.g. parasites of elephants.
035   */
036  INVENTORY_THEMATIC,
037  /**
038   * A regional checklist that has a regional commonality in grouping names, e.g. species in a protected area.
039   */
040  INVENTORY_REGIONAL,
041  /**
042   * A taxonomic checklist with a global, spatial coverage.
043   * This subtype is used in particular by the catalogue of life to assemble its aggregated checklist.
044   */
045  GLOBAL_SPECIES_DATASET,
046  /**
047   * A taxonomic checklist that has been derived from data that was originally occurrence data.
048   */
049  DERIVED_FROM_OCCURRENCE,
050  /**
051   * Specimen data. Possible museum collection.
052   */
053  SPECIMEN,
054  /**
055   * Observation data. Possible monitoring and field observations.
056   */
057  OBSERVATION;
058
059  /**
060   * A set of all DatasetSubtype that belong to DatasetType OCCURRENCE.
061   *
062   * @see DatasetType#OCCURRENCE
063   */
064  public static final Set<DatasetSubtype> OCCURRENCE_DATASET_SUBTYPES = ImmutableSet.of(SPECIMEN, OBSERVATION);
065
066  /**
067   * A set of all DatasetSubtype that belong to DatasetType CHECKLIST.
068   *
069   * @see DatasetType#CHECKLIST
070   */
071  public static final Set<DatasetSubtype> CHECKLIST_DATASET_SUBTYPES = ImmutableSet
072    .of(TAXONOMIC_AUTHORITY, NOMENCLATOR_AUTHORITY, INVENTORY_THEMATIC, INVENTORY_REGIONAL, GLOBAL_SPECIES_DATASET,
073      DERIVED_FROM_OCCURRENCE);
074
075  /**
076   * @return the matching DatasetSubtype or null
077   */
078  public static DatasetSubtype fromString(String datasetSubType) {
079    return (DatasetSubtype) VocabularyUtils.lookupEnum(datasetSubType, DatasetSubtype.class);
080  }
081}