001/*
002 * Copyright 2020 Global Biodiversity Information Facility (GBIF)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.gbif.api.service.occurrence;
017
018import org.gbif.api.vocabulary.Country;
019
020import java.util.SortedMap;
021import java.util.UUID;
022
023/**
024 * Supports the listing of datasets having occurrence records.
025 */
026public interface OccurrenceDatasetIndexService {
027
028  /**
029   * This provides a map of occurrence dataset keys to the number of records matching the given country.
030   * Datasets which do not have content are not included (e.g. no zero-values will exist).
031   * That is to say the count represents the number of records in the dataset that are interpreted as
032   * the provided country, and not the total count of records in the dataset.
033   *
034   * @param country to filter occurrence datasets by
035   * @return a map of dataset keys to counts sorted by count descending
036   */
037  SortedMap<UUID, Long> occurrenceDatasetsForCountry(Country country);
038
039  /**
040   * This provides a map of occurrence dataset keys to the number of records matching the given nub key.
041   * Datasets which do not have content are not included (e.g. no zero-values will exist).
042   * That is to say the count represents the number of records in the dataset that are interpreted as
043   * the provided taxon (or any subordinate taxon), and not the total count of records in the dataset. E.g. a dataset of
044   * 1 million records covering everything, might report it has 300k records of birds (Aves); those records might
045   * themselves have more specific identifications (such as the species).
046   *
047   * @param taxonKey to filter occurrence datasets by
048   * @return a map of dataset keys to counts sorted by count descending
049   */
050  SortedMap<UUID, Long> occurrenceDatasetsForNubKey(int taxonKey);
051}