001/*
002 * Copyright 2014 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.service.occurrence;
014
015import org.gbif.api.vocabulary.Country;
016
017import java.util.SortedMap;
018import java.util.UUID;
019
020/**
021 * Supports the listing of datasets having occurrence records.
022 */
023public interface OccurrenceDatasetIndexService {
024
025  /**
026   * This provides a map of occurrence dataset keys to the number of records matching the given country.
027   * Datasets which do not have content are not included (e.g. no zero-values will exist).
028   * That is to say the count represents the number of records in the dataset that are interpreted as
029   * the provided country, and not the total count of records in the dataset.
030   *
031   * @param country to filter occurrence datasets by
032   * @return a map of dataset keys to counts sorted by count descending
033   */
034  SortedMap<UUID, Integer> occurrenceDatasetsForCountry(Country country);
035
036
037  /**
038   * This provides a map of occurrence dataset keys to the number of records matching the given nub key.
039   * Datasets which do not have content are not included (e.g. no zero-values will exist).
040   * That is to say the count represents the number of records in the dataset that are interpreted as
041   * the provided taxon (or any subordinate taxon), and not the total count of records in the dataset. E.g. a dataset of
042   * 1 million records covering everything, might report it has 300k records of birds (Aves); those records might
043   * themselves have more specific identifications (such as the species).
044   *
045   * @param taxonKey to filter occurrence datasets by
046   * @return a map of dataset keys to counts sorted by count descending
047   */
048  SortedMap<UUID, Integer> occurrenceDatasetsForNubKey(int taxonKey);
049}